diff --git a/bcfg2/plugins/Python.py b/bcfg2/plugins/Python.py index 0ffa2cde..a4ea4553 100644 --- a/bcfg2/plugins/Python.py +++ b/bcfg2/plugins/Python.py @@ -144,14 +144,15 @@ class Python(Bcfg2.Server.Plugin.Plugin): except Exception, e: log_traceback(fname, 'exec', e) raise Bcfg2.Server.Plugin.PluginExecutionError - if env["info"]['encoding'] == 'base64': + info = env["info"] + if info.get('encoding', 'base64') == 'base64': text = binascii.b2a_base64(text) entry.text = text debug(entry.text) - entry.attrib['owner'] = env["info"]['owner'] - entry.attrib['group'] = env["info"]['group'] - entry.attrib['perms'] = oct(env["info"]['perms']) - entry.attrib['encoding'] = env["info"]['encoding'] + entry.attrib['owner'] = info.get('owner', 'root') + entry.attrib['group'] = info.get('group', 'root') + entry.attrib['perms'] = oct(info.get('perms', 0644)) + entry.attrib['encoding'] = info.get('encoding', 'base64') def HandleEvent(self, event): '''Traitement des événements de FAM'''