[virt-tools-list] [virt-bootstrap] [PATCH 2/9] sources: Use default values of arguments

Cedric Bosdonnat cbosdonnat at suse.com
Mon Jul 31 07:29:47 UTC 2017


On Fri, 2017-07-28 at 10:21 +0100, Radostin Stoyanov wrote:
> ---
>  src/virtBootstrap/sources.py | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/src/virtBootstrap/sources.py b/src/virtBootstrap/sources.py
> index c44b2ed..f4bae72 100644
> --- a/src/virtBootstrap/sources.py
> +++ b/src/virtBootstrap/sources.py
> @@ -48,7 +48,7 @@ class FileSource(object):
>          @param progress: Instance of the progress module
>          """
>          self.path = kwargs['uri'].path
> -        self.output_format = kwargs['fmt']
> +        self.output_format = kwargs.get('fmt', utils.DEFAULT_OUTPUT_FORMAT)
>          self.progress = kwargs['progress'].update_progress
>  
>      def unpack(self, dest):
> @@ -103,11 +103,11 @@ class DockerSource(object):
>          """
>  
>          self.url = self.gen_valid_uri(kwargs['uri'])
> -        self.username = kwargs['username']
> -        self.password = kwargs['password']
> -        self.output_format = kwargs['fmt']
> -        self.insecure = kwargs['not_secure']
> -        self.no_cache = kwargs['no_cache']
> +        self.username = kwargs.get('username', None)
> +        self.password = kwargs.get('password', None)
> +        self.output_format = kwargs.get('fmt', utils.DEFAULT_OUTPUT_FORMAT)
> +        self.insecure = kwargs.get('not_secure', False)
> +        self.no_cache = kwargs.get('no_cache', False)
>          self.progress = kwargs['progress'].update_progress
>          self.images_dir = utils.get_image_dir(self.no_cache)
>          self.manifest = None

ACK

--
Cedric




More information about the virt-tools-list mailing list