Add support for password assignation on customized images

Change-Id: I5014ab242ec5d1fef604a2c1c9a29648d5e4f5bd
This commit is contained in:
Federico Ressi 2021-09-16 09:16:57 +02:00
parent af377b71ac
commit 0845507019

View File

@ -431,6 +431,9 @@ class CustomizedGlanceImageFixture(URLGlanceImageFixture):
def write_files(self) -> typing.Dict[str, str]: def write_files(self) -> typing.Dict[str, str]:
return {} return {}
username: str = ''
password: str = ''
def customize_image_file(self, base_file: str) -> str: def customize_image_file(self, base_file: str) -> str:
customized_file = base_file + '.1' customized_file = base_file + '.1'
if os.path.isfile(customized_file): if os.path.isfile(customized_file):
@ -468,6 +471,11 @@ class CustomizedGlanceImageFixture(URLGlanceImageFixture):
if install_packages: if install_packages:
options += ['--install', ','.join(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 run_commands = self.run_commands
if run_commands: if run_commands:
for cmd in run_commands: for cmd in run_commands: