spacecmd configchannel_export fails when the channel contains a directory A patch below contains a fix.
Thanks, Trent >From 99ab7b5bbd3bb19195bbf78b574e023cbac19d78 Mon Sep 17 00:00:00 2001 From: tljohnsn <[email protected]> Date: Thu, 7 Mar 2013 08:39:05 -0600 Subject: [PATCH] Fix to allow configchannel_export to export a directory --- spacecmd/src/lib/configchannel.py | 21 ++++++++++++--------- 1 files changed, 12 insertions(+), 9 deletions(-) diff --git a/spacecmd/src/lib/configchannel.py b/spacecmd/src/lib/configchannel.py index e8bf556..37f6b16 100644 --- a/spacecmd/src/lib/configchannel.py +++ b/spacecmd/src/lib/configchannel.py @@ -861,16 +861,19 @@ def export_configchannel_getdetails(self, channel): # i.e binary or non-xml encodable ascii files can be exported as # base64 encoded if not f.has_key('contents'): - if not self.check_api_version('11.1'): - logging.warning("File %s could not be exported " % f['path'] +\ - "with this API version(needs base64 encoding)") + if f['type'] == 'directory': + f['contents'] = '' else: - logging.info("File %s could not be exported as" % f['path'] +\ - " text...getting base64 encoded version") - b64f = self.client.configchannel.getEncodedFileRevision(\ - self.session, channel, f['path'], f['revision']) - f['contents'] = b64f['contents'] - f['contents_enc64'] = b64f['contents_enc64'] + if not self.check_api_version('11.1'): + logging.warning("File %s could not be exported " % f['path'] +\ + "with this API version(needs base64 encoding)") + else: + logging.info("File %s could not be exported as" % f['path'] +\ + " text...getting base64 encoded version") + b64f = self.client.configchannel.getEncodedFileRevision(\ + self.session, channel, f['path'], f['revision']) + f['contents'] = b64f['contents'] + f['contents_enc64'] = b64f['contents_enc64'] for k in [ 'channel', 'revision', 'creation', 'modified', \ 'permissions_mode', 'binary', 'md5' ]: -- 1.7.1 _______________________________________________ Spacewalk-list mailing list [email protected] https://www.redhat.com/mailman/listinfo/spacewalk-list
