check if there is conditions for the creation or not and added support for running multiples commands at once
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Mathieu Broillet 2023-06-20 10:25:02 +02:00
parent e6dd3d81ce
commit a659323779
No known key found for this signature in database
GPG Key ID: 7D4F25BC50A0AA32
2 changed files with 13 additions and 5 deletions

View File

@ -44,14 +44,15 @@ def are_all_conditions_met(lxc: LXC):
# result.append(lxc.run_command("which " + program, return_status_code=True) == 0)
creation = lxc.get_creation()
global_conditions = creation["conditions"]
steps = creation["steps"]
result = []
# Check the global conditions
for condition_type in global_conditions:
result = check_conditions(c_type=condition_type, parent=global_conditions, lxc=lxc, result=result)
if 'conditions' in creation:
global_conditions = creation["conditions"]
# Check the global conditions
for condition_type in global_conditions:
result = check_conditions(c_type=condition_type, parent=global_conditions, lxc=lxc, result=result)
# Check the specific conditions for each step
for step in steps:

View File

@ -386,6 +386,13 @@ class LXC(LinuxMachine):
# logging.debug(f"Running command {command} on LXC {self.lxc_id}")
if type(command) == list:
for cmd in command:
self.run_command(command=cmd, return_status_code=return_status_code,
exception_on_exit=exception_on_exit,
exception_on_empty_stdout=exception_on_empty_stdout,
working_directory=working_directory, use_ssh=use_ssh)
if working_directory:
command = f"cd {working_directory} && {command}"