summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSol Jerome <solj@ices.utexas.edu>2009-08-17 16:49:01 +0000
committerSol Jerome <solj@ices.utexas.edu>2009-08-17 16:49:01 +0000
commitf940deb8419060c6a5685ad460efa232ba1a8aad (patch)
tree29241ff69a1f17c13255caa880e2b48e49d494f9 /src
parentc67127c535369382a1046784b599859afb7b3df2 (diff)
downloadbcfg2-f940deb8419060c6a5685ad460efa232ba1a8aad.tar.gz
bcfg2-f940deb8419060c6a5685ad460efa232ba1a8aad.tar.bz2
bcfg2-f940deb8419060c6a5685ad460efa232ba1a8aad.zip
POSIX: Fix traceback with ConfigFile encoding errors (Ticket #705)
Signed-off-by: Sol Jerome <solj@ices.utexas.edu> git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@5410 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src')
-rw-r--r--src/lib/Client/Tools/POSIX.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/lib/Client/Tools/POSIX.py b/src/lib/Client/Tools/POSIX.py
index 8576f49fa..55e83d822 100644
--- a/src/lib/Client/Tools/POSIX.py
+++ b/src/lib/Client/Tools/POSIX.py
@@ -357,7 +357,12 @@ class POSIX(Bcfg2.Client.Tools.Tool):
return False
tempdata = entry.text
if type(tempdata) == unicode:
- tempdata = tempdata.encode(self.setup['encoding'])
+ try:
+ tempdata = tempdata.encode(self.setup['encoding'])
+ except UnicodeEncodeError, e:
+ self.logger.error("Error encoding file %s:\n %s" % \
+ (entry.get('name'), e))
+ return False
try:
content = open(entry.get('name')).read()
except IOError, error: