summaryrefslogtreecommitdiffstats
path: root/src/lib/Bcfg2/Server
diff options
context:
space:
mode:
authorSol Jerome <sol.jerome@gmail.com>2012-05-21 11:09:50 -0500
committerSol Jerome <sol.jerome@gmail.com>2012-05-21 11:10:41 -0500
commit64b86fda18be46990bc6d29dc2aa212f5066df99 (patch)
tree60ca04fc9865ceb6f889222c492867a968f28b5a /src/lib/Bcfg2/Server
parentd9721453baf9485f3660f648de085fe8f697b9a8 (diff)
downloadbcfg2-64b86fda18be46990bc6d29dc2aa212f5066df99.tar.gz
bcfg2-64b86fda18be46990bc6d29dc2aa212f5066df99.tar.bz2
bcfg2-64b86fda18be46990bc6d29dc2aa212f5066df99.zip
Packages: Unicode-objects must be encoded before hashing
Fixes a traceback in PY3K. Signed-off-by: Sol Jerome <sol.jerome@gmail.com>
Diffstat (limited to 'src/lib/Bcfg2/Server')
-rw-r--r--src/lib/Bcfg2/Server/Plugin.py5
-rw-r--r--src/lib/Bcfg2/Server/Plugins/Packages/Collection.py2
2 files changed, 6 insertions, 1 deletions
diff --git a/src/lib/Bcfg2/Server/Plugin.py b/src/lib/Bcfg2/Server/Plugin.py
index 90e39e52d..b668b7442 100644
--- a/src/lib/Bcfg2/Server/Plugin.py
+++ b/src/lib/Bcfg2/Server/Plugin.py
@@ -25,6 +25,11 @@ from Bcfg2.Bcfg2Py3k import Queue
from Bcfg2.Bcfg2Py3k import Empty
from Bcfg2.Bcfg2Py3k import Full
+# make encoding available
+encparse = Bcfg2.Options.OptionParser({'encoding': Bcfg2.Options.ENCODING})
+encparse.parse([])
+encoding = encparse['encoding']
+
# grab default metadata info from bcfg2.conf
opts = {'owner': Bcfg2.Options.MDATA_OWNER,
'group': Bcfg2.Options.MDATA_GROUP,
diff --git a/src/lib/Bcfg2/Server/Plugins/Packages/Collection.py b/src/lib/Bcfg2/Server/Plugins/Packages/Collection.py
index 3ea14ce75..b2155dfa9 100644
--- a/src/lib/Bcfg2/Server/Plugins/Packages/Collection.py
+++ b/src/lib/Bcfg2/Server/Plugins/Packages/Collection.py
@@ -52,7 +52,7 @@ class Collection(Bcfg2.Server.Plugin.Debuggable):
@property
def cachekey(self):
- return md5(self.get_config()).hexdigest()
+ return md5(self.get_config().encode(Bcfg2.Server.Plugin.encoding)).hexdigest()
def get_config(self):
self.logger.error("Packages: Cannot generate config for host with "