Hello! Attached is a small patch which fixes spacecmd handling when Red Hat Satellite (5.5) occasionally chooses to return Base64 encoded data. There probably are more places where the Satellite can opt to return Base64 encoded data, it would be good to grep through the API docs and add the necessary support to spacecmd.
I also got an error output ERROR: 'ascii' codec can't encode character u'\xe5' in position 392: ordinal not in range(128) and then the list of results (from schedule_getoutput) got truncated. The problem got solved by encoding the output as UTF-8 (inspiration gathered from do_kickstart_getcontent in kickstart.py) though I'm not quite quite sure why this encoding is necessary since the xmlrpclib manual states that the encoding by default is UTF-8 already. And on the other hand, if this statement really is necessary, it would be good if it was possible to somewhere set the "default" encoding to UTF-8 so that each and every print statement doesn't have to be modified. But that is where my feeble python-skills end, so maybe someone else have any ideas (-: -- David Juran Sr. Consultant Red Hat +46-725-345801
diff --git a/spacecmd/src/lib/schedule.py b/spacecmd/src/lib/schedule.py index f193dd8..0abc20f 100644 --- a/spacecmd/src/lib/schedule.py +++ b/spacecmd/src/lib/schedule.py @@ -20,6 +20,7 @@ # NOTE: the 'self' variable is an instance of SpacewalkShell +import base64 from operator import itemgetter from spacecmd.utils import * @@ -316,7 +317,11 @@ def do_schedule_getoutput(self, args): print print 'Output' print '------' - print r.get('output') + if r.get('output_enc64'): + base64.b64decode(r.get('output')) + else: + print r.get('output').encode('UTF8') + else: completed = self.client.schedule.listCompletedSystems(self.session, action_id)
_______________________________________________ Spacewalk-list mailing list Spacewalk-list@redhat.com https://www.redhat.com/mailman/listinfo/spacewalk-list