Skip to content

Commit

Permalink
Move log (#635)
Browse files Browse the repository at this point in the history
Related to 1ea7f6f

Signed-off-by: Christian Berendt <[email protected]>
  • Loading branch information
berendt authored Oct 26, 2023
1 parent a60bf34 commit e1949c7
Showing 1 changed file with 37 additions and 28 deletions.
65 changes: 37 additions & 28 deletions osism/commands/apply.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,16 +184,26 @@ def handle_role(
environment, role[5:], arguments, auto_release_time=task_timeout
)
else:
t = ceph.run.delay(environment, role, arguments, auto_release_time=task_timeout)
t = ceph.run.delay(
environment, role, arguments, auto_release_time=task_timeout
)
elif role == "loadbalancer-ng":
if sub:
environment = f"{environment}.{sub}"
g = group(
kolla.run.si(environment, playbook, arguments, auto_release_time=task_timeout)
kolla.run.si(
environment, playbook, arguments, auto_release_time=task_timeout
)
for playbook in enums.LOADBALANCER_PLAYBOOKS
)
t = (
kolla.run.s(environment, "loadbalancer-ng", arguments, auto_release_time=task_timeout) | g
kolla.run.s(
environment,
"loadbalancer-ng",
arguments,
auto_release_time=task_timeout,
)
| g
).apply_async()
elif environment == "kolla":
if sub:
Expand All @@ -210,12 +220,22 @@ def handle_role(
else:
kolla_arguments = [f"-e kolla_action={action}"] + arguments

t = kolla.run.delay(environment, role, kolla_arguments, auto_release_time=task_timeout)
t = kolla.run.delay(
environment, role, kolla_arguments, auto_release_time=task_timeout
)
else:
# Overwrite the environment
if overwrite:
environment = overwrite
t = ansible.run.delay(environment, role, arguments, auto_release_time=task_timeout)

logger.info(
f"An attempt is made to execute a role that is provided in the configuration repository. "
f"If there is no further output following this output, the role {role} in the environment"
f" {environment} was not found."
)
t = ansible.run.delay(
environment, role, arguments, auto_release_time=task_timeout
)

if isinstance(t, GroupResult):
rc = self._handle_loadbalancer(t, wait, format, timeout)
Expand Down Expand Up @@ -264,28 +284,17 @@ def take_action(self, parsed_args):
if rc != 0:
break
else:
if not environment:
logger.error(
f"The role {role} is unknown. To use a role that is provied in the configuration repository,"
" the environment to be used must be explicitly specified with -e or --environment."
)
else:
logger.info(
f"An attempt is made to execute a role that is provided in the configuration repository. "
f"If there is no further output following this output, the role {role} in the environment"
f" {environment} was not found."
)
rc = self.handle_role(
arguments,
environment,
overwrite,
sub,
role,
action,
wait,
format,
timeout,
task_timeout,
)
rc = self.handle_role(
arguments,
environment,
overwrite,
sub,
role,
action,
wait,
format,
timeout,
task_timeout,
)

return rc

0 comments on commit e1949c7

Please sign in to comment.