encodage en base64
darcs-hash:20080209030132-af139-279e2d54c973bcef4899128a1f3e22657c60c99b.gz
This commit is contained in:
parent
74bd5d7b45
commit
9a24822056
1 changed files with 9 additions and 4 deletions
|
@ -24,7 +24,7 @@ script python'''
|
||||||
|
|
||||||
__all__ = ["Python"]
|
__all__ = ["Python"]
|
||||||
|
|
||||||
import logging, lxml.etree, posixpath, re, os, sys
|
import logging, lxml.etree, posixpath, re, os, sys, binascii
|
||||||
from cStringIO import StringIO
|
from cStringIO import StringIO
|
||||||
import Bcfg2.Server.Plugin
|
import Bcfg2.Server.Plugin
|
||||||
import traceback
|
import traceback
|
||||||
|
@ -135,18 +135,23 @@ class Python(Bcfg2.Server.Plugin.Plugin):
|
||||||
env["dump"] = lambda incfile: dump(env, incfile)
|
env["dump"] = lambda incfile: dump(env, incfile)
|
||||||
env["info"] = { 'owner': 'root',
|
env["info"] = { 'owner': 'root',
|
||||||
'group': 'root',
|
'group': 'root',
|
||||||
'perms': 0644 }
|
'perms': 0644,
|
||||||
|
'encoding': 'base64' }
|
||||||
env.included = set([])
|
env.included = set([])
|
||||||
try:
|
try:
|
||||||
include(env, "common")
|
include(env, "common")
|
||||||
entry.text = pygen.generate(code, env).decode("UTF-8")
|
text = pygen.generate(code, env)
|
||||||
debug(entry.text)
|
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
log_traceback(fname, 'exec', e)
|
log_traceback(fname, 'exec', e)
|
||||||
raise Bcfg2.Server.Plugin.PluginExecutionError
|
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['owner'] = env["info"]['owner']
|
||||||
entry.attrib['group'] = env["info"]['group']
|
entry.attrib['group'] = env["info"]['group']
|
||||||
entry.attrib['perms'] = oct(env["info"]['perms'])
|
entry.attrib['perms'] = oct(env["info"]['perms'])
|
||||||
|
entry.attrib['encoding'] = env["info"]['encoding']
|
||||||
|
|
||||||
def HandleEvent(self, event):
|
def HandleEvent(self, event):
|
||||||
'''Traitement des événements de FAM'''
|
'''Traitement des événements de FAM'''
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue