forked from ungleich-public/cdist
Merge branch 'master' into __jail
This commit is contained in:
commit
1a20f0087e
7 changed files with 30 additions and 11 deletions
2
README
2
README
|
@ -288,7 +288,7 @@ Interesting information are for instance
|
|||
* What are the pros/cons you see in cdist?
|
||||
* General comments/critics
|
||||
|
||||
### Nico Schottelius, Systems Group ETH Zurich and privately
|
||||
### Nico Schottelius, Systems Group ETH Zurich, local.ch and privately
|
||||
|
||||
Yes, I'm actually eating my own dogfood and currently managing
|
||||
|
||||
|
|
|
@ -34,7 +34,8 @@ fi
|
|||
case "$state_should" in
|
||||
absent)
|
||||
# remove lines starting with key
|
||||
echo "sed -i '/^$key\($delimiter\+\)/d' \"$file\""
|
||||
echo "sed '/^$key\($delimiter\+\)/d' \"$file\" > \"$file.cdist-tmp\""
|
||||
echo "mv \"$file.cdist-tmp\" \"$file\""
|
||||
;;
|
||||
present)
|
||||
case "$state_is" in
|
||||
|
@ -44,7 +45,8 @@ case "$state_should" in
|
|||
;;
|
||||
wrongvalue)
|
||||
# change exisiting value
|
||||
echo "sed -i \"s|^$key\($delimiter\+\).*|$key\1$value|\" \"$file\""
|
||||
echo "sed \"s|^$key\($delimiter\+\).*|$key\1$value|\" \"$file\" > \"$file.cdist-tmp\""
|
||||
echo "mv \"$file.cdist-tmp\" \"$file\""
|
||||
;;
|
||||
*)
|
||||
echo "Unknown explorer state: $state_is" >&2
|
||||
|
|
|
@ -32,7 +32,9 @@ DONE
|
|||
removed)
|
||||
cat << DONE
|
||||
su - $user -c "rm -Rf \"\\\$HOME/.rvm\";
|
||||
sed -i '/rvm\/scripts\/rvm/d' \"\\\$HOME/.bashrc\""
|
||||
sed '/rvm\/scripts\/rvm/d' \"\\\$HOME/.bashrc\" > \"\\\$HOME/.bashrc.cdist-tmp\"
|
||||
mv \"\\\$HOME/.bashrc.cdist-tmp\" \"\\\$HOME/.bashrc\""
|
||||
|
||||
DONE
|
||||
;;
|
||||
esac
|
||||
|
|
|
@ -32,7 +32,8 @@ case "$state_should" in
|
|||
present)
|
||||
case "$os" in
|
||||
archlinux)
|
||||
echo "sed -i 's/^\\(DAEMONS=.*\\))/\\1 $name)/' /etc/rc.conf"
|
||||
echo "sed 's/^\\(DAEMONS=.*\\))/\\1 $name)/' /etc/rc.conf > /etc/rc.conf.cdist-tmp"
|
||||
echo "mv /etc/rc.conf.cdist-tmp /etc/rc.conf"
|
||||
;;
|
||||
debian|ubuntu)
|
||||
echo "update-rc.d \"$name\" defaults >/dev/null"
|
||||
|
@ -66,7 +67,8 @@ case "$state_should" in
|
|||
archlinux)
|
||||
# Replace a) at the beginning b) in the middle c) end d) only
|
||||
# Support @name as well...makes it more ugly, but well...
|
||||
echo "sed -i /etc/rc.conf -e 's/^\\(DAEMONS=(\\)@\\{0,1\\}$name /\\1/' -e 's/^\\(DAEMONS=(.* \\)@\\{0,1\\}$name \\(.*\\)/\\1\\2/' -e 's/^\\(DAEMONS=(.*\\) @\\{0,1\\}$name)/\\1)/' -e 's/^\\(DAEMONS=(\\)@\\{0,1\\}$name)/\\1)/'"
|
||||
echo "sed /etc/rc.conf -e 's/^\\(DAEMONS=(\\)@\\{0,1\\}$name /\\1/' -e 's/^\\(DAEMONS=(.* \\)@\\{0,1\\}$name \\(.*\\)/\\1\\2/' -e 's/^\\(DAEMONS=(.*\\) @\\{0,1\\}$name)/\\1)/' -e 's/^\\(DAEMONS=(\\)@\\{0,1\\}$name)/\\1)/' > /etc/rc.conf.cdist-tmp"
|
||||
echo "mv /etc/rc.conf.cdist-tmp /etc/rc.conf"
|
||||
;;
|
||||
debian|ubuntu)
|
||||
echo update-rc.d -f \"$name\" remove
|
||||
|
|
|
@ -11,6 +11,8 @@ Changelog
|
|||
* 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
|
||||
* Feature core: Correct parent dependency handling (Steven Armstrong)
|
||||
* Bugfix several types: Fix sed for FreeBSD (Istvan Beregszaszi)
|
||||
|
||||
2.0.9: 2012-03-12
|
||||
* Cleanup documentation: Fix environment variable list to be properly
|
||||
|
|
|
@ -6,6 +6,8 @@ Feel free to pick one!
|
|||
CORE
|
||||
----
|
||||
- support default parameter
|
||||
- document and add paremeters for remote-copy and remote-exec!
|
||||
- remove hack, make a feature of it
|
||||
|
||||
TESTS
|
||||
-----
|
||||
|
|
|
@ -160,10 +160,19 @@ class Emulator(object):
|
|||
def record_auto_requirements(self):
|
||||
"""An object shall automatically depend on all objects that it defined in it's type manifest.
|
||||
"""
|
||||
# __object_name is the name of the object whose type manifest is currenlty executed
|
||||
# __object_name is the name of the object whose type manifest is currently executed
|
||||
__object_name = os.environ.get('__object_name', None)
|
||||
if __object_name:
|
||||
_object = self.cdist_object.object_from_name(__object_name)
|
||||
# prevent circular dependencies
|
||||
if not _object.name in self.cdist_object.requirements:
|
||||
_object.requirements.append(self.cdist_object.name)
|
||||
# The object whose type manifest is currently run
|
||||
parent = self.cdist_object.object_from_name(__object_name)
|
||||
# The object currently being defined
|
||||
current_object = self.cdist_object
|
||||
# current_object shall have all dependencies that it's parent has
|
||||
for req in parent.requirements:
|
||||
if req not in current_object.requirements:
|
||||
current_object.requirements.append(req)
|
||||
# As parent defined current_object it shall automatically depend on it.
|
||||
# But only if the user hasn't said otherwise.
|
||||
# Must prevent circular dependencies.
|
||||
if not parent.name in current_object.requirements:
|
||||
parent.requirements.append(current_object.name)
|
||||
|
|
Loading…
Reference in a new issue