Commit 9a248220 authored by Jeremie Dimino's avatar Jeremie Dimino

encodage en base64

parent 74bd5d7b
......@@ -24,7 +24,7 @@ script python'''
__all__ = ["Python"]
import logging, lxml.etree, posixpath, re, os, sys
import logging, lxml.etree, posixpath, re, os, sys, binascii
from cStringIO import StringIO
import Bcfg2.Server.Plugin
import traceback
......@@ -135,18 +135,23 @@ class Python(Bcfg2.Server.Plugin.Plugin):
env["dump"] = lambda incfile: dump(env, incfile)
env["info"] = { 'owner': 'root',
'group': 'root',
'perms': 0644 }
'perms': 0644,
'encoding': 'base64' }
env.included = set([])
include(env, "common")
entry.text = pygen.generate(code, env).decode("UTF-8")
text = pygen.generate(code, env)
except Exception, e:
log_traceback(fname, 'exec', e)
raise Bcfg2.Server.Plugin.PluginExecutionError
if env["info"]['encoding'] == 'base64':
text = binascii.b2a_base64(text)
entry.text = 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']
def HandleEvent(self, event):
'''Traitement des événements de FAM'''
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment