Commit graph

2101 commits

Author SHA1 Message Date
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
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
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
89b6215115 Clarify stdin input
Resolve #836.
2020-09-21 09:04:05 +02:00
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
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
b1375464cc __systemd_service: fix manpage typos 2020-09-09 21:11:40 +02:00
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
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
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
d239169c4f [__download] fix manual: onchange parameter in wrong section 2020-08-18 00:48:58 +03:00
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
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
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
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
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
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
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
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
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
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
8a8a48313c Merge branch '__unpack' into 'master'
new type: __unpack

See merge request ungleich-public/cdist!893
2020-07-27 06:20:21 +02:00
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
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
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
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
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
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
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
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
fde5627721 Merge branch '__download_improvements' into 'master'
__download improvements

See merge request ungleich-public/cdist!895
2020-07-08 12:33:41 +02:00
e906266286 [__download] s/variable/format specification/ 2020-07-08 00:20:55 +03:00
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
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
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
Dennis Camera
6467ccbdcc [type/__user] Make shellcheck happy 2020-06-30 14:31:11 +02:00
ssrq
9e33a8f42f Merge branch 'master' into 'fix/type/__user/openbsd-shadow'
# Conflicts:
#   cdist/conf/type/__user/explorer/shadow
2020-06-30 14:26:23 +02:00
Dennis Camera
999e7b0134 [type/__user] Fix shadow explorer for OpenBSD 2020-06-30 14:23:34 +02:00
Dennis Camera
a263fdfe58 [__hosts] Add --alias parameter
The --alias parameter allows to specify a hostname and multiple aliases on a
single /etc/hosts line.
2020-06-30 14:05:26 +02:00
99b5dcd8f0 Merge branch 'master' into __download_improvements 2020-06-28 16:57:13 +03:00
996e7fc09c Merge branch 'master' into __download_improvements 2020-06-28 16:55:11 +03:00
b6bf90e3f1 [__download] update manual 2020-06-28 16:43:45 +03:00
85614aabd6 [__download] add --download (local|remote), update manual 2020-06-28 16:38:15 +03:00
Darko Poljak
077989e8fd Remove annoying warnings
Those warnings don't have any specail meaning and usage.
Resolve #825.
2020-06-27 15:55:57 +02:00
684043bf37 Merge branch 'fix/type/__package_opkg/lock' into 'master'
__package_opkg: Add locking

See merge request ungleich-public/cdist!896
2020-06-25 06:31:16 +02:00
ceedcd02f2 Merge branch 'feature/type/__locale_system/support-devuan' into 'master'
__locale_system: "Whitelist" Devuan

See merge request ungleich-public/cdist!900
2020-06-25 06:24:17 +02:00
Dennis Camera
5364d3bc90 [type/__package_opkg] Implement flock locking if available 2020-06-24 21:06:10 +02:00
Dennis Camera
a9778965be [type/__package_opkg] Use mkdir(1) to lock instead of noclobber
noclobber is potentially unsafe, because it relies on the underlying shell to
implement noclobber in a safe way that avoids race conditions between multiple
processes.
mkdir is safer because it is mandated by POSIX to "fail" if the target already
exists.
2020-06-24 08:47:22 +02:00
Darko Poljak
49dde11def Remove deprecated __pf_apply 2020-06-24 07:04:32 +02:00
Dennis Camera
3649555f35 [type/__package_opkg] Do not lock execution of code-remote (revert)
Instead, rely on `nonparallel`.
In any case cdist should never run explorer and code concurrently even if the
dependency graph would allow to do so as it would result in many more
synchronization issues than this one.
2020-06-22 09:32:57 +02:00
26dfdf37c2 [__download] support multiple checksum formats and download utilities, add --onchange and other minor changes 2020-06-21 23:39:53 +03:00
d478bef8a6 Merge branch 'lint/py3-classes' into 'master'
Consequently use Python 3-style classes

See merge request ungleich-public/cdist!898
2020-06-21 17:54:56 +02:00
e67215f93d Merge branch 'lint/no-python-shebangs' into 'master'
Remove unnecessary Python shebangs

See merge request ungleich-public/cdist!897
2020-06-21 17:53:44 +02:00
Dennis Camera
6aae58dea7 [type/__package_opkg] Mark lock variables readonly 2020-06-21 17:35:28 +02:00
Dennis Camera
ce07021580 Do not subclass object 2020-06-21 16:53:47 +02:00
Dennis Camera
a6a3fb40bf Remove unnecessary Python shebangs 2020-06-21 16:03:09 +02:00
Dennis Camera
e79b26a61f [type/__package_opkg] Also lock execution of code-remote 2020-06-21 15:53:01 +02:00
Dennis Camera
97e48be39e [type/__package_opkg] Fix explorer running in parallel 2020-06-21 15:52:57 +02:00
d59ba09d71 Merge branch '__download' into 'master'
new type: __download

See merge request ungleich-public/cdist!892
2020-06-17 13:39:07 +02:00
201050a9e5 new type: __download 2020-06-16 20:53:31 +03:00
Darko Poljak
59b98091d7 Adapt; update docs and code style 2020-06-13 13:44:01 +02:00
Steven Armstrong
57e352cd1e log server is also usefull for cdist config
Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
2020-06-13 13:44:01 +02:00
Steven Armstrong
831bfc822b remove unused code
Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
2020-06-13 13:44:01 +02:00
Steven Armstrong
6e9e9ad557 implement log server to capture nested logging output
Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
2020-06-13 13:44:01 +02:00
Darko Poljak
4167f9f60c Use proper format string with name 2020-06-11 14:22:54 +02:00