[libvirt] [jenkins-ci PATCH v2 07/12] lcitool: Implement the 'update' action

Katerina Koukiou kkoukiou at redhat.com
Tue Jul 17 12:57:30 UTC 2018


On Thu, Jul 12, 2018 at 05:19:24PM +0200, Andrea Bolognani wrote:
> The 'prepare' alias was kinda redundant and offered
> dubious value, so it has been dropped.
> 
> Signed-off-by: Andrea Bolognani <abologna at redhat.com>
> ---
>  guests/lcitool | 30 ++++++++++++++++++++++++++++++
>  1 file changed, 30 insertions(+)
> 
> diff --git a/guests/lcitool b/guests/lcitool
> index 486f82f..d82c36f 100755
> --- a/guests/lcitool
> +++ b/guests/lcitool
> @@ -246,6 +246,7 @@ class Application:
>              epilog = textwrap.dedent("""
>                  common actions:
>                    install  perform unattended host installation
> +                  update   prepare hosts and keep them updated
>  
>                  informational actions:
>                    hosts  list all known hosts
> @@ -327,6 +328,35 @@ class Application:
>              except:
>                  raise Error("Failed to install '{}'".format(host))
>  
> +    def _action_update(self, hosts):
> +        flavor = self._config.get_flavor()
> +        vault_pass_file = self._config.get_vault_password_file()
> +        root_pass_file = self._config.get_root_password_file()
> +
> +        ansible_hosts = ",".join(self._inventory.expand_pattern(hosts))
> +
> +        extra_vars = "flavor={} root_password_file={}".format(
> +            flavor,
> +            root_pass_file,
> +        )
> +
> +        cmd = [ "ansible-playbook" ]

IMO this requirement should be as well in python requirements file.
In this way you can also specify which ansible version is expected for the
site.yaml playbook to run.

> +
> +        # Provide the vault password if available
> +        if vault_pass_file is not None:
> +            cmd += [ "--vault-password-file", vault_pass_file ]
> +
> +        cmd += [
> +            "--limit", ansible_hosts,
> +            "--extra-vars", extra_vars,
> +            "./site.yml",
> +        ]
> +
> +        try:
> +            subprocess.check_call(cmd)
> +        except:
> +            raise Error("Failed to update '{}'".format(hosts))
> +
>      def run(self):
>          cmdline = self._parser.parse_args()
>          action = cmdline.a
> -- 
> 2.17.1
> 
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20180717/12987db9/attachment-0001.sig>


More information about the libvir-list mailing list