forked from ungleich-public/cdist
Compare commits
2 commits
master
...
feature/sh
Author | SHA1 | Date | |
---|---|---|---|
|
c88e6acc77 | ||
|
bcdfc0eaa3 |
8 changed files with 40 additions and 1 deletions
16
cdist/conf/lib/errors.sh
Normal file
16
cdist/conf/lib/errors.sh
Normal file
|
@ -0,0 +1,16 @@
|
|||
__cdist_unsupported_os() {
|
||||
if [ $# -gt 0 ]
|
||||
then
|
||||
os=$1
|
||||
shift
|
||||
else
|
||||
os=$(cat "$__explorer/os")
|
||||
fi
|
||||
printf "Your operating system \"%s\" is currently not supported.\nPlease contribute an implementation for it if you can.\n" "${os}" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
__cdist_error() {
|
||||
printf "$@" >&2
|
||||
exit 1
|
||||
}
|
|
@ -56,6 +56,7 @@ gencode-local
|
|||
__type: full qualified path to the type's dir
|
||||
__files: full qualified path to the files dir
|
||||
__target_host_tags: comma spearated list of host tags
|
||||
__lib: full qualified path to the lib dir
|
||||
|
||||
returns: string containing the generated code or None
|
||||
|
||||
|
@ -75,6 +76,7 @@ gencode-remote
|
|||
__type: full qualified path to the type's dir
|
||||
__files: full qualified path to the files dir
|
||||
__target_host_tags: comma spearated list of host tags
|
||||
__lib: full qualified path to the lib dir
|
||||
|
||||
returns: string containing the generated code or None
|
||||
|
||||
|
@ -107,6 +109,7 @@ class Code(object):
|
|||
'__target_fqdn': self.target_host[2],
|
||||
'__global': self.local.base_path,
|
||||
'__files': self.local.files_path,
|
||||
'__lib': self.local.lib_path,
|
||||
'__target_host_tags': self.local.target_host_tags,
|
||||
'__cdist_log_level': util.log_level_env_var_val(local.log),
|
||||
'__cdist_log_level_name': util.log_level_name_env_var_val(
|
||||
|
|
|
@ -44,6 +44,7 @@ common:
|
|||
== local.type_path
|
||||
__files: full qualified path to the files dir
|
||||
__target_host_tags: comma spearated list of host tags
|
||||
__lib: full qualified path to the lib dir
|
||||
|
||||
initial manifest is:
|
||||
script: full qualified path to the initial manifest
|
||||
|
@ -111,6 +112,7 @@ class Manifest(object):
|
|||
'__target_hostname': self.target_host[1],
|
||||
'__target_fqdn': self.target_host[2],
|
||||
'__files': self.local.files_path,
|
||||
'__lib': self.local.lib_path,
|
||||
'__target_host_tags': self.local.target_host_tags,
|
||||
'__cdist_log_level': util.log_level_env_var_val(self.log),
|
||||
'__cdist_log_level_name': util.log_level_name_env_var_val(
|
||||
|
|
|
@ -36,7 +36,7 @@ import cdist.message
|
|||
from cdist import core
|
||||
import cdist.exec.util as util
|
||||
|
||||
CONF_SUBDIRS_LINKED = ["explorer", "files", "manifest", "type", ]
|
||||
CONF_SUBDIRS_LINKED = ["explorer", "files", "manifest", "type", "lib", ]
|
||||
|
||||
|
||||
class Local(object):
|
||||
|
@ -133,6 +133,7 @@ class Local(object):
|
|||
os.path.join(self.manifest_path, "init"))
|
||||
|
||||
self.type_path = os.path.join(self.conf_path, "type")
|
||||
self.lib_path = os.path.join(self.conf_path, "lib")
|
||||
|
||||
def _init_object_marker(self):
|
||||
self.object_marker_file = os.path.join(self.base_path, "object_marker")
|
||||
|
|
|
@ -78,6 +78,7 @@ class Shell(object):
|
|||
'__manifest': self.local.manifest_path,
|
||||
'__explorer': self.local.global_explorer_path,
|
||||
'__files': self.local.files_path,
|
||||
'__lib': self.local.lib_path,
|
||||
'__target_host_tags': self.local.target_host_tags,
|
||||
}
|
||||
|
||||
|
|
|
@ -101,6 +101,7 @@ class CodeTestCase(test.CdistTestCase):
|
|||
self.cdist_object.object_id)
|
||||
self.assertEqual(output_dict['__object_name'], self.cdist_object.name)
|
||||
self.assertEqual(output_dict['__files'], self.local.files_path)
|
||||
self.assertEqual(output_dict['__lib'], self.local.lib_path)
|
||||
self.assertEqual(output_dict['__target_host_tags'],
|
||||
self.local.target_host_tags)
|
||||
self.assertEqual(output_dict['__cdist_log_level'],
|
||||
|
@ -129,6 +130,7 @@ class CodeTestCase(test.CdistTestCase):
|
|||
self.cdist_object.object_id)
|
||||
self.assertEqual(output_dict['__object_name'], self.cdist_object.name)
|
||||
self.assertEqual(output_dict['__files'], self.local.files_path)
|
||||
self.assertEqual(output_dict['__lib'], self.local.lib_path)
|
||||
self.assertEqual(output_dict['__target_host_tags'],
|
||||
self.local.target_host_tags)
|
||||
self.assertEqual(output_dict['__cdist_log_level'],
|
||||
|
|
|
@ -97,6 +97,7 @@ class ManifestTestCase(test.CdistTestCase):
|
|||
self.local.type_path)
|
||||
self.assertEqual(output_dict['__manifest'], self.local.manifest_path)
|
||||
self.assertEqual(output_dict['__files'], self.local.files_path)
|
||||
self.assertEqual(output_dict['__lib'], self.local.lib_path)
|
||||
self.assertEqual(output_dict['__target_host_tags'],
|
||||
self.local.target_host_tags)
|
||||
self.assertEqual(output_dict['__cdist_log_level'],
|
||||
|
@ -140,6 +141,7 @@ class ManifestTestCase(test.CdistTestCase):
|
|||
self.assertEqual(output_dict['__object_id'], cdist_object.object_id)
|
||||
self.assertEqual(output_dict['__object_name'], cdist_object.name)
|
||||
self.assertEqual(output_dict['__files'], self.local.files_path)
|
||||
self.assertEqual(output_dict['__lib'], self.local.lib_path)
|
||||
self.assertEqual(output_dict['__target_host_tags'],
|
||||
self.local.target_host_tags)
|
||||
self.assertEqual(output_dict['__cdist_log_level'],
|
||||
|
|
|
@ -81,6 +81,10 @@ confdir/files/
|
|||
Cdist does not care about this directory besides providing access to it.
|
||||
It is thought to be a general file storage area.
|
||||
|
||||
confdir/lib/
|
||||
Cdist does not care about this directory besides providing access to it.
|
||||
It is thought to be a general storage for shell library files.
|
||||
|
||||
confdir/manifest/init
|
||||
This is the central entry point.
|
||||
It is an executable (+x bit set) shell script that can use
|
||||
|
@ -141,6 +145,10 @@ confdir/type/<name>/files
|
|||
by cdist at any time. It can be used for storing supplementary
|
||||
files (like scripts to act as a template or configuration files).
|
||||
|
||||
confdir/type/<name>/lib
|
||||
This directory is reserved for user shell library files and will
|
||||
not be used by cdist at any time.
|
||||
|
||||
out/
|
||||
This directory contains output of cdist and is usually located
|
||||
in a temporary directory and thus will be removed after the run.
|
||||
|
@ -235,6 +243,10 @@ __files
|
|||
Directory that contains content from the "files" subdirectories
|
||||
from the configuration directories.
|
||||
Available for: initial manifest, type manifest, type gencode, shell.
|
||||
__lib
|
||||
Directory that contains content from the "lib" subdirectories
|
||||
from the configuration directories.
|
||||
Available for: initial manifest, type manifest, type gencode, shell.
|
||||
__manifest
|
||||
Directory that contains the initial manifest.
|
||||
Available for: initial manifest, type manifest, shell.
|
||||
|
|
Loading…
Reference in a new issue