Skip to content

Commit 13ff300

Browse files
dholtclaude
andcommitted
fix: detect placeholder config values in MAAS inventory script
Recognize placeholder values from config.example (angle brackets, CONSUMER_KEY:TOKEN_KEY:TOKEN_SECRET) as unconfigured and return empty inventory instead of attempting to connect and failing. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Douglas Holt <dholt@nvidia.com>
1 parent 29eaca5 commit 13ff300

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

scripts/maas_inventory.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,12 @@ def load_config():
125125
config[k] = v
126126
break
127127

128-
if not config["api_url"] or not config["api_key"]:
128+
# Detect unconfigured: empty values or placeholder templates from config.example
129+
api_url = config["api_url"]
130+
api_key = config["api_key"]
131+
if (not api_url or not api_key
132+
or "<" in api_url or "<" in api_key
133+
or api_key == "CONSUMER_KEY:TOKEN_KEY:TOKEN_SECRET"):
129134
# Return gracefully so ansible doesn't fail when MAAS isn't configured.
130135
# This allows the dynamic inventory to coexist with static inventory
131136
# in ansible.cfg without errors for users who don't use MAAS.

0 commit comments

Comments
 (0)