fix(health-agent): skip uk_tokens.yml write when tokens dict is empty to prevent setup skip loop
This commit is contained in:
parent
8b10653ff4
commit
e4acd0e57b
@ -370,10 +370,13 @@ def setup_uptime_kuma(dry_run=False, only=None):
|
|||||||
# 7. Write push tokens to uk_tokens.yml
|
# 7. Write push tokens to uk_tokens.yml
|
||||||
token_file = os.path.join(os.path.dirname(__file__), "..", "config", "generated", "uk_tokens.yml")
|
token_file = os.path.join(os.path.dirname(__file__), "..", "config", "generated", "uk_tokens.yml")
|
||||||
if not dry_run:
|
if not dry_run:
|
||||||
os.makedirs(os.path.dirname(token_file), exist_ok=True)
|
if not tokens:
|
||||||
with open(token_file, "w") as f:
|
logger.warning("No push tokens captured; skipping uk_tokens.yml write so setup reruns next time")
|
||||||
yaml.dump(tokens, f)
|
else:
|
||||||
logger.info(f"Saved push tokens to {token_file}")
|
os.makedirs(os.path.dirname(token_file), exist_ok=True)
|
||||||
|
with open(token_file, "w") as f:
|
||||||
|
yaml.dump(tokens, f)
|
||||||
|
logger.info(f"Saved {len(tokens)} push tokens to {token_file}")
|
||||||
else:
|
else:
|
||||||
logger.info(f"[DRY-RUN] Would save {len(tokens)} tokens to {token_file}")
|
logger.info(f"[DRY-RUN] Would save {len(tokens)} tokens to {token_file}")
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user