Skip to content

Commit f641432

Browse files
authored
Rename report status type from boot to bootstrap and improve defaults (#2131)
- Rename the subcommand from "boot" to "bootstrap" for clarity - Show both True and False status by default (no filter) - Treat missing /etc/ansible/facts.d/osism.fact as bootstrap not done (status=False) instead of logging a warning AI-assisted: Claude Code Signed-off-by: Christian Berendt <berendt@osism.tech>
1 parent 87c58c3 commit f641432

1 file changed

Lines changed: 12 additions & 18 deletions

File tree

osism/commands/report.py

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ def get_parser(self, prog_name):
469469
parser.add_argument(
470470
"type",
471471
type=str,
472-
choices=["boot"],
472+
choices=["bootstrap"],
473473
help="Type of status to report",
474474
)
475475
parser.add_argument(
@@ -482,8 +482,8 @@ def get_parser(self, prog_name):
482482
"--status",
483483
type=str,
484484
choices=["True", "False"],
485-
default="True",
486-
help="Filter by status value (default: True)",
485+
default=None,
486+
help="Filter by status value",
487487
)
488488
return parser
489489

@@ -539,10 +539,7 @@ def take_action(self, parsed_args):
539539
]
540540
fact_command = "cat /etc/ansible/facts.d/osism.fact"
541541

542-
section_map = {
543-
"boot": "bootstrap",
544-
}
545-
section = section_map[parsed_args.type]
542+
section = parsed_args.type
546543

547544
filter_status = parsed_args.status
548545

@@ -565,19 +562,16 @@ def take_action(self, parsed_args):
565562
)
566563

567564
if fact_result.returncode != 0:
568-
logger.warning(
569-
f"Failed to get {section} info from {host}: {fact_result.stderr.strip()}"
570-
)
571-
failed_hosts.append(host)
572-
continue
573-
574-
config = configparser.ConfigParser()
575-
config.read_string(fact_result.stdout)
565+
status = "False"
566+
timestamp = "n/a"
567+
else:
568+
config = configparser.ConfigParser()
569+
config.read_string(fact_result.stdout)
576570

577-
status = config.get(section, "status", fallback="n/a")
578-
timestamp = config.get(section, "timestamp", fallback="n/a")
571+
status = config.get(section, "status", fallback="False")
572+
timestamp = config.get(section, "timestamp", fallback="n/a")
579573

580-
if status != filter_status:
574+
if filter_status and status != filter_status:
581575
continue
582576

583577
table.append([host, status, timestamp])

0 commit comments

Comments
 (0)