Commit Graph

2331 Commits

Author SHA1 Message Date
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
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
ander 99b5dcd8f0 Merge branch 'master' into __download_improvements 2020-06-28 16:57:13 +03:00
ander 996e7fc09c Merge branch 'master' into __download_improvements 2020-06-28 16:55:11 +03:00
ander b6bf90e3f1 [__download] update manual 2020-06-28 16:43:45 +03:00
ander 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
poljakowski 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
poljakowski 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
ander 26dfdf37c2 [__download] support multiple checksum formats and download utilities, add --onchange and other minor changes 2020-06-21 23:39:53 +03:00
poljakowski 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
poljakowski 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
poljakowski d59ba09d71 Merge branch '__download' into 'master'
new type: __download

See merge request ungleich-public/cdist!892
2020-06-17 13:39:07 +02:00
ander 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
Darko Poljak 840e417eb7 Fix emulator colored logging 2020-06-11 14:16:37 +02:00
ander 7c490a703d [__clean_path] add --path parameter 2020-06-10 11:38:14 +03:00
Darko Poljak a251e53495 Merge branch 'fix_os_explorer_sles15' of https://github.com/dheule/cdist into dheule-fix_os_explorer_sles15 2020-06-08 13:43:41 +02:00
Dennis Camera 23e66e08fa Restrict colored_output value to always/never/auto. 2020-06-06 13:45:31 +02:00
Dennis Camera 89e48734bf Let config file and command line override NO_COLOR envvar 2020-06-05 12:23:36 +02:00
Dennis Camera cdb0d2be41 Patch tests 2020-06-03 23:21:50 +02:00
Dennis Camera 747c6b1076 Respect NO_COLOR environment variable 2020-06-03 22:17:52 +02:00
Daniel Heule 6a611e556a fix os explorer for sles15 2020-06-02 13:40:21 +02:00
Darko Poljak 55ebd1a4c5 Fix man build failure in newer sphinx versions 2020-06-01 20:22:40 +02:00
evilham ba77ea9edc [UX] Add option to enable LogLevel-based coloured output.
This makes it easier for new and experienced users to run cdist with higher
verbosity levels, both to know that things are working as expected and to debug
issues.

Documentation has been modified accordingly and default behaviour is not
changed.
2020-06-01 19:11:58 +02:00
Darko Poljak 988190363a Resolve shellcheck SC1090 2020-05-30 15:10:13 +02:00
ander 29c0180204 [__ssh_authorized_keys] add --remove-unknown parameter 2020-05-28 23:31:13 +03:00
Darko Poljak f4e1bbc87e Fix multiple log lines
Fixes #813.
2020-05-24 01:10:56 +02:00
ander 716d3554f3 [__user] fix user delete on freebsd 2020-05-23 00:48:35 +03:00
poljakowski dab32b0cb6 Merge branch '__group_freebsd_fix' into 'master'
[__group] fix --gid on freebsd

See merge request ungleich-public/cdist!881
2020-05-22 10:08:29 +02:00
ander 3bcbd95269 [__motd] debian|ubuntu|devuan use /etc/motd 2020-05-22 02:36:49 +03:00
ander bf25a18a04 [__group] fix --gid on freebsd 2020-05-22 02:31:38 +03:00
evilham ad58ea79c2 [__ssh_authorized_keys] Fix bug where --option was not multiple
This went against both documentation and intent.
2020-05-18 20:01:01 +02:00
poljakowski 8d639d54d0 Merge branch 'evilham-authorized_keys-man' into 'master'
[__ssh_authorizedkey{,s}] Improve documentation.

See merge request ungleich-public/cdist!877
2020-05-18 19:49:50 +02:00
poljakowski 2362d89976 Merge branch 'evilham-machine_type-explorer-simplify-linux-add-openbsd' into 'master'
[explorer/machine_type] simplify linux add openbsd

See merge request ungleich-public/cdist!876
2020-05-18 19:48:47 +02:00
poljakowski c5454afc72 Merge branch 'evilham-machine_type-explorer-freebsd' into 'master'
[explorer/machine_type] Add support for FreeBSD.

See merge request ungleich-public/cdist!875
2020-05-18 19:46:47 +02:00
evilham 6d502f737a [__ssh_authorizedkey{,s}] Improve documentation. 2020-05-18 18:37:16 +02:00
evilham 8b790b0a54 [explorer/machine_type] Make shellcheck happy! 2020-05-18 16:47:20 +02:00
evilham cf44c4a01b [explorer/machine_type] Simplify Linux + basic OpenBSD support.
By abstracting away vendor-dependent pattern matching for the linux code, we can
re-use that and be reasonably sure about OpenBSD machines being virtualised when
we can identify the undelrying virtualisation technology.
It remains to be solved how to tell if an OpenBSD machine is physical; in that
case previous cdist behaviour ("unknown") remains.

For NetBSD something similar to OpenBSD could be done, with different sysctls:
hw.machine and hw.model wary of adding those without testing though, so for
NetBSD previous cdist behaviour ("unknown") remains.
https://netbsd.gw.com/cgi-bin/man-cgi?sysctl+7.i386+NetBSD-9.0
2020-05-18 16:35:50 +02:00
evilham 7ca2bfc14a [explorer/machine_type] Add support for FreeBSD.
More research is needed for {Net,Open}BSD support.

Indentation is left as-is for the linux code as I intend to simplify it in a
future MR, this way the diff is minimal.
2020-05-18 16:00:23 +02:00
matze 086e683c99 [__file] add "default values" in manual for group, mode and owner
Because at least the --mode default value may not be expected, the
manual lists the "default values". As they are not explicitly set in the
`__file` type, it is a bit more difficult, but should resolve to
following:
  - the mode comes from the umask set in the cdist code to protect file
    creation and uses the strongest umask possible.
  - the owner and group comes from the ssh user, which should always be
    the root user. (I think this can be swaped, too, but who will?)

At the owner and group parameter, it could be replaced with something
like "the ssh user and group", which would be more correct, but less
understandable.
2020-05-16 16:33:38 +02:00
matze dcfabf9268 [__cron] add hint for default values of time-related parameters
This should resolve some misunderstanding when leave a time-related
parameter with it's default value.
2020-05-16 14:00:02 +02:00
matze 42f2dceeb1 [__link] fix typo in the manual 2020-05-09 18:40:44 +02:00
Nico Schottelius d4059fd29e [__letsencrypt_cert] whitelist Ubuntu 2020-05-01 15:31:23 +02:00
Nico Schottelius f58d662b32 [__pyvenv] Switch to python3 -m venv for ubuntu 2020-05-01 15:28:01 +02:00
evilham ea3bd14d8b [logging] Mute warning on return_output=True when running scripts.
This fixes #806 which contains more information about the issue.

The TL;DR: this warning is not being useful and hinders debugging types because
it creates an innecessary line for each explorer.

An alternative proposal was #807 but was abandoned in favour of just dropping
the warning.
2020-04-28 14:54:51 +02:00
evilham 678df1ec8a [explorers] Improve *BSD support.
cpu_cores and memory did lacked support for other BSDs.
2020-04-27 01:29:37 +02:00
poljakowski 8074f02bb3 Merge branch 'evilham-pf' into 'master'
[__pf*] (~) __pf_ruleset (+)__pf_apply_anchor, deprecate __pf_apply

See merge request ungleich-public/cdist!867
2020-04-26 09:59:24 +02:00
poljakowski 71156258a4 Merge branch 'evilham-postfix' into 'master'
[__postfix] Automagically support more OSs by not checking too much.

See merge request ungleich-public/cdist!866
2020-04-26 09:52:08 +02:00
poljakowski c13608fab5 Merge branch 'evilham-openldap_server' into 'master'
[__openldap_server] Support extra config parameter.

See merge request ungleich-public/cdist!865
2020-04-26 09:50:21 +02:00
poljakowski b40b95d758 Merge branch 'evilham-motd' into 'master'
[__motd] Improve documentation and support for FreeBSD

See merge request ungleich-public/cdist!864
2020-04-26 09:47:54 +02:00
poljakowski 6ec3274598 Merge branch 'postgres-database-args' into 'master'
Add --template, --encoding, --lc-collate, --lc-support to __postgres_database type

See merge request ungleich-public/cdist!859
2020-04-26 09:41:30 +02:00
poljakowski 80d204368a Merge branch 'fix-configuration-file-location' into 'master'
Fix configuration file location

See merge request ungleich-public/cdist!863
2020-04-26 09:33:38 +02:00
evilham 2928795441 [__pf_ruleset] Fix shellcheck issue. 2020-04-25 14:54:29 +02:00
evilham fefe90e9c9 [__pf*] (~) __pf_ruleset (+)__pf_apply_anchor, deprecate __pf_apply
__pf_apply the way it exists on cdist is not really useful and __pf_ruleset does
not take advantage of other types as it should, being instead overly complex and
not as reliable.

The new __pf_ruleset is compatible with the previous one, and __pf_apply_anchors
allows for a simple and powerful way of managing pf anchors.
The functionality previously provided by __pf_apply is still possible out of the
box in __pf_ruleset.

These patches were mostly contributed by Kamila Součková and made fit for
upstreaming by Evilham.
2020-04-25 12:23:27 +02:00
evilham 5981d0a5f1 [__postfix] Automagically support more OSs by not checking too much.
It is quite likely that the package is going to be called postfix, rather
than trying to have an exhaustive "allow list" for this package, we can
just add special cases for OSs where that is not the case (not aware of any
atm).
2020-04-25 00:22:28 +02:00
evilham 056c7c5400 [__openldap_server] Support extra config parameter.
This allows the user to, e.g. manually define ACLs, while this type does not
support that.
2020-04-25 00:12:24 +02:00
evilham de37b0ce45 [__motd] Improve documentation and support for FreeBSD
This makes it easier to use the type just by reading the man page and also
treats FreeBSD's MOTD better.
2020-04-24 20:26:44 +02:00
Darko Poljak 38ccdfda32 Fix newly found shellcheck issues 2020-04-22 23:21:34 +02:00
sparrowhawk 742163e38c Fix configuration file location 2020-04-15 17:10:33 +02:00
fnux c3f924d350 Add --template flag to __postgres_database type 2020-04-14 10:23:08 +02:00
Darko Poljak 704e78322e Use OrderedDict to guarantee order
Note:
> Changed in version 3.7: Dictionary order is guaranteed to be
> insertion order. This behavior was an implementation detail of
> CPython from 3.6.
2020-04-11 20:26:20 +02:00
Steven Armstrong e19c1bb1e0 remove duplicates from conf dirs while preserving order
Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
2020-04-10 21:50:39 +02:00
Steven Armstrong 76d978d3d8 explorer/init: do not grep on non-existent init
Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
2020-04-10 10:51:17 +02:00
fnux d53077f4e8 Add --encoding, --lc-collate, --lc-support to __postgres_database type 2020-04-06 09:30:01 +02:00
Darko Poljak 890c73f6bd Fix shellcheck issues 2020-04-02 20:18:04 +02:00
Nico Schottelius d034fe9369 [__pyvenv] use python3 -m venv on alpine
Until python4 comes, this will work
2020-04-02 18:24:13 +02:00
Nico Schottelius 0f639a9278 Make __cron nonparallel
It fails due to removal / edit of crontab at the same time

VERBOSE: [18331]: uncloud.ungleich.ch: Running object __cron/pg_dump_cleanup
VERBOSE: [18332]: uncloud.ungleich.ch: Running object __ungleich_packages/server
VERBOSE: [18335]: uncloud.ungleich.ch: Running object __postgres_role/app
INFO: [18335]: uncloud.ungleich.ch: Processing __postgres_role/app
INFO: [18331]: uncloud.ungleich.ch: Processing __cron/pg_dump_cleanup
ERROR: [16451]: uncloud.ungleich.ch: ssh -o User=root -o ControlPath=/tmp/tmp_8eu4oep/s -o ControlMaster=auto -o ControlPersist=2h uncloud.ungleich.ch /bin/sh -c ' export __object=/var/lib/cdist/object/__cron/pg_dumpall_under_day/.cdist-mfd00npk;  export __object_id=pg_dumpall_under_day;/bin/sh -e /var/lib/cdist/object/__cron/pg_dumpall_under_day/.cdist-mfd00npk/code-remote': ['ssh', '-o', 'User=root', '-o', 'ControlPath=/tmp/tmp_8eu4oep/s', '-o', 'ControlMaster=auto', '-o', 'ControlPersist=2h', 'uncloud.ungleich.ch', "/bin/sh -c ' export __object=/var/lib/cdist/object/__cron/pg_dumpall_under_day/.cdist-mfd00npk;  export __object_id=pg_dumpall_under_day;/bin/sh -e /var/lib/cdist/object/__cron/pg_dumpall_under_day/.cdist-mfd00npk/code-remote'"]

Error processing object '__cron/pg_dumpall_under_day'
=====================================================
name: __cron/pg_dumpall_under_day
path: /tmp/tmplaq9cwdh/6318c251013a449595327745daacf3ee/data/object/__cron/pg_dumpall_under_day/.cdist-mfd00npk
source: /tmp/tmplaq9cwdh/6318c251013a449595327745daacf3ee/data/conf/type/__ungleich_postgresql/manifest
type: /home/nico/vcs/cdist/cdist/conf/type/__cron

code-remote:stderr
------------------
crontab: can't move 'postgres.new' to 'postgres': No such file or directory

VERBOSE: [16451]: config: Total processing time for 1 host(s): 13.98031210899353
[18:09] line:~%
2020-04-02 18:14:09 +02:00
poljakowski 1eb02f908b Merge branch 'fix/__package_update_index' into 'master'
[__package_update_index] Fix maxage false-positives on brand-new installations

See merge request ungleich-public/cdist!858
2020-03-29 13:53:55 +02:00
Darko Poljak b25939cdd6 Fix shellcheck 2020-03-27 13:30:52 +01:00
poljakowski 11148995d1 Merge branch 'master' into 'master'
fix typo

See merge request ungleich-public/cdist!857
2020-03-27 08:50:29 +01:00
Nico Schottelius 66d9905029 [__consul_agent] make conf_dir depent on the OS 2020-03-26 21:48:17 +01:00
andrewschleifer f00e4af5f0 fix typo 2020-03-26 21:17:32 +08:00
matze 358e04b2af Handle specially if no time about the last index update found.
The explorer 'currage' now returns -1 if he can not find any value about
this. The gencode-remote script handle this value special to not exit if
-1 given as value.

This fixes the bug
  ungleich-public/cdist#803
2020-03-14 09:58:38 +01:00
llnu fb32d6ed3f alpine uses a different getent lib which doesnt support: getent shadow 2020-03-08 16:04:02 +01:00
poljakowski 4b24d886eb Merge branch 'file/better-errors' into 'master'
[__file] Better errors analogous to __directory

See merge request ungleich-public/cdist!854
2020-02-26 21:50:01 +01:00
Dennis Camera 9eacba06bb [__file] Treat pre-exists as a special case in gencode-remote as it should never get there 2020-02-26 16:48:14 +01:00
Dennis Camera 46d2487f08 [__file] Give more precise error message when --state pre-exists 2020-02-26 16:40:53 +01:00
poljakowski dd6b07d924 Merge branch 'directory-exists' into 'master'
[__directory] Add --state exists and --state pre-exists

See merge request ungleich-public/cdist!832
2020-02-26 16:33:37 +01:00
Dennis Camera 6b4b6534a1 [__directory] Give more precise error message when --state pre-exists 2020-02-26 16:15:23 +01:00
poljakowski aa49afd61a Merge branch 'fix/explorer/disks' into 'master'
explorer/disks: Fix on NetBSD and support Linux w/o lsblk

See merge request ungleich-public/cdist!852
2020-02-26 12:53:26 +01:00
Dennis Camera 6db6dc4ac0 [explorer/disks] Add license header 2020-02-25 20:24:14 +01:00
Dennis Camera 1ef126e16f [explorer/disks] Move xargs call to the bottom 2020-02-25 20:21:35 +01:00
Dennis Camera d3bd2669ec [explorer/disks] Support Linux without lsblk (fallback to sysfs) 2020-02-25 20:21:14 +01:00
fnux e6f683b886 Add support for alpine (edge) package to __consul_agent 2020-02-24 09:20:49 +01:00