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

Dejan Muhamedagic dejanmm at fastmail.fm
Wed May 25 09:14:44 UTC 2011


Hi Lars,

On Wed, May 25, 2011 at 10:09:49AM +0200, Lars Ellenberg wrote:
> 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.

Thanks for looking into this.

> 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.

Yes, it really should. At least comments and some description
fields should be able to contain the locale specific encoding. At
the time I had a problem with the python lexer, though I can't
recall anymore what it exactly was, I think that it was not
capable of dealing with non-ascii stuff. But perhaps I was just
misusing it. Need to investigate this further.

> 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?

Yep, a good idea.

Cheers,

Dejan

> 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.
> 
> _______________________________________________
> Pacemaker mailing list: Pacemaker at oss.clusterlabs.org
> http://oss.clusterlabs.org/mailman/listinfo/pacemaker
> 
> Project Home: http://www.clusterlabs.org
> Getting started: http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf
> Bugs: http://developerbugs.linux-foundation.org/enter_bug.cgi?product=Pacemaker




More information about the Pacemaker mailing list