summaryrefslogtreecommitdiffstats
path: root/src/lib/Bcfg2/Client/Tools/POSIX
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2013-04-05 11:30:02 -0400
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2013-04-05 11:42:24 -0400
commit9a10880166445bafcc80e8c89057e48876359e5a (patch)
tree48b4998ced40fd1fad0f863aee81e28439b4d2b9 /src/lib/Bcfg2/Client/Tools/POSIX
parentb92f31c2768850f67149b92514c10c881aeb6d56 (diff)
downloadbcfg2-9a10880166445bafcc80e8c89057e48876359e5a.tar.gz
bcfg2-9a10880166445bafcc80e8c89057e48876359e5a.tar.bz2
bcfg2-9a10880166445bafcc80e8c89057e48876359e5a.zip
File: handle Path type="file" entries with no text content even if empty is not set
Diffstat (limited to 'src/lib/Bcfg2/Client/Tools/POSIX')
-rw-r--r--src/lib/Bcfg2/Client/Tools/POSIX/File.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/lib/Bcfg2/Client/Tools/POSIX/File.py b/src/lib/Bcfg2/Client/Tools/POSIX/File.py
index 9b95d2234..168c35c98 100644
--- a/src/lib/Bcfg2/Client/Tools/POSIX/File.py
+++ b/src/lib/Bcfg2/Client/Tools/POSIX/File.py
@@ -34,13 +34,11 @@ class POSIXFile(POSIXTool):
def _get_data(self, entry):
""" Get a tuple of (<file data>, <is binary>) for the given entry """
- is_binary = False
- if entry.get('encoding', 'ascii') == 'base64':
- tempdata = b64decode(entry.text)
- is_binary = True
-
- elif entry.get('empty', 'false') == 'true':
+ is_binary = entry.get('encoding', 'ascii') == 'base64'
+ if entry.get('empty', 'false') == 'true' or not entry.text:
tempdata = ''
+ elif is_binary:
+ tempdata = b64decode(entry.text)
else:
tempdata = entry.text
if isinstance(tempdata, unicode) and unicode != str: