Skip to content

Commit

Permalink
Add set/noset bootstrap command (#648)
Browse files Browse the repository at this point in the history
Closes osism/issues#616

Signed-off-by: Christian Berendt <[email protected]>
  • Loading branch information
berendt authored Oct 28, 2023
1 parent 5a16bb6 commit 0d06a8f
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 0 deletions.
28 changes: 28 additions & 0 deletions osism/commands/noset.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,31 @@ def take_action(self, parsed_args):
"state-maintenance",
arguments,
)


class NoBootstrap(Command):
def get_parser(self, prog_name):
parser = super(NoBootstrap, self).get_parser(prog_name)
parser.add_argument(
"host",
nargs=1,
type=str,
help="Host that should no longer be set to bootstrapped",
)
return parser

def take_action(self, parsed_args):
host = parsed_args.host[0]

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

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

ansible.run.delay(
"generic",
"state-bootstrap",
arguments,
)
28 changes: 28 additions & 0 deletions osism/commands/set.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,31 @@ def take_action(self, parsed_args):
"state-maintenance",
arguments,
)


class Bootstrap(Command):
def get_parser(self, prog_name):
parser = super(Bootstrap, self).get_parser(prog_name)
parser.add_argument(
"host",
nargs=1,
type=str,
help="Host to be set to bootstrapped",
)
return parser

def take_action(self, parsed_args):
host = parsed_args.host[0]

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

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

ansible.run.delay(
"generic",
"state-bootstrap",
arguments,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
features:
- |
With the new commands set/noset bootstrap it is possible to set if
a node is bootstrapped or not.
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,12 @@ osism.commands:
netbox sync = osism.commands.netbox:Sync
netbox sync bifrost = osism.commands.netbox:Bifrost
netbox sync ironic = osism.commands.netbox:Ironic
noset bootstrap = osism.commands.noset:NoBootstrap
noset maintenance = osism.commands.noset:NoMaintenance
reconciler = osism.commands.reconciler:Run
reconciler sync = osism.commands.reconciler:Sync
service = osism.commands.service:Run
set bootstrap = osism.commands.set:Bootstrap
set maintenance = osism.commands.set:Maintenance
status = osism.commands.status:Run
task list = osism.commands.get:Tasks
Expand Down

0 comments on commit 0d06a8f

Please sign in to comment.