Commit Graph

2331 Commits

Author SHA1 Message Date
Beni Ruef 534d5f6bb5 [type/__postgres_conf] Fix errors found by ShellCheck 2021-01-26 14:01:43 +01:00
Beni Ruef c51d68a737 [type/__postgres_conf] New type based on ALTER SYSTEM command 2021-01-26 14:01:43 +01:00
Dennis Camera 35cde3e666 [type/__postgres_role] Fix state explorer when stored password is empty 2021-01-18 13:09:29 +01:00
Darko Poljak 92a50da487 Fix pycodestyle issues 2021-01-18 06:28:09 +01:00
poljakowski 878a65a8b7 Merge branch 'fix/type/__sshd_config/error-on-invalid' into 'master'
sshd config: Produce error if invalid config is generated, fix processing of AuthenticationMethods and AuthorizedKeysFile, document explorer bug

See merge request ungleich-public/cdist!968
2021-01-18 06:22:02 +01:00
poljakowski cce470b556 Merge branch 'bugfix/preos-debug' into 'master'
Fix debug parameter

Closes #849

See merge request ungleich-public/cdist!970
2021-01-18 06:17:36 +01:00
Dennis Camera 2954347771 [type/__postgres_role] Add note regarding empty passwords 2021-01-14 13:46:40 +01:00
Darko Poljak c819548343 Fix debug parameter
-d was removed from cdist in favor of mulitple -v and -l parameters, but
-d was not removed from preos.

Resolve #849.
2021-01-11 09:51:52 +01:00
Dennis Camera bd8ab8f26f [type/__sshd_config] Document "bug" in state explorer 2021-01-05 17:02:42 +01:00
Dennis Camera 8753b7eedf [type/__sshd_config] Make AuthenticationMethods and AuthorizedKeysFile singleton options
They were incorrectly treated as non-singleton options before.

cf. https://github.com/openssh/openssh-portable/blob/V_8_4/servconf.c#L2273
and https://github.com/openssh/openssh-portable/blob/V_8_4/servconf.c#L1899 resp.
2021-01-05 16:59:04 +01:00
Dennis Camera 766198912d [type/__sshd_config] Produce error if invalid config file is generated
Previously, cdist would silently swallow the error (no invalid config file was
generated).

Reason: `set -e` does not exit if a command in a sub-command group fails,
it merely returns with a non-zero exit status.

e.g. the following snippet does not abort the script if sshd -t returns with a
non-zero exit status:

    set -e
    cmp -s old new || {
        # check config file and update it
        sshd -t -f new \
        && cat new >old
    }

or compressed:

    set -e
    false || { false && true; }
    echo $?
    # prints 1
2021-01-05 15:50:21 +01:00
Nico Schottelius a10d43bc69 Merge branch 'master' of code.ungleich.ch:ungleich-public/cdist 2020-12-20 11:42:44 +01:00
Mark Verboom 8dc2c4207c Added optional dirmode parameter to set the mode of (optional) the directory. 2020-12-18 11:16:28 +01:00
Dennis Camera 99d82fd0d5 [type/__postgres_role] Always set psql -q 2020-12-17 17:05:58 +01:00
Dennis Camera 1180f13ed6 [type/__postgres_role] Fix setting password
We need to make sure that the password does not end up in ~/.psql_history.
2020-12-17 17:03:58 +01:00
Dennis Camera 4859c27900 [type/__postgres_role] Refactor gencode-remote 2020-12-17 16:57:43 +01:00
Dennis Camera 7b7ca4d385 [type/__postgres_role] Handle password changes 2020-12-16 19:07:05 +01:00
Dennis Camera c36df82882 [type/__postgres_role] ALTER ROLE when parameters change 2020-12-15 21:11:48 +01:00
Dennis Camera 932e2496ed [type/__postgres_role] Lint 2020-12-15 18:40:39 +01:00
poljakowski f87da8150c Merge branch 'type/__debian_backports' into 'master'
__apt_backports type

See merge request ungleich-public/cdist!964
2020-12-13 16:03:31 +01:00
matze 27aca06fb8 __apt_backports: undo __apt_update_index call
Becuase it is already done by __apt_source.
2020-12-12 17:34:51 +01:00
matze fca35fc858 __apt_backports: fix explorer call
s/-/_/ because the explorers are following an other convention :-)
2020-12-12 17:29:58 +01:00
evilham 645734c629 [explorer/os_version] Improve FreeBSD support.
It looks like uname -r is not the most reliable way to get the target patch
level for the target system.

For more information see:
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=251743
2020-12-12 12:15:17 +01:00
matze fafa3d9ea5 __apt_backports: update index if required
This type now automatically calls the type __apt_update_index to update
the package index if something changed.
2020-12-12 10:00:23 +01:00
matze 49aec0b5e4 __apt_backports: list supported OSes
The manpage now lists all OSes where this type supports backports.
2020-12-12 09:40:47 +01:00
matze c4d19a2319 __debian_backports -> __apt_backports; add wider os support
As discussed in the chat, this type now supports a broader list of OSes
which it supports backports for. Because of this, it was renamed to
something more generic. "apt" should fit in.
2020-12-12 09:36:17 +01:00
Nico Schottelius 69b8bc9af0 Merge branch 'master' of code.ungleich.ch:ungleich-public/cdist 2020-12-11 19:38:03 +01:00
Nico Schottelius bc2948a8a5 ++scan stuff 2020-12-11 19:37:53 +01:00
matze 0d96b31b56 __debian_backports: pass shellcheck for sourced file
Because the sourced explorer can't be detected by shellcheck, it will be
completely disabled. Changing the path to /etc/os-release isn't
deterministic either.

The shellcheck wiki page suggests to use `source=/dev/null` instead of
`disable=SC1090`, but it was choosen to completely avoid that check ..
2020-12-11 18:13:44 +01:00
matze a5169ad858 new type __debian_backports
This new type will setup the backports distribution for the current
Debian release.
2020-12-10 21:24:26 +01:00
poljakowski 0546d6e476 Merge branch 'fix/__block/escape' into 'master'
__block: fix escaping in here-doc

Closes #838

See merge request ungleich-public/cdist!962
2020-12-08 19:36:45 +01:00
poljakowski a1987fe410 Merge branch 'feature/__iptables_rule/ipv6' into 'master'
__iptables*: add IPv6 support

See merge request ungleich-public/cdist!959
2020-12-08 07:10:29 +01:00
matze c5ca4cd2e1 __block: securly quote via the quote function
Because the function already exists, it will be used for the file to be
changed, too. Therefor, no quotes are required for that value.

The prefix and suffix match was also improved: There is no regex check
any more (the regex did checked the whole line); instead it will do it
simple.
2020-12-07 19:59:05 +01:00
poljakowski 226f665fb5 Merge branch 'imp-deprecation' into 'master'
Deal with deprecation of imp module.

See merge request ungleich-public/cdist!963
2020-12-07 19:48:08 +01:00
evilham bed08c2c5c Deal with deprecation of imp module.
importlib has been a thing since Python 3.1, and imp has been deprecated since
3.4.

Insert random complaint here about not being able to use f-strings because they
were introduced in Python 3.6 and apparently we support Python 3.5 >,<.

Output diff before to after for ./bin/cdist-build-helper test (on heavy load):
```
1,2d0
< /usr/home/evilham/s/cdist/cdist/cdist/test/__main__.py:23: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
<   import imp
72c70
< ERROR: cdisttesthost: __file/tmp/foobar requires object __file without object id. Defined at /tmp/tmp.cdist.test.g87lx7c8/tmp.cdist.test.6ramsakx
---
> ERROR: cdisttesthost: __file/tmp/foobar requires object __file without object id. Defined at /tmp/tmp.cdist.test.aqdf6vjz/tmp.cdist.test.jgv3udel
76c74
< test_nonexistent_type_requirement (cdist.test.emulator.EmulatorTestCase) ... ERROR: cdisttesthost: __file/tmp/foobar requires object __does-not-exist/some-id, but type __does-not-exist does not exist. Defined at /tmp/tmp.cdist.test.mma5j8ln/tmp.cdist.test.3zg4by4d
---
> test_nonexistent_type_requirement (cdist.test.emulator.EmulatorTestCase) ... ERROR: cdisttesthost: __file/tmp/foobar requires object __does-not-exist/some-id, but type __does-not-exist does not exist. Defined at /tmp/tmp.cdist.test.t8d6ockr/tmp.cdist.test.uimxurg9
86c84
< test_initial_manifest_environment (cdist.test.manifest.ManifestTestCase) ... VERBOSE: cdisttesthost: Running initial manifest /tmp/tmp.cdist.test.uvid60ij/759547ff4356de6e3d9e08522b0d0807/data/conf/manifest/dump_environment
---
> test_initial_manifest_environment (cdist.test.manifest.ManifestTestCase) ... VERBOSE: cdisttesthost: Running initial manifest /tmp/tmp.cdist.test._cttcnrj/759547ff4356de6e3d9e08522b0d0807/data/conf/manifest/dump_environment
89c87
< test_type_manifest_environment (cdist.test.manifest.ManifestTestCase) ... VERBOSE: cdisttesthost: Running type manifest /tmp/tmp.cdist.test.k1i2onpb/759547ff4356de6e3d9e08522b0d0807/data/conf/type/__dump_environment/manifest for object __dump_environment/whatever
---
> test_type_manifest_environment (cdist.test.manifest.ManifestTestCase) ... VERBOSE: cdisttesthost: Running type manifest /tmp/tmp.cdist.test.ukr7lrzd/759547ff4356de6e3d9e08522b0d0807/data/conf/type/__dump_environment/manifest for object __dump_environment/whatever
272c270
< Ran 225 tests in 44.457s
---
> Ran 225 tests in 43.750s
```
2020-12-06 20:24:00 +01:00
matze 3930f69456 __block: fix escaping in here-doc
This changes the here-document to do not interpret any shell-things. It
also single-quotes some more strings that are printed to code-remote.

Fixes #838
2020-12-06 16:45:58 +01:00
matze 087be130fa __iptables_apply: shorten copyright header
Do we need all the copyright header or is this sufficient? The licence
is given for cdist, but not on the target host. But it should be clear
anyway.
2020-12-04 19:23:49 +01:00
Dennis Camera 2d19856840 [type/__package_pkgng_freebsd] Set ASSUME_ALWAYS_YES instead of -y 2020-12-04 18:26:03 +01:00
matze ba7d16a155 __iptables_*: correct manpage spelling 2020-12-04 17:57:55 +01:00
matze a1db5c3d0e __iptables*: Update manpages for execution order
To make some thinks clear if someone needs it ..
2020-12-02 18:22:31 +01:00
matze bee255c1ae __iptables_apply: man updates 2020-12-02 18:04:50 +01:00
matze f568462e49 __iptables_rule: fix shellcheck SC2235 2020-12-02 17:48:41 +01:00
matze 84172550df __iptables*: add IPv6 support
Because it currently only support IPv4. To implement this, it falls back
to IPv4 for backward compatibilty, but now supports rules for IPv6 and
both protocols at the same time.
2020-11-30 20:35:19 +01:00
poljakowski a234445e85 Merge branch 'feature/type/__localedef' into 'master'
__localedef: Add new type to replace __locale

See merge request ungleich-public/cdist!951
2020-11-20 19:42:52 +01:00
poljakowski 58b28d2d75 Merge branch 'feature/type/__sshd_config' into 'master'
__sshd config: New type

See merge request ungleich-public/cdist!958
2020-11-19 19:33:49 +01:00
ssrq 9d4f69250e __sshd config: New type 2020-11-19 19:33:47 +01:00
poljakowski 6c539d67af Merge branch 'fix/type/__hostname/fix-os-version-detection' into 'master'
__hostname: fix guessing of SuSE OS version

See merge request ungleich-public/cdist!953
2020-11-19 19:31:53 +01:00
Dennis Camera 87faffd875 [type/__localdef] Also check for aliases in state explorer 2020-11-14 11:45:31 +01:00
Dennis Camera eeb9871919 [type/__localedef] glibc: Also delete aliases when removing a locale 2020-11-14 11:45:31 +01:00
Dennis Camera 575bb62dc5 [type/__localedef] Externalise functions to separate files 2020-11-14 11:45:31 +01:00
Dennis Camera c1c60e3374 [type/__localedef] Blacklist OpenBSD and NetBSD 2020-11-14 11:45:31 +01:00
Dennis Camera dcef2c19f5 [type/__localedef] Add support for FreeBSD 2020-11-14 11:45:31 +01:00
Dennis Camera f44888f192 [type/__localedef] Only install dependencies in manifest. OS checking moved to gencode-remote 2020-11-14 11:45:31 +01:00
Dennis Camera cc29e54b85 [type/__localedef] Differentiate between OSes and better handling of normalized locale names 2020-11-14 11:45:31 +01:00
Dennis Camera 54e689f7c2 [type/__localedef] Add state explorer 2020-11-14 10:48:18 +01:00
Dennis Camera f75d477209 Deprecate __locale and replace with __localedef 2020-11-14 10:48:18 +01:00
poljakowski 105797ccb4 Merge branch 'feature/type/__hwclock' into 'master'
__hwclock: New type

See merge request ungleich-public/cdist!956
2020-11-13 06:35:58 +01:00
Dennis Camera ebf471e8d0 [type/__hwclock] Add new type 2020-11-13 02:32:45 +01:00
Dennis Camera c39eb1dbce [cdist.emulator] Fix setting of log level (tests OK) 2020-11-11 15:16:33 +01:00
Dennis Camera 0ee3fda94d Fix paths to cdist executable 2020-11-11 15:05:04 +01:00
Dennis Camera 21dd500c05 Make pycodestyle pipeline happy 2020-11-11 14:44:44 +01:00
Dennis Camera 87a0d91587 [type/__hostname] Fix OS version detection for SuSE
everything should be suse now…
2020-11-11 14:21:35 +01:00
Dennis Camera 702f3eba4f [type/__hostname] Remove opensuse-leap OS string
everything should be suse now…
2020-11-11 14:21:35 +01:00
Dennis Camera 3e48ef9e11 [type/__hostname] Lint
- Error if expected environment variables are unset
- Always wrap variable expansions in {}
2020-11-11 14:21:35 +01:00
poljakowski bf9d70bb8c Merge branch 'reorg' into 'master'
small reorganization

See merge request ungleich-public/cdist!942
2020-11-11 07:49:08 +01:00
matze a95eab77a5 __locale: add state explorer
.. so it doesn't execute code all the time.
2020-11-08 15:28:14 +01:00
poljakowski fe8920740f Merge branch 'feature/__package_apt/recommends' into 'master'
__package_apt: add --install-recommends parameter

See merge request ungleich-public/cdist!949
2020-11-08 13:26:39 +01:00
poljakowski 729fdb9c1a Merge branch 'type/__dpkg_architecture' into 'master'
New type __dpkg_architecture

See merge request ungleich-public/cdist!948
2020-11-08 13:24:58 +01:00
poljakowski 1b3e1acd22 Merge branch 'feature/type/__hostname/openwrt-support' into 'master'
__hostname: Add support for OpenWrt

See merge request ungleich-public/cdist!947
2020-11-08 13:23:36 +01:00
poljakowski 77397514ca Merge branch 'fix/type/__file/pre-exists' into 'master'
__file: Fix --state pre-exists (this time for real)

See merge request ungleich-public/cdist!946
2020-11-08 13:22:06 +01:00
matze 9fc6ee0948 __package_apt: add --install-recommends parameter
For a good reason, __package_apt doesn't install recommended packages as
default. But the option --install-recommends comes handy if you want to
install a package where you want to install all recommended packages
(and not to install all of them separately).

Also, the manpage now explains that the type won't install recommended
packages by default.
2020-11-08 13:19:46 +01:00
matze 91bcc2a293 __dpkg_architecture: make type nonparallel
I think it's not good that dpkg or apt is running in parallel.
2020-11-07 21:03:38 +01:00
matze 7777580d8f __dpkg_architecture: add copyright headers 2020-11-07 20:56:17 +01:00
matze b0f3bb3350 New type __dpkg_architecture
This type handles foreign architectures added to dpkg.
2020-11-07 18:24:27 +01:00
Dennis Camera 10abe514b8 [type/__hostname] Add support for OpenWrt 2020-11-07 12:20:16 +01:00
Darko Poljak 0f1df5ef68 Fix shellcheck source directives 2020-11-07 12:07:58 +01:00
poljakowski bd9b21394f Merge branch 'type/openwrt-uci' into 'master'
Add OpenWrt UCI types

See merge request ungleich-public/cdist!886
2020-11-07 11:59:56 +01:00
poljakowski 67f1475a20 Merge branch 'feature/type/__apt_norecommends/reuse-file' into 'master'
__apt_norecommends: Use 00InstallRecommends file as debian-installer does

See merge request ungleich-public/cdist!945
2020-11-06 08:26:36 +01:00
Dennis Camera df881c0f98 [type/__file] Fix --state pre-exists also for non-dry-runs 2020-11-04 08:34:17 +01:00
Darko Poljak 2be8c63458 pycodestyle fixes 2020-11-03 06:43:57 +01:00
Dennis Camera ade69729dd [type/__uci_section] Only generate UCI commands if state differs 2020-11-01 21:36:21 +01:00
Dennis Camera 9d40500570 [type/__uci_section] Apply all commands in a single batch 2020-11-01 21:36:21 +01:00
Dennis Camera 3e5f18d409 [type/__uci] Apply all commands in a single batch 2020-11-01 21:36:21 +01:00
Dennis Camera ec984f81b5 [type/__uci] Delete --transaction parameter 2020-11-01 21:36:21 +01:00
Dennis Camera dfe9e08c28 [type/__uci_commit] Delete type 2020-11-01 21:36:21 +01:00
Dennis Camera e264fb004f [type/__uci] Convert to immediate remote execution 2020-11-01 21:36:21 +01:00
Dennis Camera c1ae3ccb2f [type/__uci*] Remove public-facing transaction "interface" 2020-11-01 21:36:16 +01:00
Dennis Camera a6c37095f1 [type/__uci_section] Externalise functions to separate file 2020-11-01 21:35:24 +01:00
Dennis Camera 7b30119504 [type/__uci] Externalise functions to separate file 2020-11-01 21:35:24 +01:00
Dennis Camera 63d41a1053 [type/__uci_section] Improve --match support with existing named sections
Use section if named section exists without --match option (e.g. empty section).
2020-11-01 21:35:24 +01:00
Dennis Camera 4aebb1f127 [type/__uci*] Update man.rst regarding quoting requirements 2020-11-01 21:35:24 +01:00
Dennis Camera 8728817af6 [type/__uci] Unquote UCI reported values
Without unquoting values printed in single quotes by UCI would always lead to
the state explorer reporting "different".
2020-11-01 21:35:24 +01:00
Dennis Camera b99ca3cbdf [type/__uci_section] Split up --option and --list 2020-11-01 21:35:16 +01:00
Dennis Camera 49e867fab4 [type/__uci_section] Add more parameter checks 2020-11-01 15:49:17 +01:00
Dennis Camera 0840afce03 [type/__uci] Add --type parameter 2020-11-01 15:49:13 +01:00
Dennis Camera fe26c119b5 [type/__uci*] Update man pages 2020-11-01 13:34:31 +01:00
Dennis Camera c37253b852 [type/__uci_section] Check __object_id for syntax errors 2020-11-01 13:34:31 +01:00
Dennis Camera 3a6b085145 [type/__uci] Check __object_id for syntax errors 2020-11-01 13:34:31 +01:00
Dennis Camera f782a5a370 [type/__uci] Refactor to do proper quoting of UCI commands 2020-11-01 13:34:31 +01:00
Dennis Camera d453d964e1 [type/__uci_section] Fix in section matching 2020-11-01 13:34:31 +01:00
Dennis Camera 179815b5e9 [type/__uci_section] Ignore SC2015 error (notabug) 2020-11-01 13:34:31 +01:00
Dennis Camera 4da3968118 [type/__uci_section] Add type 2020-11-01 13:34:31 +01:00
Dennis Camera 3ef638a611 [type/__uci_commit] Fail when uci(1) reports errors 2020-11-01 13:34:31 +01:00
Dennis Camera cc599dab15 [type/__uci_commit] Move uncommited changes check from explorer to code-remote
This is done to prevent false positives/negatives (see NOTE in code)
2020-11-01 13:34:22 +01:00
Dennis Camera e7369a1f99 [type/__uci_commit] Abort if uncommited changes are present on the target 2020-11-01 13:32:00 +01:00
Dennis Camera 3a3be36310 [type/__uci_commit] Send message on commit of a transaction 2020-11-01 11:01:25 +01:00
Dennis Camera d3574b2d3e [type/__uci] Send messages when options are set to be altered 2020-11-01 11:01:25 +01:00
Dennis Camera d8f20a6a20 [type/__uci] Implement "real" transactions using batch files 2020-11-01 11:01:25 +01:00
Dennis Camera a09120977f [type/__uci] Allow omission of --value parameter if --state absent 2020-11-01 11:01:25 +01:00
Dennis Camera 55e7b32449 [type/__uci] Only generate __uci_commit if changes are required 2020-11-01 11:01:25 +01:00
Dennis Camera e30ecdda53 Add __uci and __uci_commit types 2020-11-01 11:01:25 +01:00
Nico Schottelius 09dfcfe81e [scanner] add to beta commands 2020-10-29 23:16:08 +01:00
Nico Schottelius 87b46a6224 [scanner] finish prototype
ping @poljakowski - it's your turn now
2020-10-29 18:49:20 +01:00
Nico Schottelius b9ad22595f [scanner] begin scanner implementation - non invasive 2020-10-29 18:03:27 +01:00
Dennis Camera 82a9aa7902 [type/__apt_norecommends] Use 00InstallRecommends file as debian-installer does
debian-installer can be preseeded with `base-installer/install-recommends` to
disable installation of recommended packages already during OS installation.
d-i will then create the file `/etc/apt/apt.conf.d/00InstallRecommends`
(cf. https://salsa.debian.org/installer-team/base-installer/-/blob/master/library.sh).

__apt_norecommends should use the same file to avoid having two config files
effectively doing the same thing.
2020-10-29 10:45:18 +01:00
poljakowski eda96a06a0 Merge branch 'fix/type/__file/pre-exists-dryrun' into 'master'
__file: Fix --state pre-exists

See merge request ungleich-public/cdist!944
2020-10-29 09:29:41 +01:00
Dennis Camera 367da4b77e [type/__file] Fix --state pre-exists 2020-10-28 18:18:24 +01:00
ander aa5e882fce Merge branch 'master' into reorg 2020-10-21 20:26:51 +03:00
poljakowski b139ba2a5c Merge branch '__update_alternatives_improvements' into 'master'
[__update_alternatives] rewrite and support --install

See merge request ungleich-public/cdist!936
2020-10-19 06:55:35 +02:00
poljakowski f96f23e970 Merge branch '__acl_remove_deprecated' into 'master'
[__acl] remove deprecated parameters, fix some bugs and improve manual

Closes #823

See merge request ungleich-public/cdist!933
2020-10-19 06:54:13 +02:00
ander 716cd37281 [__update_alternatives] rewrite and support --install 2020-10-18 23:57:25 +03:00
ander e3d906a85f [__acl] remove deprecated parameters, fix some bugs and improve manual 2020-10-18 23:54:01 +03:00
matze b2e6afb57e __download: adapt download+unpack example in manpage 2020-10-17 23:01:36 +02:00
matze 507fa6fa93 __download: fix non-existent parameter of __unpack
Probably happened due to renaming .. guess it's correct now.
2020-10-17 17:09:41 +02:00
ander e55db1b427 use check_output for git describe execution and define fallback VERSION earlier 2020-10-16 15:41:38 +03:00
ander 42d5d6c3e2 redundant str() 2020-10-16 14:12:39 +03:00
ander 65c8af4ba3 overengineered version discovery 2020-10-16 14:11:12 +03:00
ander 1614b62f70 fallback VERSION to "unknown version" 2020-10-16 13:48:28 +03:00
ander 86057cef19 don't die if there is no version.py 2020-10-14 02:20:58 +03:00
poljakowski 1057ceef01 Merge branch 'line-replace' into 'master'
[__line] Add support for '--state replace'

See merge request ungleich-public/cdist!939
2020-10-09 06:51:45 +02:00
evilham c030deea3d [__line] Add support for '--state replace'
It is currently counter-intuitive that something like:

    # File '/thing' contents
    #SomeSetting WrongValue

    # Manifest
    __line '/thing' \
           --line 'SomeSeting GoodValue' \
           --regex '^(#[[:space:]]*)?SomeSetting[[:space:]]'

Produces:

    # Resulting '/thing' contents
    #SomeSetting WrongValue

This makes sense given the implementation, but it masks a very common use-case.

Changing the default behaviour for such a base type is not really an option, so
instead we add a `replace` as a valid value for `--state`, which would result
in:

    # Resulting '/thing' contents with: --state replace
    SomeSetting GoodValue

For compatibility, if the regex is missing, `--state replace` behaves just as
`--state present`.
2020-10-09 06:51:44 +02:00
Mark Verboom 5aeed14b1b Fixed calling of __systemd_service type with correct arguments. 2020-10-08 16:15:20 +02:00
Darko Poljak 3fa74b454a Fix typo 2020-09-30 15:43:32 +02:00
evilham f994226d0e [__package_pkgng_freebsd] Bootstrap pkg if necessary
In a pristine FreeBSD base installation, pkg is really a bootstrapper utility,
in such cases the type used to fail instead of automatically bootstrapping pkg.
2020-09-29 19:47:59 +02:00
Darko Poljak 0fc10749ed Fix shellcheck 2020-09-21 09:11:35 +02:00
poljakowski 139a782c96 Merge branch '__package_pip_detect_pip_bin' into 'master'
[__package_pip] detect pip binary

See merge request ungleich-public/cdist!935
2020-09-21 09:06:44 +02:00
poljakowski 89b6215115 Clarify stdin input
Resolve #836.
2020-09-21 09:04:05 +02:00
ander decc0ad54d [__package_pip] detect pip binary 2020-09-19 12:38:20 +03:00
Darko Poljak 53b91adbd8 Fix shellcheck 2020-09-11 14:20:57 +02:00
poljakowski a20ab63e60 Merge branch 'fix/__systemd_service/manpage' into 'master'
__systemd_service: fix manpage typos

See merge request ungleich-public/cdist!931
2020-09-10 13:21:19 +02:00
matze b1375464cc __systemd_service: fix manpage typos 2020-09-09 21:11:40 +02:00
poljakowski f5b534df71 Merge branch 'fix/type/__timezone/singleton' into 'master'
__timezone: Make singleton

See merge request ungleich-public/cdist!916
2020-09-08 07:20:01 +02:00
Darko Poljak c17541f24c Expand and split by consecutive require delimiters
Resolves #832.
2020-08-24 07:16:28 +02:00
poljakowski a8ea56253c Merge branch 'feature/explorer/os_version/debian-sid' into 'master'
explorer/os_version: Convert Debian sid to version number.

Closes #833

See merge request ungleich-public/cdist!927
2020-08-18 11:05:12 +02:00
poljakowski 2c1eca9ee7 Merge branch '__download_man_fix' into 'master'
[__download] fix manual: onchange parameter in wrong section

See merge request ungleich-public/cdist!929
2020-08-18 11:02:18 +02:00
ander d239169c4f [__download] fix manual: onchange parameter in wrong section 2020-08-18 00:48:58 +03:00
ander 502d753047 [__unpack] add --onchange 2020-08-18 00:46:07 +03:00
Dennis Camera 6fed178529 [explorer/os_version] Convert Debian sid to version number.
Conversion of Debian sid to versions is done based on Debian codenames.
The version number is the version number of the final release - 0.01.

It is unknown if Debian < 4.0 has any sort of version information
available (apart from maybe checking base-files package version).
But I don't think any of these systems are still alive,
so I think going with 3.99 is fine for those.
2020-08-17 09:31:40 +02:00
ssrq fa967631e3 Merge branch 'master' into 'fix/type/__locale_system/version-cmp'
# Conflicts:
#   cdist/conf/type/__locale_system/manifest
2020-08-15 21:17:25 +02:00
poljakowski 7b0a4f6831 Merge branch 'feature/alpine-filesystem' into 'master'
Add Alpine Linux as supported for __filesystem.

See merge request ungleich-public/cdist!925
2020-08-15 21:09:37 +02:00
poljakowski 54c525e36c Merge branch '__unpack_tar_extra_args' into 'master'
[__unpack] add parameter --tar-extra-args

See merge request ungleich-public/cdist!922
2020-08-15 21:07:20 +02:00
poljakowski 4082359a2f Merge branch 'fix/explorer/os/opensuse' into 'master'
explorer/os: Fix OS detection for openSUSE

See merge request ungleich-public/cdist!924
2020-08-15 21:06:31 +02:00
sparrowhawk 17ab4bd80c
Add Alpine Linux as supported for __filesystem. 2020-08-06 11:45:05 +02:00
Dennis Camera b370b70ff4 [explorer/os] Fix OS detection for openSUSE
All distros with ID_LIKE suse should be treated as "suse".
My openSUSE Leap 15.1 installation has:
ID_LIKE="suse opensuse"

This patch doesn't require a strict "suse" value but only the word suse to be in
the list.
2020-08-02 22:50:06 +02:00
Dennis Camera 7b480f4293 [type/__locale_system] Fix version extraction for SuSE 2020-08-02 22:47:46 +02:00
Dennis Camera 71710fa00a [type/__locale_system] Implement "proper" version comparison
Proper in the sense that it can handle all numeric version numbers even if they
are not floating point (e.g. 16.04.6).
2020-08-02 20:59:22 +02:00
Dennis Camera 885d5a58f4 [type/__locale_system] Fix floating point version comparison 2020-08-02 17:04:06 +02:00
ander 935f2395bc [__locale_system] fix for debian and ubuntu
ubuntu 6.10 and debian etch are 10+ years old and EOL. rather than
preserving compatibility I'll just remove it. while /etc/environment
works too, correct place is /etc/default/locale (as it was before
breaking change). also /etc/debian_version (os_version explorer) may
contain minor version with dot (10.5) or string (bullseye/sid).
2020-08-02 13:54:30 +03:00
ander d37d2dc307 [__unpack] add parameter --tar-extra-args 2020-08-02 13:53:38 +03:00
Darko Poljak c053a2c4a0 Fix building man pages
Resolves #830.
2020-07-29 11:31:12 +02:00
poljakowski a5f25faf25 Merge branch 'fix/type/__sysctl/netbsd-path' into 'master'
__sysctl: Fix on NetBSD

See merge request ungleich-public/cdist!918
2020-07-27 15:30:57 +02:00
poljakowski a6cd767c8f Merge branch 'fix/explorer/netbsd' into 'master'
Fix global explorers for NetBSD

See merge request ungleich-public/cdist!917
2020-07-27 15:29:52 +02:00
Dennis Camera 3a87a447d0 [type/__sysctl] Fix on NetBSD 2020-07-27 15:22:21 +02:00
Dennis Camera 5dfc996feb Fix global explorers for NetBSD
On NetBSD sysctl is at /sbin/sysctl, but the default PATH does not
contain /sbin.
2020-07-27 15:11:02 +02:00
poljakowski 5c5890d458 Merge branch 'feature/type/__locale_system/os-support' into 'master'
__locale_system: Wider OS support

See merge request ungleich-public/cdist!914
2020-07-27 12:58:53 +02:00
Dennis Camera d26c36914a [__timezone] Make type singleton 2020-07-27 11:06:14 +02:00
poljakowski 8a8a48313c Merge branch '__unpack' into 'master'
new type: __unpack

See merge request ungleich-public/cdist!893
2020-07-27 06:20:21 +02:00
ander 73f1937636 [__unpack] no mkdir by default, because destination can be file, but tar needs mkdir andrar needs slash at the end 2020-07-27 06:20:21 +02:00
poljakowski 1b18b9487e Merge branch 'fix/type/__key_value/solaris-awk' into 'master'
__key_value: Get AWK from POSIX PATH

See merge request ungleich-public/cdist!913
2020-07-27 06:01:53 +02:00
poljakowski 263c7a90a8 Merge branch 'fix/type/__package_apt/legacy-norecommends' into 'master'
__package_apt: Fix for legacy APT versions that do not support --no-install-recommends.

See merge request ungleich-public/cdist!912
2020-07-27 05:58:40 +02:00
Dennis Camera 70d1228dc0 [type/__locale_system] Add support for FreeBSD 2020-07-26 20:10:52 +02:00
Dennis Camera 511d8c96aa [type/__locale_system] Add support for Slackware 2020-07-26 20:10:52 +02:00
Dennis Camera a923e75d9b [type/__locale_system] Add support for NetBSD 2020-07-26 20:10:52 +02:00
Dennis Camera cbf22f3b2c [type/__locale_system] Add support for Solaris 2020-07-26 20:10:52 +02:00
Dennis Camera 0ae0935afa [type/__locale_system] Add support for SuSE 2020-07-26 20:10:34 +02:00
Dennis Camera 630d987d5f [type/__locale_system] Add support for Void Linux 2020-07-26 20:10:34 +02:00
Dennis Camera 0ef54a721d [type/__locale_system] Add support for Gentoo Linux 2020-07-26 20:10:34 +02:00
Dennis Camera 47e28fc441 [type/__locale_system] Support old Debian derivatives 2020-07-26 20:10:34 +02:00
Dennis Camera a590504436 [type/__locale_system] RedHat systems on systemd use /etc/locale.conf 2020-07-26 20:10:34 +02:00
Dennis Camera 46d09392f0 [type/__key_value] Get AWK from POSIX PATH
This is required here, because Solaris /usr/bin/awk does not support the
sub() function.
So xpg4 AWK needs to be used.
2020-07-26 19:36:34 +02:00
Dennis Camera ee71cad047 [type/__package_apt] Fix type for legacy APT versions
--no-install-recommends was introduced with Debian 5.
The APT::Install-Recommends option gets ignored by old versions and
produces no error.
2020-07-25 19:20:32 +02:00
poljakowski 9df29de564 Merge branch 'rm-deprecated-__pf_apply' into 'master'
Remove deprecated __pf_apply

See merge request ungleich-public/cdist!899
2020-07-24 12:30:32 +02:00
fnux ae5f0bba0b Add Alpine support to __openldap_server 2020-07-24 12:26:35 +02:00
poljakowski 5d0f6caef7 Merge branch 'hotfix/stat-explorer' into 'master'
Hotfix:  Fix incorrect interpretation of --mode strings with leading 0s as octal

See merge request ungleich-public/cdist!911
2020-07-23 10:59:18 +02:00
Dennis Camera 595e43b8d5 [type/{__file,__directory}] Fix incorrect interpretation of strings with leading 0s as octal 2020-07-23 09:43:40 +02:00
Dennis Camera 3965c7f738 [type/__user] Install user{add,mod,del} packages on OpenWrt 2020-07-21 19:42:40 +02:00
poljakowski bc97073131 Merge branch 'bugfix/postfix-master-option' into '6.6'
Fix broken --option parameter in __postfix_master type

See merge request ungleich-public/cdist!905

(cherry picked from commit 2f433a1458f3a1f7f8859e9ae165178a0ec5b7a0)

9496b234 The option parameter is actually multi-valued
4009bbd7 Protect postfix variables in options
2020-07-13 07:49:49 +02:00
poljakowski 652ffea4a8 Merge branch 'fix/stat-explorer' into 'master'
type/{__file/__directory}: Support setuid,setguid,sticky bits

See merge request ungleich-public/cdist!903
2020-07-13 07:37:50 +02:00
Dennis Camera 9fb7e151b8 [type/{__file/__directory}] Remove special Solaris blocks
Solaris 11 has GNU stat (handled by *)
Solaris 10 (and older?) does not have stat (handled by failing command -v stat)

On Solaris 10 (at least on UFS), setgid cannot be set on directories.
Unlike on other systems `chmod 2400` is not `-r----S---`, but `-r----l---`.
2020-07-12 12:41:02 +02:00
Dennis Camera 19514662b0 [type/{__file/__directory}] Fix typo 2020-07-12 12:24:00 +02:00
Dennis Camera a5ae26116b [type/__hosts] Fix when used without --alias 2020-07-11 18:57:47 +02:00
poljakowski 506a0f3f47 Merge branch 'bugfix/make-code-consistent' into 'master'
Make code consistent

See merge request ungleich-public/cdist!904
2020-07-10 21:01:42 +02:00
Darko Poljak cb9933b4a0 Fix state -> state_is 2020-07-08 12:43:55 +02:00
poljakowski fde5627721 Merge branch '__download_improvements' into 'master'
__download improvements

See merge request ungleich-public/cdist!895
2020-07-08 12:33:41 +02:00
ander e906266286 [__download] s/variable/format specification/ 2020-07-08 00:20:55 +03:00
ander 93506d2113 [__download] curl follow redirects 2020-07-08 00:17:12 +03:00
Darko Poljak fe193ecab8 Make code consistent
* Remove supreflous checking and warning message.
* Fix cache recording.
2020-07-01 14:08:48 +02:00
poljakowski 727f3dbb03 Merge branch 'fix/type/__user/openbsd-shadow' into 'master'
__user: Fix shadow explorer for OpenBSD

See merge request ungleich-public/cdist!902
2020-06-30 22:55:33 +02:00
poljakowski c5a8004c9a Merge branch 'hosts-aliases' into 'master'
__hosts: add --alias parameter

See merge request ungleich-public/cdist!901
2020-06-30 22:52:52 +02:00
Dennis Camera 3860f1feea [type/{__file/__directory}] Support setuid,setguid,sticky bits 2020-06-30 15:10:30 +02:00