-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Christian Berendt <[email protected]>
- Loading branch information
Showing
4 changed files
with
73 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
from cliff.command import Command | ||
|
||
from osism.tasks import ansible | ||
|
||
|
||
class NoMaintenance(Command): | ||
def get_parser(self, prog_name): | ||
parser = super(NoMaintenance, self).get_parser(prog_name) | ||
parser.add_argument( | ||
"host", | ||
nargs=1, | ||
type=str, | ||
help="Host that should no longer be set to maintenance", | ||
) | ||
return parser | ||
|
||
def take_action(self, parsed_args): | ||
host = parsed_args.host[0] | ||
|
||
arguments = [ | ||
"-e status=False", | ||
"-l {host}", | ||
] | ||
|
||
ansible.run.delay( | ||
"state", | ||
"maintenance", | ||
arguments, | ||
publish=False, | ||
locking=False, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
from cliff.command import Command | ||
|
||
from osism.tasks import ansible | ||
|
||
|
||
class Maintenance(Command): | ||
def get_parser(self, prog_name): | ||
parser = super(Maintenance, self).get_parser(prog_name) | ||
parser.add_argument( | ||
"host", | ||
nargs=1, | ||
type=str, | ||
help="Host to be set to maintenance", | ||
) | ||
return parser | ||
|
||
def take_action(self, parsed_args): | ||
host = parsed_args.host[0] | ||
|
||
arguments = [ | ||
"-e status=True", | ||
"-l {host}", | ||
] | ||
|
||
ansible.run.delay( | ||
"state", | ||
"maintenance", | ||
arguments, | ||
publish=False, | ||
locking=False, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
features: | ||
- | | ||
With the new commands set/noset it is possible to set certain properties of nodes. | ||
First of all, it will be possible to put a node into maintenance. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters