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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list




[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux