[Spacewalk-list] spacecmd configchannel_export fails with directories

Aron Parsons aronparsons at gmail.com
Thu Mar 14 00:24:22 UTC 2013


Commit eff786033cf57aad3465770e2eefec8e9b816b57.  Thanks Trent.

/aron


Date: Thu, 7 Mar 2013 08:50:59 -0600
> From: Trent Johnson <tljohnsn at oreilly.com>
> To: spacewalk-list at redhat.com
> Subject: [Spacewalk-list] spacecmd configchannel_export fails with
>         directories
> Message-ID: <1067B3C8-EA2E-40AB-880F-2608A5FBD2B4 at oreilly.com>
> Content-Type: text/plain; charset=us-ascii
>
> 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 <tljohnsn at oreilly.com>
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/spacewalk-list/attachments/20130313/72196331/attachment.htm>


More information about the Spacewalk-list mailing list