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

encodage en base64

darcs-hash:20080209030132-af139-279e2d54c973bcef4899128a1f3e22657c60c99b.gz
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([])
try:
include(env, "common")
entry.text = pygen.generate(code, env).decode("UTF-8")
debug(entry.text)
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
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']
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