[Spacewalk-list] 1.9 and Unicode

Ciro Iriarte cyruspy at gmail.com
Mon Apr 29 15:29:47 UTC 2013


I'll test it as soon as I get to the office and report back!.

Regards,
CI.-

2013/4/29 Jan Pazdziora <jpazdziora at redhat.com>:
> On Mon, Apr 29, 2013 at 04:38:16PM +0200, Jan Pazdziora wrote:
>> On Mon, Apr 29, 2013 at 04:21:20PM +0200, Jan Pazdziora wrote:
>> > On Sun, Apr 28, 2013 at 05:47:28PM -0400, Ciro Iriarte wrote:
>> > > Hi!, I've succesfully installed Spacewalk 1.8 in the past, but for a
>> > > new installation of 1.9 I'm seeing an error that seems related to
>> > > Unicode.
>> > >
>> > >
>> > > I get this trying to add a client with:
>> > >
>> > > --
>> > > rhnreg_ks --serverUrl=http://server/XMLRPC --activationkey=1-centos6
>> > > --
>> > >
>> > > ---
>> > > [Sun Apr 28 17:42:46 2013] [error] [client 10.1.20.201] mod_wsgi (pid=2474): Exception occurred processing WSGI script '/usr/share/rhn/wsgi/xmlrpc.py'.
>> > > [Sun Apr 28 17:42:46 2013] [error] [client 10.1.20.201] Traceback (most recent call last):
>> > > [Sun Apr 28 17:42:46 2013] [error] [client 10.1.20.201]   File "/usr/share/rhn/wsgi/xmlrpc.py", line 22, in application
>> > > [Sun Apr 28 17:42:46 2013] [error] [client 10.1.20.201]     return wsgiHandler.handle(environ, start_response, "xmlrpc", "server.xmlrpc")
>> > > [Sun Apr 28 17:42:46 2013] [error] [client 10.1.20.201]   File "/usr/share/rhn/wsgi/wsgiHandler.py", line 45, in handle
>> > > [Sun Apr 28 17:42:46 2013] [error] [client 10.1.20.201]     ret = appServ(req)
>> > > [Sun Apr 28 17:42:46 2013] [error] [client 10.1.20.201]   File "/usr/lib/python2.6/site-packages/spacewalk/server/apacheHandler.py", line 196, in handler
>> > > [Sun Apr 28 17:42:46 2013] [error] [client 10.1.20.201]     ret = self._req_processor.process()
>> > > [Sun Apr 28 17:42:46 2013] [error] [client 10.1.20.201]   File "/usr/lib/python2.6/site-packages/spacewalk/server/apacheRequest.py", line 476, in process
>> > > [Sun Apr 28 17:42:46 2013] [error] [client 10.1.20.201]     return self.call_function(method, params)
>> > > [Sun Apr 28 17:42:46 2013] [error] [client 10.1.20.201]   File "/usr/lib/python2.6/site-packages/spacewalk/server/apacheRequest.py", line 174, in call_function
>> > > [Sun Apr 28 17:42:46 2013] [error] [client 10.1.20.201] Traceback(method, self.req, severity="unhandled")
>> > > [Sun Apr 28 17:42:46 2013] [error] [client 10.1.20.201]   File "/usr/lib/python2.6/site-packages/spacewalk/common/rhnTB.py", line 150, in Traceback
>> > > [Sun Apr 28 17:42:46 2013] [error] [client 10.1.20.201] ostream.write("%s\\n" % exc.getvalue().encode('utf-8'))
>> > > [Sun Apr 28 17:42:46 2013] [error] [client 10.1.20.201]   File "/usr/lib64/python2.6/StringIO.py", line 270, in getvalue
>> > > [Sun Apr 28 17:42:46 2013] [error] [client 10.1.20.201]     self.buf += ''.join(self.buflist)
>> > > [Sun Apr 28 17:42:46 2013] [error] [client 10.1.20.201] UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 48: ordinal not in range(128)
>> > >
>> >
>> > If you run that rhnreg_ks with a --nohardware or --nopackages option
>> > -- does the error go away?
>>
>> If you apply the following patch to your
>> /usr/lib/python2.6/site-packages/spacewalk/common/rhnTB.py
>> and restart httpd -- does it address the issue for you?
>>
>> diff --git a/backend/common/rhnTB.py b/backend/common/rhnTB.py
>> index 7c0d5e7..6868d6e 100644
>> --- a/backend/common/rhnTB.py
>> +++ b/backend/common/rhnTB.py
>> @@ -147,7 +147,11 @@ def Traceback(method = None, req = None, mail = 1, ostream = sys.stderr,
>>
>>      # we always log it somewhere
>>      if ostream:
>> -        ostream.write("%s\n" % exc.getvalue().encode('utf-8'))
>> +        the_value = exc.getvalue()
>> +        if isinstance(the_value):
>> +            ostream.write("%s\n" % exc.getvalue().encode('utf-8'))
>> +        else:
>> +            ostream.write("%s\n" % exc.getvalue())
>>
>>      if mail:
>>          # print the stack frames for the mail we send out
>
> Oops, the correct patch to try would be:
>
> diff --git a/backend/common/rhnTB.py b/backend/common/rhnTB.py
> index 7c0d5e7..d891ab0 100644
> --- a/backend/common/rhnTB.py
> +++ b/backend/common/rhnTB.py
> @@ -147,7 +147,11 @@ def Traceback(method = None, req = None, mail = 1, ostream = sys.stderr,
>
>      # we always log it somewhere
>      if ostream:
> -        ostream.write("%s\n" % exc.getvalue().encode('utf-8'))
> +        the_value = exc.getvalue()
> +        if isinstance(the_value, unicode):
> +            ostream.write("%s\n" % exc.getvalue().encode('utf-8'))
> +        else:
> +            ostream.write("%s\n" % exc.getvalue())
>
>      if mail:
>          # print the stack frames for the mail we send out
>
> --
> Jan Pazdziora
> Principal Software Engineer, Satellite Engineering, Red Hat
>
> _______________________________________________
> Spacewalk-list mailing list
> Spacewalk-list at redhat.com
> https://www.redhat.com/mailman/listinfo/spacewalk-list



-- 
Ciro Iriarte
http://cyruspy.wordpress.com
--




More information about the Spacewalk-list mailing list