forked from ungleich-public/cdist
Merge branch 'issue/252' of git://github.com/asteven/cdist into preos
This commit is contained in:
commit
ca868596e3
4 changed files with 28 additions and 11 deletions
|
@ -2,6 +2,7 @@
|
||||||
#
|
#
|
||||||
# 2011-2013 Nico Schottelius (nico-cdist at schottelius.org)
|
# 2011-2013 Nico Schottelius (nico-cdist at schottelius.org)
|
||||||
# 2013 Steven Armstrong (steven-cdist armstrong.cc)
|
# 2013 Steven Armstrong (steven-cdist armstrong.cc)
|
||||||
|
# 2014 Daniel Heule (hda at sfs.biz)
|
||||||
#
|
#
|
||||||
# This file is part of cdist.
|
# This file is part of cdist.
|
||||||
#
|
#
|
||||||
|
@ -73,14 +74,15 @@ set_mode() {
|
||||||
case "$state_should" in
|
case "$state_should" in
|
||||||
present)
|
present)
|
||||||
if [ "$type" != "directory" ]; then
|
if [ "$type" != "directory" ]; then
|
||||||
# our destination is not a directory, remove whatever is there
|
|
||||||
# and then create our directory and set all attributes
|
|
||||||
set_attributes=1
|
set_attributes=1
|
||||||
cat << DONE
|
if [ "$type" != "none" ]; then
|
||||||
rm -f "$destination"
|
# our destination is not a directory, remove whatever is there
|
||||||
mkdir $mkdiropt "$destination"
|
# and then create our directory and set all attributes
|
||||||
DONE
|
echo rm -f "\"$destination\""
|
||||||
echo "remove non directory" >> "$__messages_out"
|
echo "remove non directory" >> "$__messages_out"
|
||||||
|
fi
|
||||||
|
echo "mkdir $mkdiropt \"$destination\""
|
||||||
|
echo "create" >> "$__messages_out"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Note: Mode - needs to happen last as a chown/chgrp can alter mode by
|
# Note: Mode - needs to happen last as a chown/chgrp can alter mode by
|
||||||
|
|
|
@ -46,6 +46,21 @@ recursive::
|
||||||
If supplied the chgrp and chown call will run recursively.
|
If supplied the chgrp and chown call will run recursively.
|
||||||
This does *not* influence the behaviour of chmod.
|
This does *not* influence the behaviour of chmod.
|
||||||
|
|
||||||
|
MESSAGES
|
||||||
|
--------
|
||||||
|
chgrp <group>::
|
||||||
|
Changed group membership
|
||||||
|
chown <owner>::
|
||||||
|
Changed owner
|
||||||
|
chmod <mode>::
|
||||||
|
Changed mode
|
||||||
|
create::
|
||||||
|
Empty directory was created
|
||||||
|
remove::
|
||||||
|
Directory exists, but state is absent, directory will be removed by generated code.
|
||||||
|
remove non directory::
|
||||||
|
Someting other than a directory with the same name exists and was removed prior to create.
|
||||||
|
|
||||||
|
|
||||||
EXAMPLES
|
EXAMPLES
|
||||||
--------
|
--------
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
|
import glob
|
||||||
|
|
||||||
import cdist
|
import cdist
|
||||||
|
|
||||||
|
@ -79,7 +80,7 @@ class Explorer(object):
|
||||||
|
|
||||||
def list_global_explorer_names(self):
|
def list_global_explorer_names(self):
|
||||||
"""Return a list of global explorer names."""
|
"""Return a list of global explorer names."""
|
||||||
return os.listdir(self.local.global_explorer_path)
|
return glob.glob1(self.local.global_explorer_path, '*')
|
||||||
|
|
||||||
def run_global_explorers(self, out_path):
|
def run_global_explorers(self, out_path):
|
||||||
"""Run global explorers and save output to files in the given
|
"""Run global explorers and save output to files in the given
|
||||||
|
@ -111,7 +112,7 @@ class Explorer(object):
|
||||||
"""Return a list of explorer names for the given type."""
|
"""Return a list of explorer names for the given type."""
|
||||||
source = os.path.join(self.local.type_path, cdist_type.explorer_path)
|
source = os.path.join(self.local.type_path, cdist_type.explorer_path)
|
||||||
try:
|
try:
|
||||||
return os.listdir(source)
|
return glob.glob1(source, '*')
|
||||||
except EnvironmentError:
|
except EnvironmentError:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
|
|
@ -9,8 +9,7 @@ Changelog
|
||||||
* Core: Allow hostnames to start with /
|
* Core: Allow hostnames to start with /
|
||||||
* Type __line: Remove unecessary backslash escape
|
* Type __line: Remove unecessary backslash escape
|
||||||
* Type __directory: Add messaging support (Daniel Heule)
|
* Type __directory: Add messaging support (Daniel Heule)
|
||||||
* Type __directory: Do not generate code if mode is 0xxx ((Daniel Heule)
|
* Type __directory: Do not generate code if mode is 0xxx (Daniel Heule)
|
||||||
* Type __directory: Add messaging support (Daniel Heule)
|
|
||||||
* Type __package: Fix typo in optional parameter ptype (Daniel Heule)
|
* Type __package: Fix typo in optional parameter ptype (Daniel Heule)
|
||||||
* Type __start_on_boot: Fix for SuSE's chkconfig (Daniel Heule)
|
* Type __start_on_boot: Fix for SuSE's chkconfig (Daniel Heule)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue