summaryrefslogtreecommitdiffstats
path: root/src/lib/Client/Toolset.py
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2006-05-15 20:07:32 +0000
committerNarayan Desai <desai@mcs.anl.gov>2006-05-15 20:07:32 +0000
commit1ef1dfeb7203242ffcc2ef4c27ed0e34f46337f7 (patch)
tree974192df32fdc56b8c4d701fd49962d937267c52 /src/lib/Client/Toolset.py
parentbef0233dacbdd6f63b08695e7622d40ab375ae04 (diff)
downloadbcfg2-1ef1dfeb7203242ffcc2ef4c27ed0e34f46337f7.tar.gz
bcfg2-1ef1dfeb7203242ffcc2ef4c27ed0e34f46337f7.tar.bz2
bcfg2-1ef1dfeb7203242ffcc2ef4c27ed0e34f46337f7.zip
Add support for empty files
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@1864 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib/Client/Toolset.py')
-rw-r--r--src/lib/Client/Toolset.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/lib/Client/Toolset.py b/src/lib/Client/Toolset.py
index fd8e01604..ceae8dda7 100644
--- a/src/lib/Client/Toolset.py
+++ b/src/lib/Client/Toolset.py
@@ -366,6 +366,8 @@ class Toolset(object):
perms = os.stat(filename)[ST_MODE]
if entry.get('encoding', 'ascii') == 'base64':
tempdata = binascii.a2b_base64(entry.text)
+ elif entry.get('empty', 'false') == 'true':
+ tempdata = ''
else:
tempdata = entry.text
@@ -383,7 +385,7 @@ class Toolset(object):
def InstallConfigFile(self, entry):
'''Install ConfigFile Entry'''
- if entry.text == None:
+ if entry.text == None and entry.get('empty', 'false') != 'true':
self.logger.error(
"Incomplete information for ConfigFile %s. Cannot install" % (entry.get('name')))
return False
@@ -418,6 +420,8 @@ class Toolset(object):
newfile = open("%s.new"%(entry.get('name')), 'w')
if entry.get('encoding', 'ascii') == 'base64':
filedata = binascii.a2b_base64(entry.text)
+ elif entry.get('empty', 'false') == 'true':
+ filedata = ''
else:
filedata = entry.text
newfile.write(filedata)