summaryrefslogtreecommitdiffstats
path: root/src/lib/Bcfg2/Client/Tools
diff options
context:
space:
mode:
authorMichael Fenn <fennm@deshawresearch.com>2013-07-24 20:26:53 -0400
committerMichael Fenn <fennm@deshawresearch.com>2013-07-24 20:26:53 -0400
commitc3ff6611b640e11ab0d4986b64015355b516fa88 (patch)
tree9d0e93b4e2017b0efeab11ed5b25fdcbc895f355 /src/lib/Bcfg2/Client/Tools
parent1c86a3668d017bcaeda602cbc5c5bee84d701647 (diff)
downloadbcfg2-c3ff6611b640e11ab0d4986b64015355b516fa88.tar.gz
bcfg2-c3ff6611b640e11ab0d4986b64015355b516fa88.tar.bz2
bcfg2-c3ff6611b640e11ab0d4986b64015355b516fa88.zip
POSIX: Ignore permissions error on auto-created dirs
If the POSIX client tool is run as a non-root user, it is very likely that the _set_perms() call in _makedirs() will fail because it cannot set the owner of the newly-created directories. This causes _makedirs() to return False, which in turn causes POSIXFile.install() to bail out early. Applying the reasoning in <https://github.com/Bcfg2/bcfg2/pull/108> the freebie directories created by _makedirs should have mode and ownership done on a best-effort basis. If a user needs parent directories to have a specific ownership and mode, then they should specify that directory in their configuration.
Diffstat (limited to 'src/lib/Bcfg2/Client/Tools')
-rw-r--r--src/lib/Bcfg2/Client/Tools/POSIX/base.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/lib/Bcfg2/Client/Tools/POSIX/base.py b/src/lib/Bcfg2/Client/Tools/POSIX/base.py
index 3778569a6..fb5d06e54 100644
--- a/src/lib/Bcfg2/Client/Tools/POSIX/base.py
+++ b/src/lib/Bcfg2/Client/Tools/POSIX/base.py
@@ -686,7 +686,7 @@ class POSIXTool(Bcfg2.Client.Tools.Tool):
""" os.makedirs helpfully creates all parent directories for
us, but it sets permissions according to umask, which is
probably wrong. we need to find out which directories were
- created and set permissions on those
+ created and try to set permissions on those
(http://trac.mcs.anl.gov/projects/bcfg2/ticket/1125 and
http://trac.mcs.anl.gov/projects/bcfg2/ticket/1134) """
created = []
@@ -706,8 +706,9 @@ class POSIXTool(Bcfg2.Client.Tools.Tool):
(path, err))
rv = False
- # set auto-created directories to mode 755, if you need
- # something else, you should specify it in your config
+ # set auto-created directories to mode 755 and use best effort for
+ # permissions. If you need something else, you should specify it in
+ # your config.
tmpentry = copy.deepcopy(entry)
tmpentry.set('mode', '0755')
for acl in tmpentry.findall('ACL'):
@@ -715,7 +716,7 @@ class POSIXTool(Bcfg2.Client.Tools.Tool):
oct_mode(self._norm_acl_perms(acl.get('perms')) |
ACL_MAP['x']))
for cpath in created:
- rv &= self._set_perms(tmpentry, path=cpath)
+ self._set_perms(tmpentry, path=cpath)
return rv