File tree Expand file tree Collapse file tree 4 files changed +73
-0
lines changed
Expand file tree Collapse file tree 4 files changed +73
-0
lines changed Original file line number Diff line number Diff line change 1+ # SPDX-License-Identifier: Apache-2.0
2+
3+ from cliff .command import Command
4+
5+ from osism .tasks import ansible
6+
7+
8+ class NoMaintenance (Command ):
9+ def get_parser (self , prog_name ):
10+ parser = super (NoMaintenance , self ).get_parser (prog_name )
11+ parser .add_argument (
12+ "host" ,
13+ nargs = 1 ,
14+ type = str ,
15+ help = "Host that should no longer be set to maintenance" ,
16+ )
17+ return parser
18+
19+ def take_action (self , parsed_args ):
20+ host = parsed_args .host [0 ]
21+
22+ arguments = [
23+ "-e status=False" ,
24+ "-l {host}" ,
25+ ]
26+
27+ ansible .run .delay (
28+ "state" ,
29+ "maintenance" ,
30+ arguments ,
31+ publish = False ,
32+ locking = False ,
33+ )
Original file line number Diff line number Diff line change 1+ # SPDX-License-Identifier: Apache-2.0
2+
3+ from cliff .command import Command
4+
5+ from osism .tasks import ansible
6+
7+
8+ class Maintenance (Command ):
9+ def get_parser (self , prog_name ):
10+ parser = super (Maintenance , self ).get_parser (prog_name )
11+ parser .add_argument (
12+ "host" ,
13+ nargs = 1 ,
14+ type = str ,
15+ help = "Host to be set to maintenance" ,
16+ )
17+ return parser
18+
19+ def take_action (self , parsed_args ):
20+ host = parsed_args .host [0 ]
21+
22+ arguments = [
23+ "-e status=True" ,
24+ "-l {host}" ,
25+ ]
26+
27+ ansible .run .delay (
28+ "state" ,
29+ "maintenance" ,
30+ arguments ,
31+ publish = False ,
32+ locking = False ,
33+ )
Original file line number Diff line number Diff line change 1+ ---
2+ features :
3+ - |
4+ With the new commands set/noset it is possible to set certain properties of nodes.
5+ First of all, it will be possible to put a node into maintenance.
Original file line number Diff line number Diff line change @@ -77,9 +77,11 @@ osism.commands:
7777 netbox sync = osism.commands.netbox:Sync
7878 netbox sync bifrost = osism.commands.netbox:Bifrost
7979 netbox sync ironic = osism.commands.netbox:Ironic
80+ noset maintenance = osism.commands.noset:NoMaintenance
8081 reconciler = osism.commands.reconciler:Run
8182 reconciler sync = osism.commands.reconciler:Sync
8283 service = osism.commands.service:Run
84+ set maintenance = osism.commands.set:Maintenance
8385 status = osism.commands.status:Run
8486 task list = osism.commands.get:Tasks
8587 task revoke = osism.commands.task:Revoke
You can’t perform that action at this time.
0 commit comments