diff --git a/README b/README deleted file mode 100644 index caf2dac8..00000000 --- a/README +++ /dev/null @@ -1,7 +0,0 @@ -cdist ------ - -cdist is a usable configuration management system. - -For the web documentation have a look at https://www.cdi.st/ -or at docs/src for reStructuredText manual. diff --git a/README.md b/README.md new file mode 100644 index 00000000..de6901c7 --- /dev/null +++ b/README.md @@ -0,0 +1,31 @@ +# cdist + +**cdist** is a usable configuration management system. + +It adheres to the [**KISS principle**](https://en.wikipedia.org/wiki/KISS_principle) +and is being used in small up to enterprise grade environments. + +For more information have a look at [**homepage**](https://cdi.st) +or at **``docs/src``** for manual in **reStructuredText** format. + +## Contributing + +Merge/Pull requests can be made in both +[upstream **GitLab**](https://code.ungleich.ch/ungleich-public/cdist/merge_requests) +(managed by [**ungleich**](https://ungleich.ch)) +and [**GitHub** project](https://github.com/ungleich/cdist/pulls). + +Issues can be made and other project management activites happen +[**only in GitLab**](https://code.ungleich.ch/ungleich-public/cdist) +(needs [**ungleich** account](https://account.ungleich.ch)). + +For community-maintained types there is +[**cdist-contrib** project](https://code.ungleich.ch/ungleich-public/cdist-contrib). + +## Participating + +IRC: ``#cdist`` @ freenode + +Matrix: ``#cdist:ungleich.ch`` + +Mattermost: https://chat.ungleich.ch/ungleich/channels/cdist diff --git a/cdist/conf/explorer/cpu_cores b/cdist/conf/explorer/cpu_cores index a52bddac..c6744142 100755 --- a/cdist/conf/explorer/cpu_cores +++ b/cdist/conf/explorer/cpu_cores @@ -32,6 +32,10 @@ case "$os" in sysctl -n hw.ncpuonline ;; + "freebsd"|"netbsd") + sysctl -n hw.ncpu + ;; + *) if [ -r /proc/cpuinfo ]; then cores="$(grep "core id" /proc/cpuinfo | sort | uniq | wc -l)" diff --git a/cdist/conf/explorer/memory b/cdist/conf/explorer/memory index 4e3efff8..302b4cda 100755 --- a/cdist/conf/explorer/memory +++ b/cdist/conf/explorer/memory @@ -29,7 +29,7 @@ case "$os" in echo "$(sysctl -n hw.memsize)/1024" | bc ;; - "openbsd") + *"bsd") echo "$(sysctl -n hw.physmem) / 1048576" | bc ;; diff --git a/cdist/core/explorer.py b/cdist/core/explorer.py index 353d7681..c93f8958 100644 --- a/cdist/core/explorer.py +++ b/cdist/core/explorer.py @@ -167,7 +167,8 @@ class Explorer(object): def run_global_explorer(self, explorer): """Run the given global explorer and return it's output.""" script = os.path.join(self.remote.global_explorer_path, explorer) - return self.remote.run_script(script, env=self.env, return_output=True) + return self.remote.run_script(script, env=self.env, return_output=True, + warn_return_output=False) # type @@ -229,7 +230,8 @@ class Explorer(object): }) script = os.path.join(self.remote.type_path, cdist_type.explorer_path, explorer) - return self.remote.run_script(script, env=env, return_output=True) + return self.remote.run_script(script, env=env, return_output=True, + warn_return_output=False) def transfer_type_explorers(self, cdist_type): """Transfer the type explorers for the given type to the diff --git a/cdist/exec/remote.py b/cdist/exec/remote.py index e0ef66ec..c53f2efa 100644 --- a/cdist/exec/remote.py +++ b/cdist/exec/remote.py @@ -219,7 +219,7 @@ class Remote(object): self._run_command(command) def run_script(self, script, env=None, return_output=False, stdout=None, - stderr=None): + stderr=None, warn_return_output=True): """Run the given script with the given environment on the remote side. Return the output as a string. @@ -232,10 +232,11 @@ class Remote(object): command.append(script) return self.run(command, env=env, return_output=return_output, - stdout=stdout, stderr=stderr) + stdout=stdout, stderr=stderr, + warn_return_output=warn_return_output) def run(self, command, env=None, return_output=False, stdout=None, - stderr=None): + stderr=None, warn_return_output=True): """Run the given command with the given environment on the remote side. Return the output as a string. @@ -269,10 +270,11 @@ class Remote(object): else: cmd.extend(command) return self._run_command(cmd, env=env, return_output=return_output, - stdout=stdout, stderr=stderr) + stdout=stdout, stderr=stderr, + warn_return_output=warn_return_output) def _run_command(self, command, env=None, return_output=False, stdout=None, - stderr=None): + stderr=None, warn_return_output=True): """Run the given command with the given environment. Return the output as a string. @@ -280,7 +282,8 @@ class Remote(object): assert isinstance(command, (list, tuple)), ( "list or tuple argument expected, got: %s" % command) - if return_output and stdout is not subprocess.PIPE: + warn_return_output_applies = warn_return_output and return_output + if warn_return_output_applies and stdout is not subprocess.PIPE: self.log.debug("return_output is True, ignoring stdout") close_stdout = False diff --git a/configuration/cdist.cfg.skeleton b/configuration/cdist.cfg.skeleton index 22c1ccaf..bfac9f5c 100644 --- a/configuration/cdist.cfg.skeleton +++ b/configuration/cdist.cfg.skeleton @@ -19,6 +19,9 @@ # such as ':' for POSIX or ';' for Windows. # If also specified at command line then values from command line are # appended to this value. +# Notice that this works in a "last one wins" fashion, so if a type is redefined +# in multiple conf_dirs, the last one in which it is defined will be used. +# Consider using a unique prefix for your own roles if this can be an issue. # conf_dir = : # # init_manifest diff --git a/docs/changelog b/docs/changelog index 7cacf3cf..1e213187 100644 --- a/docs/changelog +++ b/docs/changelog @@ -10,6 +10,8 @@ next: * New type: __pf_apply_anchor (Kamila Součková, Evil Ham) * Type __pf_ruleset: Refactor (Kamila Součková, Evil Ham) * Type __pf_apply: Deprecate type (Kamila Součková, Evil Ham) + * Configuration: Add notes to cdist.cfg.skeleton (Evil Ham) + * Explorers cpu_cores, memory: Improve *BSD support (Evil Ham) 6.5.4: 2020-04-11 * Explorer init: Do not grep on non-existent init (Steven Armstrong)