diff options
author | Narayan Desai <desai@mcs.anl.gov> | 2008-03-24 04:32:25 +0000 |
---|---|---|
committer | Narayan Desai <desai@mcs.anl.gov> | 2008-03-24 04:32:25 +0000 |
commit | 0e90e442abe9657d0449daf6455c2f6f930a175b (patch) | |
tree | 20b4d21985d62391c708ff9e2d2c14e7214aa53f /src/lib/Server | |
parent | 9e31f1dd76c29d99fb5a16f0a2d6752cf5ead1c9 (diff) | |
download | bcfg2-0e90e442abe9657d0449daf6455c2f6f930a175b.tar.gz bcfg2-0e90e442abe9657d0449daf6455c2f6f930a175b.tar.bz2 bcfg2-0e90e442abe9657d0449daf6455c2f6f930a175b.zip |
Fix 0-length file handling
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@4447 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib/Server')
-rw-r--r-- | src/lib/Server/Plugins/Cfg.py | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/src/lib/Server/Plugins/Cfg.py b/src/lib/Server/Plugins/Cfg.py index f3e485517..291ee2c9f 100644 --- a/src/lib/Server/Plugins/Cfg.py +++ b/src/lib/Server/Plugins/Cfg.py @@ -44,18 +44,9 @@ class CfgEntry(object): return try: self.data = open(self.name).read() - self.usable = True except: logger.error("Failed to read file %s" % self.name) - def bind_entry(self, entry, _): - if entry.get('encoding') == 'base64': - entry.text = binascii.b2a_base64(self.data) - else: - entry.text = self.data - if not entry.text: - entry.set('empty', 'true') - class CfgMatcher: def __init__(self, fname): name = re.escape(fname) @@ -100,6 +91,8 @@ class CfgEntrySet(Bcfg2.Server.Plugin.EntrySet): entry.text = binascii.b2a_base64(data) else: entry.text = data + if entry.text in ['', None]: + entry.set('empty', 'true') def list_accept_choices(self, metadata): '''return a list of candidate pull locations''' |