[Pacemaker] CRM: 'ascii' codec can't encode character

Lars Ellenberg lars.ellenberg at linbit.com
Wed May 25 04:09:49 EDT 2011


On Wed, May 25, 2011 at 09:12:29AM +0200, Nikita Michalko wrote:
> Hi Dejan,
> 
> 
> thanks for your reply! Here is the output of the command :
> /usr/lib64/heartbeat/crmd version
> CRM Version: 1.1.5 (ecb6baaf7fc091b023d6d4ba7e0fce26d32cf5c8)
> And cib.xml is attached ...

There:
>         <nvpair id="op_defaults-options-timeout" name="timeout" value="6&#xDF;"/>

You got an "6ß" there (or at least that's what it looks like when
converted to utf8...)

Change that to 6s (or whatever you actually meant),
and the crm shell will work again.

Below patchlet makes the crm shell not crash on this for me.
But I'm not sure if hardcoding "utf8" is the best way forward,
probably it should be locale aware.
Possibly it needs to put a try execpt around that s.encode,
and chose a different representation, if it is not possible
to encode it in whatever the current locale is?


diff --git a/shell/modules/parse.py b/shell/modules/parse.py
--- a/shell/modules/parse.py
+++ b/shell/modules/parse.py
@@ -728,7 +728,7 @@ class CliParser(object):
         '''
         cli_list = ''
         if type(s) == type(u''):
-            s = s.encode('ascii')
+            s = s.encode('utf8')
         if type(s) == type(''):
             if s and s.startswith('#'):
                 self.comments.append(s)


-- 
: Lars Ellenberg
: LINBIT | Your Way to High Availability
: DRBD/HA support and consulting http://www.linbit.com

DRBD® and LINBIT® are registered trademarks of LINBIT, Austria.




More information about the Pacemaker mailing list