From 0845507019831e43af8b28e17a1bb9583dab0b3b Mon Sep 17 00:00:00 2001 From: Federico Ressi Date: Thu, 16 Sep 2021 09:16:57 +0200 Subject: [PATCH] Add support for password assignation on customized images Change-Id: I5014ab242ec5d1fef604a2c1c9a29648d5e4f5bd --- tobiko/openstack/glance/_image.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tobiko/openstack/glance/_image.py b/tobiko/openstack/glance/_image.py index 257de7c9a..9c49a398b 100644 --- a/tobiko/openstack/glance/_image.py +++ b/tobiko/openstack/glance/_image.py @@ -431,6 +431,9 @@ class CustomizedGlanceImageFixture(URLGlanceImageFixture): def write_files(self) -> typing.Dict[str, str]: return {} + username: str = '' + password: str = '' + def customize_image_file(self, base_file: str) -> str: customized_file = base_file + '.1' if os.path.isfile(customized_file): @@ -468,6 +471,11 @@ class CustomizedGlanceImageFixture(URLGlanceImageFixture): if install_packages: options += ['--install', ','.join(install_packages)] + username = self.username + password = self.password + if username and password: + options += f'--password "{username}:password:{password}"' + run_commands = self.run_commands if run_commands: for cmd in run_commands: