summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Fenn <fennm@deshawresearch.com>2013-06-28 23:56:30 -0400
committerMichael Fenn <fennm@deshawresearch.com>2013-06-28 23:56:30 -0400
commitab62481b597edcc099811039f7fd60743353d979 (patch)
tree21cc58e1f1ae1fdd70e7e4330969e9e07150bf87
parentb5d2421b907d89122b14341e9f00cf4ca8650622 (diff)
downloadbcfg2-ab62481b597edcc099811039f7fd60743353d979.tar.gz
bcfg2-ab62481b597edcc099811039f7fd60743353d979.tar.bz2
bcfg2-ab62481b597edcc099811039f7fd60743353d979.zip
Info: make builddir add owner write permissions to all files
Since bcfg2-info isn't normally run as root, it can remove write permissions from itself in certain situations. This patch ensures that owner write is added to the mode for all files written by builddir. For example, suppose a bundle specifies a file /etc/foo/private with mode 0444. The POSIX tool will create /etc/foo with mode 0555. Any subsequent files that are specified to exist in /etc/foo will not be created because bcfg2-info will hit a permission denied error.
-rwxr-xr-xsrc/sbin/bcfg2-info4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/sbin/bcfg2-info b/src/sbin/bcfg2-info
index 133e1ccb3..a8aad3730 100755
--- a/src/sbin/bcfg2-info
+++ b/src/sbin/bcfg2-info
@@ -10,6 +10,7 @@ import fnmatch
import logging
import lxml.etree
import traceback
+import stat
from code import InteractiveConsole
import Bcfg2.Logger
import Bcfg2.Options
@@ -280,6 +281,9 @@ Bcfg2 client itself.""")
for entry in struct:
if entry.tag == 'Path':
entry.set('name', odir + '/' + entry.get('name'))
+ if entry.get('mode') != None:
+ entry.set('mode', \
+ oct(int(entry.get('mode'), 8)|stat.S_IWUSR))
posix = Bcfg2.Client.Tools.POSIX.POSIX(MockLog(),
self.setup,