Commit Graph

1641 Commits

Author SHA1 Message Date
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
kjg 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
Darko Poljak 8c03518962 Fix spelling. 2018-10-17 07:09:59 +02:00
Darko Poljak 5480c22020 Adapt object_parameters before checking conflicting parameters. 2018-10-13 16:11:51 +02:00
Darko Poljak 151edc6398 Fix DirectoryDict getitem. 2018-10-12 19:08:36 +02:00
tom c5098dfcc5 fix [SC1117] (explicitly excaping `\n`) 2018-10-12 14:05:38 +02:00
tom c950dd1e90 quote "remote user", ensuring `user` is handled as one parameter 2018-10-12 14:05:38 +02:00
tom 5761939fa9 add new messages to man.rst 2018-10-12 14:05:38 +02:00
tom 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
tom a1bf381370 add messaging 2018-10-12 14:05:38 +02:00
tom 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
Darko Poljak 0b58ab8c83 Bypass Configuration singleton from other tests if any. 2018-10-10 12:34:31 +02:00
Darko Poljak 9afc17f3f8 Make cdist.test return exit code. 2018-10-10 10:37:29 +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
Jonas Weber 6b0f8fba22 Remove unused variables (almost, found bugs?)
Solves SC2034

references #540.
2018-10-04 19:22:28 +02:00
tom 085b2a2b10 remove `set -e` on explorers (they should be able to fail gracefully) 2018-10-04 17:38:39 +02:00
tom a46da35bbc fix SC2148 (missing shebang) and make executable 2018-10-04 17:38:38 +02:00
tom d950ddada3 fix SC2045 (use globs instead of `ls`) 2018-10-04 16:01:45 +02:00
tom 134c84607f fix another SC2166 (test `[ .. -a.. ]` replaced by `[ .. ] && ]`) 2018-10-04 12:28:59 +02:00
Darko Poljak e1b62ec560
Merge pull request #699 from darko-poljak/SC2039
Fix SC2039
2018-10-04 09:08:23 +02:00
Darko Poljak 8ef2773c0d Fix SC2039 2018-10-03 14:32:39 +02:00
Darko Poljak 44acfcdd12 Fix SC2002 2018-10-03 14:12:07 +02:00
Darko Poljak e69be05f70
Merge pull request #694 from darko-poljak/SC2005
Fix SC2005
2018-10-02 21:49:45 +02:00
Darko Poljak d29534861b
Merge pull request #695 from darko-poljak/SC2004
Fix SC2004
2018-10-02 21:49:01 +02:00
Darko Poljak 0928708d19 Fix SC2004 2018-10-02 20:34:54 +02:00
Darko Poljak 5ed95ce93b Fix SC2005 2018-10-02 20:22:44 +02:00
Jonas Weber 6326eae1bb Fix SC2166 on all manfest/gencode/explorers 2018-10-01 22:13:24 +02:00
Darko Poljak 82077aff25 Add timestamping log option to config file. 2018-09-27 18:55:33 +02:00
Darko Poljak 1e34fc20be
Merge pull request #691 from darko-poljak/log-timestamping
Add timestamp to log messages.
2018-09-26 20:35:14 +02:00
Darko Poljak 4b9994f134
Merge pull request #690 from myeisha/batch-scp
transfer all files of a directory at once
2018-09-23 22:22:57 +02:00
Darko Poljak 0c57b3083e Fix getting loggers. 2018-09-23 21:38:03 +02:00
Darko Poljak 6acf6f64dc Add timestamp to log messages. 2018-09-23 20:36:57 +02:00
dhivael c021cd15cd transfer all files of a directory at once
instead of calling the copy command once per file in a directory (eg a
type explorer dir), call the copy command only once with all files of
the directory.

batch copy saves 20% of dry-run time on my test manifest in sequential
mode, and 15% in parallel mode.
2018-09-22 17:35:32 +02:00
dhivael f918acd725 don't duplicate Remote::mkdir in explorer transfer
Remote::transfer contains a call to mkdir(destination) if the source is
a directory. since the destination must also be a directory we can omit
extra mkdir calls in Explorer.

this saves about 10% on my manifests in sequential mode, and about 6% in
parallel mode.
2018-09-22 13:16:22 +02:00
Jonas Weber b3f3b907a4 Quote aptget command and params, simplify explorer 2018-09-12 11:36:11 +02:00
Jonas Weber 346f1f8af3 Send messages when installing packages via __package_apt 2018-09-12 11:36:06 +02:00
Adam Dej 2e653409c1 Update __docker type
- Update installation method, following official installation
instructions.
  - docker-engine was renamed to Docker CE around March 2017. Update
manpage to reflect that change.
  - Remove flag `--experimental` since it is no longer necessary to install a
different binary to get experimental features. Experimental features are
included in the stable binary and can be enabled by a flag or in a
config file.
2018-09-07 11:38:49 +02:00
Adam Dej c2f8c7abb3 Add explorer for info in /etc/os-release 2018-09-07 11:38:49 +02:00
Darko Poljak 3782656569 Report encoding errors nicely. 2018-09-04 08:27:20 +02:00
Darko Poljak a627247908 Check if certbot exists before using it. Fixes #685. 2018-09-01 23:27:58 +02:00
Stu Zhao ad46c39c86
Merge branch 'master' into master 2018-08-30 15:56:19 -07:00
Darko Poljak 93d877f5bf Add nonparallel marker for __apt_source type. 2018-08-30 20:22:51 +02:00
Stu Zhao f143a70463 Support pacman with --maxage parameter 2018-08-29 11:31:31 -07:00
Stu Zhao b12c02138d Refactor __package_update_index explorers
* add an type explorer to unify detecting of package type.
* update currage use the type explorer, so if os and passed in type
does not match, it behaves correctly.
2018-08-29 00:22:28 -07:00
Stu Zhao 2f89d8a514 Fix __package_update_index processing error
exit 1 in explorer will abort cdist.
2018-08-29 00:22:28 -07:00
Dominique Roux f04f76524c Bugfix:
- __grafana_dashboard had the wrong release name for devuan ascii
2018-07-22 18:35:30 +02:00
Adam Dej 43982f821f __systemd_unit: add support for masking units 2018-07-11 16:22:36 +02:00
Adam Dej 37b37f6e66 __systemd_unit: fix crash when transitioning to state=absent
This type tried to disable an unit after it has removed it, which
failed. Now the removal happens in gencode-remote, after the unit has
been stopped and disabled.
2018-07-11 16:22:36 +02:00
Adam Dej 8d84834db6 __systemd_unit: manpage clarifications
Clarify that this type only operates on units in /etc/systemd/system.
Also, when state=present, it is not always true that the type is
"installed, enabled and started"
2018-07-11 16:16:08 +02:00
Darko Poljak 6c8014b407 __letsencrypt_cert: add support for devuan ascii 2018-06-22 14:09:31 +02:00
Jonas Weber 4eaace7dd5 Handle missing file in __line explorer gracefully
closes #675
2018-06-20 11:14:25 +02:00
Darko Poljak ec8f2f9488 Fix temp file location and removal 2018-06-20 08:29:41 +02:00
Darko Poljak f75af95bda
Merge pull request #663 from asteven/type/__line
RFC: rewrite __line type for --before and --after support
2018-06-16 10:51:33 +02:00
Darko Poljak 9d4c0331a9 __sysctl: support sysctl.d 2018-06-16 07:42:43 +02:00
Darko Poljak 5aa8dac80a Disable config parser interpolation 2018-06-13 07:53:52 +02:00
ander d7a1645e4e __acl: fix os explorer 2018-06-11 11:21:07 +03:00
ander 90adefe2e4 add __acl: Basic wrapper around setfacl 2018-06-08 15:06:35 +03:00
Steven Armstrong 4516ee0baa position can not be empty
Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
2018-06-01 15:27:40 +02:00
Darko Poljak efebe15386 Fix __letsencrypt_cert type: use object id as domain if domain param is not specified 2018-05-30 19:38:56 +02:00
Darko Poljak 98ceebe386
Merge pull request #667 from aluuu/master
Fix __package_yum explorer
2018-05-28 08:05:59 +02:00
Nico Schottelius 709c216096 [__consul_agent] Add LSB header so that innserv doe not fail 2018-05-27 19:07:57 +02:00
Alexander Dinu b3a4152e00 Fix __package_yum explorer
Why:

In case when name contains package name with exact version specified (e.g. rpm-build-4.11.3)
```
rpm -q --whatprovides "$pkg_name"
```

will tell you that no package could provide you with 'rpm-build-4.11.3',
because it's not virtual or file-provide, but exact package name.

This will lead to the installation of the package which was already installed.
It slows down manifest execution a lot.

My change will keep previous behaviour which relies on --whatprovides and
will fix wrong behaviour when argument is full package name with version.
2018-05-27 17:20:55 +02:00
lubo e7e8f1428a Add new type __install_coreos 2018-05-21 11:10:54 +02:00
Steven Armstrong fb26894cbd when searching treat line as string, and regex as regexp
Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
2018-05-18 16:57:34 +02:00
Steven Armstrong a3968f8313 rewrite __line type for --before and --after support
Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
2018-05-18 01:25:35 +02:00
Darko Poljak 6946dc877a pep8 2018-05-17 13:33:58 +02:00
Darko Poljak 3cf417fa2b Fix NameError: name 'cdist_object' is not defined, #662 2018-05-15 12:12:01 +02:00
lubo 22d570ae60 Rewrite __letsencrypt_cert type
This commit adds the following features:

 * Ability to expand existing certificate
 * Ability to manage object state
 * Ability to obtain test certificate
 * Ability to promote test certificate to production
 * Ability to specify custom certificate name
 * Ability to specify multiple domains per certificate
 * Ability to use Certbot in standalone mode
 * Messaging

This commit also introduces the following behavioral changes:

 * Attempt to install Certbot only when it is not installed
   already
 * Installation of the cron job has to be enabled using
   `--automatic-renewal` parameter

**Note:** Object ID is now treated as certificate name and new
required parameter `--domain` was added.
2018-05-08 10:49:49 +02:00