Commit graph

49 commits

Author SHA1 Message Date
Dennis Camera
3860f1feea [type/{__file/__directory}] Support setuid,setguid,sticky bits 2020-06-30 15:10:30 +02:00
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
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
Dennis Camera
e82dd35869 [__file] stat explorer patch for systems without stat(1)
Some embedded systems (like OpenWrt) do not ship a stat(1) binary.
This workaround parses the output of ls(1) and /etc/passwd, /etc/group to
gather the information needed.
2020-02-03 18:36:59 +01:00
038524ba30 support solaris in __(file|directory)/explorer/stat 2019-04-20 16:10:17 +03:00
Nico Schottelius
1722fced72 [file] add alpine support 2019-04-15 19:13:44 +02:00
44c9d09383 fix __(file|directory)/explorer/stat for BSDs 2019-04-12 23:34:28 +03: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
c6fd43da81 add --onchange to __file, because having to use __config_file just for that feels redundant 2019-03-29 23:43:09 +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
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
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
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
6b0f8fba22 Remove unused variables (almost, found bugs?)
Solves SC2034

references #540.
2018-10-04 19:22:28 +02:00
Jonas Weber
6326eae1bb Fix SC2166 on all manfest/gencode/explorers 2018-10-01 22:13:24 +02:00
Darko Poljak
bc94c01c49 Amend __file man. 2018-03-06 07:39:50 +01:00
a9a359d542 Add pre-exists state to __file (#641)
This allows checking whether a file exists, but erroring out instead of
creating the file if it does not (or is not a regular file).
2018-03-06 07:33:22 +01:00
6a6716035b one space too much 2017-07-04 19:25:08 +03:00
0e8302c204 if no --source, then create only if there's no file 2017-07-04 19:23:51 +03:00
Darko Poljak
62378dc8b9 Change shebang to #!/bin/sh -e 2017-06-28 13:19:32 +02:00
Darko Poljak
ca424a34e6 Fix shell IPv6 testing (for -e). 2016-11-28 08:13:59 +01:00
Darko Poljak
6ce6c7830b Better test for IPv6 address. 2016-11-05 16:38:49 +01:00
Darko Poljak
4ddf6557e3 IPv6 fix in gencode scripts. 2016-11-02 13:55:25 +01:00
Darko Poljak
df566f4ff8 GPLv3+ relicensing. 2016-08-10 18:15:54 +02:00
Darko Poljak
f98208f250 Make man pages SEE ALSO by convention. Improve docs building. 2016-06-30 12:09:07 +02:00
Darko Poljak
51c94e9e82 Restructure and fix and improve docs and manpages. 2016-06-29 07:48:34 +02:00
Darko Poljak
b89077f9a5 Better sphinx manpage ext. Add custom dotman Makefile target for custom .cdist directory. 2016-06-23 16:08:59 +02:00
Darko Poljak
cf32b669ff Write sphinx rst docs. 2016-05-22 17:16:03 +02:00
Jonathan A. Kollasch
185d7f593a Treat NetBSD the same as FreeBSD and OpenBSD in 'stat' explorers 2015-10-15 10:22:46 -05:00
Nico Schottelius
dd562befc9 add support for --target-release for __package_apt
Signed-off-by: Nico Schottelius <nico@freiheit.schottelius.org>
2014-11-25 23:00:17 +01:00
Manuel Hutter
8a70343e2c Fixed wrong mode format for stat on OSX. 2014-06-10 19:48:02 +02:00
Manuel Hutter
90acfc3952 Fixed stat on OSX 2014-06-10 19:19:26 +02:00
og
1c0d74f7db openbsd stat works the same way that freebsd's does 2014-03-02 17:18:25 -07:00
Nico Schottelius
acd42b259b do not generate code when mode = 0xxx format
Signed-off-by: Nico Schottelius <nico@bento.schottelius.org>
2013-12-04 13:37:15 +01:00
Nico Schottelius
68b7392021 add support for messaging to __file, document messaging in reference
Signed-off-by: Nico Schottelius <nico@bento.schottelius.org>
2013-12-03 15:41:43 +01:00
Nico Schottelius
684ad56a80 Merge branch 'master' into notifications
Took the __file parts from master.

Signed-off-by: Nico Schottelius <nico@bento.schottelius.org>

Conflicts:
	cdist/conf/type/__file/gencode-local
	cdist/conf/type/__file/gencode-remote
2013-12-03 14:38:11 +01:00
Steven Armstrong
6c3b1e3ca0 add gpl header
Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
2013-11-27 16:05:10 +01:00
Steven Armstrong
fcfd2d0a3c refactor so that there is no interaction between code-local and code-remote
Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
2013-11-26 16:31:18 +01:00
Steven Armstrong
f82c4dc669 no late delete
Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
2013-11-26 16:31:17 +01:00
Steven Armstrong
5918de368d fix quoting, remove redundant code
Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
2013-11-26 16:31:17 +01:00
Steven Armstrong
db29ea8e70 intial take on fixing the file type
- upload file in a safer way
- remove destination if it is not a file
- only set attributes if required

Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
2013-11-26 16:31:17 +01:00
Nico Schottelius
edec2abb1d adopt first type: __file for messaging
Signed-off-by: Nico Schottelius <nico@bento.schottelius.org>
2013-11-26 01:01:44 +01:00
Nico Schottelius
7a41d6d8fa __file: notify when doing changes
Signed-off-by: Nico Schottelius <nico@brief.schottelius.org>
2013-01-20 18:11:47 +01:00
Nico Schottelius
347c620eed indent
Signed-off-by: Nico Schottelius <nico@brief.schottelius.org>
2012-11-07 18:08:03 +01:00
Nico Schottelius
8ab408f890 remove parameter change code
Signed-off-by: Nico Schottelius <nico@brief.schottelius.org>
2012-11-07 17:52:05 +01:00
Steven Armstrong
f769b395c2 __file: implement --state exists
Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
2012-11-07 16:57:31 +01:00
Nico Schottelius
63573a9797 make package_data work
Signed-off-by: Nico Schottelius <nico@brief.schottelius.org>
2012-10-29 22:50:27 +01:00