Skip to content

Commit

Permalink
Fix & improve the set/noset maintenance command (#646)
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Berendt <[email protected]>
  • Loading branch information
berendt authored Oct 27, 2023
1 parent 3fb813f commit d7cb692
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 5 additions & 2 deletions osism/commands/noset.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# SPDX-License-Identifier: Apache-2.0

from cliff.command import Command
from loguru import logger

from osism.tasks import ansible

Expand All @@ -19,14 +20,16 @@ def get_parser(self, prog_name):
def take_action(self, parsed_args):
host = parsed_args.host[0]

logger.info(f"Set no maintenance state on host {host}")

arguments = [
"-e status=False",
"-l {host}",
]

ansible.run.delay(
"state",
"maintenance",
"generic",
"state-maintenance",
arguments,
publish=False,
locking=False,
Expand Down
7 changes: 5 additions & 2 deletions osism/commands/set.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# SPDX-License-Identifier: Apache-2.0

from cliff.command import Command
from loguru import logger

from osism.tasks import ansible

Expand All @@ -19,14 +20,16 @@ def get_parser(self, prog_name):
def take_action(self, parsed_args):
host = parsed_args.host[0]

logger.info(f"Set maintenance state on host {host}")

arguments = [
"-e status=True",
"-l {host}",
]

ansible.run.delay(
"state",
"maintenance",
"generic",
"state-maintenance",
arguments,
publish=False,
locking=False,
Expand Down

0 comments on commit d7cb692

Please sign in to comment.