Commit graph

1182 commits

Author SHA1 Message Date
a1634b3ec0 __acl: optimize gencode-remote 2019-04-16 19:24:38 +03:00
c1a34caba7 __acl: add "other" ACL entry support and some comments, remove getfacl's inline comments 2019-04-16 19:06:48 +03:00
e04d647d8e __acl: fix always check first if path exists 2019-04-16 18:09:47 +03:00
53c963b2ee __acl: be bit more precise where the X is 2019-04-16 15:35:11 +03:00
8b9b2c56ab __acl: be more strict because of reasons 2019-04-16 15:28:25 +03:00
cea639d1c9 __acl: we can't remove mask 2019-04-16 15:27:47 +03:00
731986ef8b __acl: trying to understand X 2019-04-16 15:21:41 +03:00
9e3cd47b9a __acl: command -v stdout to devnull 2019-04-16 15:03:07 +03:00
2b5887bdbd __acl: we only care whether file is directory 2019-04-16 14:51:26 +03:00
ab954ffbcf __acl: always check first if path exists 2019-04-16 14:44:32 +03:00
ef8ff06b5f __acl: only directories can have default ACLs 2019-04-16 14:39:45 +03:00
d71eb3d8bd __acl: (open|net)bsd do not have (get|set)facl 2019-04-16 14:20:13 +03:00
2cde09648c __acl: check if getfacl is available 2019-04-16 14:15:48 +03:00
Darko Poljak
c7a4ae112f
Merge pull request #759 from jimis/acl_mask
Add support for ACL mask.
2019-04-16 11:00:27 +02:00
Dimitrios Apostolou
437af3a0a3 Silence getfacl
otherwise it always prints the message:

    getfacl: Removing leading '/' from absolute path names
2019-04-15 20:51:02 +02:00
Nico Schottelius
63d7499b75 [directory] add alpine support 2019-04-15 19:27:42 +02:00
Nico Schottelius
1722fced72 [file] add alpine support 2019-04-15 19:13:44 +02:00
Nico Schottelius
a1cb9ee869 [locale/alpine] exit 0 in gencode-remote 2019-04-15 18:56:51 +02:00
Nico Schottelius
e290733a00 [locale] Add alpine support 2019-04-15 18:54:30 +02:00
Nico Schottelius
f4db6e908e [hostname] add alpine support 2019-04-15 18:48:49 +02:00
Nico Schottelius
c801fb4965 [timezone] + alpine support 2019-04-15 18:44:30 +02:00
Dimitrios Apostolou
6062e3557c Output of grep should be quiet, as we care only for the exit code. 2019-04-15 18:05:16 +02:00
Dimitrios Apostolou
45e9ed441e Add support for ACL mask. 2019-04-15 18:05:16 +02:00
Nico Schottelius
ec935353d7 [__start_on_boot] Merge alpine and gentoo, update gentoo 2019-04-15 17:02:09 +02:00
Nico Schottelius
dbf29c18c1 [__start_on_boot] alpine fix 2019-04-15 16:41:27 +02:00
Nico Schottelius
707426d1f0 [__start_on_boot] add code for alpine handling, fix explorer 2019-04-15 16:35:10 +02:00
Nico Schottelius
e32d92c109 [__start_on_boot] Begin to add alpine support 2019-04-15 16:32:54 +02:00
Nico Schottelius
c7a9e60de0 Merge branch 'master' of github.com:ungleich/cdist 2019-04-15 16:20:31 +02:00
Nico Schottelius
3a2041019b [alpine] add support for alpine in __package and __package_apk 2019-04-15 16:11:58 +02:00
Darko Poljak
b21b6d0a7e
Merge pull request #755 from 4nd3r/bsd_stat_fix
fix __(file|directory)/explorer/stat for BSDs
2019-04-13 19:49:45 +02:00
44c9d09383 fix __(file|directory)/explorer/stat for BSDs 2019-04-12 23:34:28 +03:00
Ander Punnar
1c152f0acb fix disks explorer (#753)
* fix disks explorer

* fix SC2230

* exclude floppies

* update comment about excluded floppies

* add link to linux documentation about device majors

* try to support netbsd

* update possible netbsd disk devices
2019-04-12 20:41:05 +02:00
204a572709 __link: add messaging 2019-04-11 13:59:15 +03:00
Darko Poljak
1ba5f6276e
Merge pull request #748 from markasoftware/ufw
UFW (Uncomplicated FireWall)
2019-04-11 08:19:37 +02:00
Mark Polyakov
0ce96f0860 Added __ufw and __ufw_rule. 2019-04-10 19:45:34 -07:00
Darko Poljak
671bb82a46 Fix shellcheck issues 2019-04-09 22:44:40 +02:00
Darko Poljak
f6b318bb00 Fire onchange for present and exists states
Even if no attribute is changed.
Fixes #750.
2019-04-09 22:23:21 +02:00
Steven Armstrong
88513e6693 __ssh_authorized_keys: properly handle multiple --option parameters, fixes #393
Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
2019-04-07 12:17:19 +02:00
Darko Poljak
b47c6e3fe4 Fix shellcheck SC2002 2019-04-06 10:52:32 +02:00
decd80bf5d be more explicit 2019-04-04 00:20:46 +03:00
da6a22c71a new type: __check_messages 2019-04-03 01:11:03 +03:00
668dc83632 do not exit with non-zero if path does not exist or not directory 2019-04-02 17:52:00 +03:00
Darko Poljak
a60ce2fcfb
Merge pull request #744 from 4nd3r/__rm
new type: __clean_path
2019-03-30 12:36:38 +01:00
5f76bd5655 new type: __clean_path 2019-03-30 13:21:13 +02:00
Darko Poljak
6eb0aa4aeb
Merge pull request #743 from 4nd3r/__file_onchange
add --onchange to __file
2019-03-29 22:57:16 +01:00
c6fd43da81 add --onchange to __file, because having to use __config_file just for that feels redundant 2019-03-29 23:43:09 +02:00
0f6fe4764b add --onchange to __line 2019-03-28 23:31:38 +02:00
Silas
28e2b058a4 Use portable -p instead of --tmpdir for mktemp
-p is equivalent to --tmpdir, but more portable, since it works across
GNU/Linux and *BSDs
2019-03-25 18:36:55 -03:00
Daniel Néri
dbcf7d5543 explorer/disks: Add support for OpenBSD 2019-03-19 23:13:24 +01:00
Daniel Néri
0fc64a951c explorer/cpu_cores: Add support for OpenBSD 2019-03-19 23:09:01 +01:00
Daniel Néri
15ab7c0810 Implement "__start_on_boot --state absent" for OpenBSD 2019-03-16 17:23:19 +01:00
Darko Poljak
a40a81d36f To keep original echo intentionally disable SC2046 too 2019-02-15 20:44:03 +01:00
Darko Poljak
867b9cb102 shellcheck: SC2236: use -n instead of ! -z 2019-02-15 20:44:03 +01:00
Darko Poljak
a3a7219ad6
Merge pull request #734 from dheule/fix_zypper_types_echo
readd the use of echo in my explorers
2019-02-13 18:14:49 +01:00
Daniel Heule
df693b9f47 added # shellcheck disable=SC2005 where we need the echo in __zypper explorers 2019-02-13 11:30:55 +01:00
Dominique Roux
67c3c8ca12 Added a startup flag for prometheus alertmanager
aded the flag --cluster.advertise-address since it is needed for startup on a machine
which does not provide a private v4
2019-01-28 09:32:02 +01:00
Daniel Heule
0bdd590344 readd the use of echo in my explorers
this is nessessary for
 remove blanks in output (strip)
 catch exit codes of zypper (for example if no repo is defined at all)
2019-01-22 13:30:06 +01:00
Darko Poljak
0cb3cbae1b Remove unused explorer 2018-12-21 22:23:41 +01:00
sideeffect42
57a3257a26
Merge branch 'master' into refactor-openbsd-pkg-type 2018-12-14 21:33:42 +01:00
Darko Poljak
fccbcb2eb8
Merge pull request #732 from sideeffect42/package-messages
All package types send messages upon installation/removal
2018-12-14 16:18:20 +01:00
Takashi Yoshi
a7f1eda328 [type/__package_emerge] Send error messages to stderr 2018-12-14 15:54:54 +01:00
Takashi Yoshi
aa456ab6c1 [type/__package_pkg_openbsd] Clean up code 2018-12-14 15:51:47 +01:00
Takashi Yoshi
498628d16a [type/__package_pkg_openbsd] Misc. fixes and improvements 2018-12-14 15:49:23 +01:00
Takashi Yoshi
827081f8a2 [type/__package_pkg_openbsd/explorer/pkg_version] Fix version extraction
The earlier code stripped away all non-numeric parts of the version number.

E.g. "5.6.38p0" would be trimmed to "5.6.38"
2018-12-14 15:49:06 +01:00
Takashi Yoshi
c492c53a98 [type/__package_pkg_openbsd] Send error messages to stderr 2018-12-14 15:46:31 +01:00
Takashi Yoshi
9acb9d1f3a [type/__sysctl] Group entries 2018-12-14 14:12:33 +01:00
Takashi Yoshi
92610fe76c [type/__sysctl] Add support for Alpine Linux, Gentoo and OpenWrt 2018-12-14 13:51:44 +01:00
Takashi Yoshi
45ff67c0f5 [type/__sysctl] Add Mac OS X support 2018-12-14 13:51:44 +01:00
Takashi Yoshi
566feba5b1 [type/__sysctl] Add NetBSD support 2018-12-14 13:51:44 +01:00
Takashi Yoshi
b36716ef36 [type/__sysctl] Add OpenBSD support 2018-12-14 13:51:44 +01:00
Takashi Yoshi
183d57d6d2 [type/__sysctl] Fix spelling of FreeBSD 2018-12-14 12:43:57 +01:00
Jonas Weber
d4bb114468 Remove usage of CDIST_ORDER_DEPENDENCY 2018-12-13 13:26:40 +01:00
Jonas Weber
a7f4c8d773 Allow installing specific Docker-CE version 2018-12-13 13:23:49 +01:00
8ad93a29c9 update for debian version 9 2018-12-12 01:40:39 +09:00
Takashi Yoshi
ccdbf1a31c [type/__package_emerge_dependendencies] Send messages when a dependency is installed 2018-12-07 16:55:49 +01:00
Takashi Yoshi
7e9dce0ceb [type/__package_*] Print installed/removed messages
Up-/downgraded packages will send an "installed" message.
2018-12-07 16:53:21 +01:00
Darko Poljak
45d1037491 [__postgres_role] Revert parts of a34060d703
Broken syntax fixed
2018-12-05 16:51:37 +01:00
Darko Poljak
0491b5b8db Revert "[__postgres_role] Revert parts of a34060d7035e84ff8f70d1e8d5bded7a1bfd71b3"
This reverts commit c85dfbdb10.
2018-12-05 16:41:22 +01:00
Nico Schottelius
c85dfbdb10 [__postgres_role] Revert parts of a34060d703
Broken syntax fixed
2018-12-05 13:14:19 +01:00
Olliver Schinagl
71ceba4ac5
type: Add new type __ping
When starting with cdist, the documentation and examples can be
overwheliming. Further more, sometimes one would only want to do a
simple test to see if the basics are working. One such example currently
is to create a simple remote file. While this is a nice and simple
example, an even simpler example would be to just see if we can 'ping'
the host.

Other configuration management tools also seem to have this as a basic
starting command.

This thus allows to do:
echo __ping | cdist config --initial-manifest - <host>

as the most basic, most simple command to 'test' things with, without
having lingering files to boot.

Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
2018-11-26 20:37:43 +01:00
Dimitrios Apostolou
2cae33f6d6 Fix __group type failing with --gid
The command `echo -- -g` prints `-- -g` so the generated `groupadd` command
was syntactically incorrect and failing. Solution was to remove `--` since
echo command does not understand it, and add instead an extra space before
`-g` to avoid echo interpreting it as a flag.
2018-11-18 01:30:40 +01:00
Darko Poljak
d11174f2b7 Add missing ;; in case item. 2018-11-03 19:21:20 +01:00
sideeffect42
a34060d703 Improve OpenBSD support (#720)
* [type/__timezone] Whitelist OpenBSD

OpenBSD ships /etc/localtime and /usr/share/zoneinfo by default.

* [type/__postgres_{database,role}] Add explorer support for OpenBSD

On OpenBSD the "postgres" user is called "_postgresql".
The "postgres" database must me specifically specified as it differs from the
user name.

* [type/__postgres_{database,role}] Add gencode support for OpenBSD

On OpenBSD the "postgres" user is called "_postgresql".
The "postgres" database must me specifically specified when using psql as it
differs from the user name.

* [type/__postgres_role] Query DB if role exists instead of screen scaping

* [type/__postgres_database] Query DB if database exists instead

* [type/__postgres_{database,role}] Add user for NetBSD

* [type/__postgres_extension] Add support for OpenBSD and NetBSD

* [__ssh_authorized_key] Add OpenBSD support to entry explorer

Make sure to adhere to re_format(7) for OpenBSD compatibility.

https://man.openbsd.org/re_format.7

* [type/__start_on_boot] Add support for OpenBSD
2018-11-03 19:17:56 +01:00
Darko Poljak
e860f1c792 Determine source_is only if destination is symlink. 2018-11-02 14:35:06 +01:00
Darko Poljak
6895ad0207 Fix post-shellcheck bug. 2018-10-24 18:26:33 +02:00
c5098dfcc5 fix [SC1117] (explicitly excaping \n) 2018-10-12 14:05:38 +02:00
c950dd1e90 quote "remote user", ensuring user is handled as one parameter 2018-10-12 14:05:38 +02:00
5761939fa9 add new messages to man.rst 2018-10-12 14:05:38 +02:00
c995d08ce2 redirect stdout+stderr of userdel
If no mail-spoolfile exists for the user the error reporting was
visible in the cdist-run.
2018-10-12 14:05:38 +02:00
a1bf381370 add messaging 2018-10-12 14:05:38 +02:00
409d736339 explicitly check for absent to handle state-typos gracefully 2018-10-12 14:05:38 +02:00
Dominique Roux
dd5a45a809 [CONSUL] add newest versions 2018-10-12 11:42:42 +02:00
Darko Poljak
faed292a4e Rule should be split. 2018-10-10 15:01:03 +02:00
Darko Poljak
7a9dea9754 Improve quoting. 2018-10-10 12:56:48 +02:00
Darko Poljak
610deba454 Improve quoting. 2018-10-10 12:52:50 +02:00
Darko Poljak
8669ccb9c1 Improve shell code. 2018-10-10 12:43:39 +02:00
Darko Poljak
53300b1004 Fix after shellcheck. 2018-10-10 12:43:39 +02:00
Darko Poljak
dcb4395909 Resolve custom remote copy/exec shellcheck (non-)issues. 2018-10-10 12:43:39 +02:00
Darko Poljak
0f31a550cc Fix SC2012. 2018-10-10 12:43:39 +02:00
Darko Poljak
c58e12a4b9 shellcheck on /files/ scripts. 2018-10-10 12:43:39 +02:00
Nico Schottelius
256c8324a0 Merge branch 'master' of github.com:ungleich/cdist
Signed-off-by: Nico Schottelius <nico@nico-notebook.schottelius.org>
2018-10-09 19:43:41 +02:00
Darko Poljak
69790ec138 Fix typing error. 2018-10-08 15:43:42 +02:00
Darko Poljak
0458f66c96 Resolve SC2012. 2018-10-08 15:35:29 +02:00
Darko Poljak
ec186673bf Add TODO markers for SC2012. 2018-10-07 19:48:31 +02:00
Darko Poljak
638ddd95d6 Fix problems found by sellcheck in type explorers. 2018-10-07 19:41:44 +02:00
Darko Poljak
334201b945 Fix remaining shellcheck problems. 2018-10-07 10:22:11 +02:00
Darko Poljak
e9b823bc39 Better fixes. 2018-10-07 10:22:11 +02:00
Darko Poljak
a78baccc82 Fix SC2154. Note: ignoring __<name> vars. 2018-10-07 10:22:11 +02:00
Darko Poljak
a9f27beb98 Fix SC1117. 2018-10-07 10:22:11 +02:00
Darko Poljak
83806e767a Disable SC1091 where appropriate. 2018-10-07 10:22:11 +02:00
Darko Poljak
a46016242b
Merge pull request #708 from darko-poljak/shellcheck-various
Fix for various problems (shellcheck)
2018-10-06 15:15:38 +02:00
Darko Poljak
f039b0e6e5 Fix SC2030,SC2031. 2018-10-06 08:36:06 +02:00
Darko Poljak
68fad03a6b Fix SC2120, SC2119. 2018-10-05 15:18:59 +02:00
Darko Poljak
b284bafbee grep directly on the explorer file 2018-10-05 15:14:03 +02:00
Darko Poljak
02f39bcf6f Fix SC2028. 2018-10-05 15:08:25 +02:00
Darko Poljak
0d80b4473b Disable SC2031 for the single incident. 2018-10-05 15:04:22 +02:00
Darko Poljak
bf270b6f9c Fix SC2044. 2018-10-05 13:05:01 +02:00
Darko Poljak
a369acea72 Fix SC2021. 2018-10-05 12:52:44 +02:00
Darko Poljak
644ec85d80 Fix SC2162. 2018-10-05 12:50:01 +02:00
Darko Poljak
16159d8fca Fix SC2145. 2018-10-05 12:32:56 +02:00
Darko Poljak
596f3cf227 Disable SC2119,SC2120 where appropriate. 2018-10-05 12:31:05 +02:00
Darko Poljak
9b567ed8f7 Fix SC2230. 2018-10-05 12:27:43 +02:00
Darko Poljak
8cea8e67aa Disable SC2031 where appropriate. 2018-10-05 12:25:40 +02:00
Darko Poljak
b120a813a2 Disable SC2030 where appropriate. 2018-10-05 12:24:03 +02:00
Darko Poljak
7b17ad4733 Fix SC2143. 2018-10-05 12:21:59 +02:00
Darko Poljak
e46420e7f5 Fix SC1090. 2018-10-05 12:19:16 +02:00
Darko Poljak
2f7b8e6db9 Fix SC2153. 2018-10-05 12:16:27 +02:00
Darko Poljak
73d0a5bbbe Fix SC2235. 2018-10-05 12:14:51 +02:00
Darko Poljak
73acb35a8a Fix SC2196. 2018-10-05 12:04:45 +02:00
Darko Poljak
28889ef38a Disable SC2028 where intended. 2018-10-05 12:02:10 +02:00
Darko Poljak
ed542cc7cb Fix SC2046. 2018-10-05 11:57:31 +02:00
Darko Poljak
b25aff17c6 Disable SC2039 where appropriate. 2018-10-05 11:49:28 +02:00
Darko Poljak
a601fa91d9 Fix SC2116. 2018-10-05 11:34:10 +02:00
Darko Poljak
3b6d759660 Disable SC2016 check. 2018-10-05 10:32:38 +02:00
Darko Poljak
0cb127822f
Merge pull request #706 from darko-poljak/SC2164
Fix SC2164
2018-10-05 10:28:04 +02:00
Darko Poljak
49bb041330
Merge pull request #696 from thriqon/shellcheck-party-SC2086
Fix SC2086 on all scripts
2018-10-05 10:26:53 +02:00
Darko Poljak
c01cf38660 Fix SC2164 2018-10-04 23:10:42 +02:00
Darko Poljak
68b6477fe3
Merge pull request #705 from thriqon/shellcheck-party-various
Fix various shellcheck issues (SC2215, SC2059, SC2155, SC2091)
2018-10-04 22:39:05 +02:00
Darko Poljak
f0fb5215e8
Merge pull request #700 from thriqon/shellcheck-party-SC2034
Remove unused variables (SC2034)
2018-10-04 22:35:08 +02:00
Jonas Weber
34b571b7d9 Fix SC2091 (execute result of condition)
For some reason, the echo|grep pattern was enclosed four times in a $()
operation. Nothing happened, since grep is always invoked with -q
(quiet, nothing printed to stdout).
2018-10-04 22:23:48 +02:00
Jonas Weber
bcd7fbbcc4 Fix SC2155 (directly export computed variables) 2018-10-04 22:23:48 +02:00
Jonas Weber
a0db375f91 Disable SC2059 (printf injection) for staged_file
We're explicitly allowing for 'printf injection' here, so it's ok to
just disable the corresponding shellcheck check.
2018-10-04 22:23:38 +02:00
Jonas Weber
a6fdf4255a Fix SC2069 (wrong stdout/stderr redirect order)
In the original order, stderr was connected to the old stdout
(terminal). This was _probably_ not intended. The new order fixes this
by first connecting stdout to /dev/null and then attaching stderr to
that as well.
2018-10-04 22:04:24 +02:00
Jonas Weber
e2593c0dcb Fix SC2215 (missing brackets on if)
This might have never worked as intended, but how would you know?
2018-10-04 22:03:52 +02:00
Jonas Weber
fff656d1ac Unquote $recursive to support empty-case
This is safe to do, as the value of $recursive is not dependent on
user-supplied code.
2018-10-04 19:45:26 +02:00
Jonas Weber
53728a7ff0 Change backslash-dquote to single quote
Slightly breaking change, but improves security and readability.
2018-10-04 19:45:26 +02:00
Jonas Weber
ae7ccc5995 Fix SC2086 on all scripts
Relevant documentation: https://github.com/koalaman/shellcheck/wiki/SC2086

relates to: #540

This commit addresses 241 separate cases of missing quotes around
variables.
2018-10-04 19:45:22 +02:00
Jonas Weber
23debd5b6f Use cur_ip in jail for freebsd 2018-10-04 19:22:28 +02:00
Jonas Weber
352679386d Drop unused options parameter in __install_reboot 2018-10-04 19:22:28 +02:00
Jonas Weber
b3f4d3849a Fix __install_umount target parameter 2018-10-04 19:22:28 +02:00