summaryrefslogtreecommitdiffstats
path: root/src/lib/Server/Admin
diff options
context:
space:
mode:
authorHolger Weiß <holger@zedat.fu-berlin.de>2011-06-06 16:32:53 +0200
committerHolger Weiß <holger@zedat.fu-berlin.de>2011-06-06 16:32:53 +0200
commit3914d14bec1cb7c0f6a600ea8d04ee0e6abc6550 (patch)
tree777d834b7b7a29e9d66904264a8756310444ab7b /src/lib/Server/Admin
parent701ff48cc9561ce88e80c1de5a19f8d6cda790bb (diff)
downloadbcfg2-3914d14bec1cb7c0f6a600ea8d04ee0e6abc6550.tar.gz
bcfg2-3914d14bec1cb7c0f6a600ea8d04ee0e6abc6550.tar.bz2
bcfg2-3914d14bec1cb7c0f6a600ea8d04ee0e6abc6550.zip
Accept non-ASCII diffs
Currently, client reports don't include diffs of files which aren't US-ASCII encoded. The client transmits such files as Base64 blobs. As we'd like to change that, this commit teaches the server to properly handle non-ASCII diffs.
Diffstat (limited to 'src/lib/Server/Admin')
-rw-r--r--src/lib/Server/Admin/Reports.py6
-rw-r--r--src/lib/Server/Admin/__init__.py5
2 files changed, 9 insertions, 2 deletions
diff --git a/src/lib/Server/Admin/Reports.py b/src/lib/Server/Admin/Reports.py
index 942477a49..c9f3d3f58 100644
--- a/src/lib/Server/Admin/Reports.py
+++ b/src/lib/Server/Admin/Reports.py
@@ -257,6 +257,11 @@ class Reports(Bcfg2.Server.Admin.Mode):
except (IOError, XMLSyntaxError):
self.errExit("StatReports: Failed to parse %s" % (stats_file))
+ try:
+ encoding = self.cfp.get('components', 'encoding')
+ except:
+ encoding = 'UTF-8'
+
if not clientspath:
try:
clientspath = "%s/Metadata/clients.xml" % \
@@ -271,6 +276,7 @@ class Reports(Bcfg2.Server.Admin.Mode):
try:
load_stats(clientsdata,
statsdata,
+ encoding,
verb,
self.log,
quick=quick,
diff --git a/src/lib/Server/Admin/__init__.py b/src/lib/Server/Admin/__init__.py
index 8915492a3..b34d7108c 100644
--- a/src/lib/Server/Admin/__init__.py
+++ b/src/lib/Server/Admin/__init__.py
@@ -113,7 +113,8 @@ class MetadataCore(Mode):
def __init__(self, configfile, usage, pwhitelist=None, pblacklist=None):
Mode.__init__(self, configfile)
options = {'plugins': Bcfg2.Options.SERVER_PLUGINS,
- 'configfile': Bcfg2.Options.CFILE}
+ 'configfile': Bcfg2.Options.CFILE,
+ 'encoding': Bcfg2.Options.ENCODING}
setup = Bcfg2.Options.OptionParser(options)
setup.hm = usage
setup.parse(sys.argv[1:])
@@ -126,7 +127,7 @@ class MetadataCore(Mode):
try:
self.bcore = Bcfg2.Server.Core.Core(self.get_repo_path(),
setup['plugins'],
- 'foo', 'UTF-8')
+ 'foo', setup['encoding'])
except Bcfg2.Server.Core.CoreInitError:
msg = sys.exc_info()[1]
self.errExit("Core load failed because %s" % msg)