Merge branch 'master' into __jail

This commit is contained in:
Jake Guffey 2012-04-18 13:13:11 -04:00
commit a4c89c5552
7 changed files with 21 additions and 4 deletions

View file

@ -23,6 +23,9 @@
destination="/$__object_id" destination="/$__object_id"
state_should="$(cat "$__object/parameter/state")" state_should="$(cat "$__object/parameter/state")"
exists="$(cat "$__object/explorer/exists")"
[ "$state_should" = "exists" -a "$exists" = "yes" ] && exit 0 # nothing to do
if [ "$state_should" = "present" ]; then if [ "$state_should" = "present" ]; then
if [ -f "$__object/parameter/source" ]; then if [ -f "$__object/parameter/source" ]; then

View file

@ -21,7 +21,11 @@ None.
OPTIONAL PARAMETERS OPTIONAL PARAMETERS
------------------- -------------------
state:: state::
'present' or 'absent', defaults to 'present' 'present', 'absent' or 'exists', defaults to 'present'
where:
present: the file is exactly the one from source
absent: the file does not exist
exists: the file from source but only if it doesn't already exist
group:: group::
Group to chgrp to. Group to chgrp to.
@ -55,6 +59,11 @@ __file /etc/issue --source "$__type/files/archlinux" --state present
__file /etc/shadow --source "$__type/files/shadow" \ __file /etc/shadow --source "$__type/files/shadow" \
--owner root --group shadow --mode 0640 \ --owner root --group shadow --mode 0640 \
--state present --state present
# Provide a default file, but let the user change it
__file /home/frodo/.bashrc --source "/etc/skel/.bashrc" \
--state exists \
--owner frodo --mode 0600
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------

View file

@ -22,7 +22,7 @@
# #
if [ -f "$__object/parameter/name" ]; then if [ -f "$__object/parameter/name" ]; then
name="$__object/parameter/name" name="$(cat "$__object/parameter/name")"
else else
name="$__object_id" name="$__object_id"
fi fi

View file

@ -32,7 +32,7 @@ case "$state_should" in
present) present)
case "$os" in case "$os" in
archlinux) archlinux)
echo "sed -i /etc/rc.conf \'s/^\\(DAEMONS=.*\\))/\\1 $name)/\'" echo "sed -i 's/^\\(DAEMONS=.*\\))/\\1 $name)/' /etc/rc.conf"
;; ;;
debian|ubuntu) debian|ubuntu)
echo "update-rc.d \"$name\" defaults >/dev/null" echo "update-rc.d \"$name\" defaults >/dev/null"

View file

@ -7,6 +7,10 @@ Changelog
2.0.10: 2.0.10:
* Cleanup __group: No getent gshadow in old Redhat, use groupmod -g * Cleanup __group: No getent gshadow in old Redhat, use groupmod -g
(Matt Coddington) (Matt Coddington)
* Bugfix __package_yum: Missing cat
* Bugfix __start_on_boot: Correctly use sed and quotes (Steven Armstrong)
* Feature __file: Support for --state exists (Steven Armstrong)
* Feature core: Make variable __manifest available to type manifests
2.0.9: 2012-03-12 2.0.9: 2012-03-12
* Cleanup documentation: Fix environment variable list to be properly * Cleanup documentation: Fix environment variable list to be properly

View file

@ -173,7 +173,7 @@ __explorer::
Available for: explorer, type explorer Available for: explorer, type explorer
__manifest:: __manifest::
Directory that contains the initial manifest. Directory that contains the initial manifest.
Available for: initial manifest Available for: initial manifest, type manifest
__global:: __global::
Directory that contains generic output like explorer. Directory that contains generic output like explorer.
Available for: initial manifest, type manifest, type gencode Available for: initial manifest, type manifest, type gencode

View file

@ -92,6 +92,7 @@ class Manifest(object):
env = os.environ.copy() env = os.environ.copy()
env.update(self.env) env.update(self.env)
env.update({ env.update({
'__manifest': self.local.manifest_path,
'__object': cdist_object.absolute_path, '__object': cdist_object.absolute_path,
'__object_id': cdist_object.object_id, '__object_id': cdist_object.object_id,
'__object_name': cdist_object.name, '__object_name': cdist_object.name,