feat(ansible): a run's scope reads as the target or group it names
#5014 "Ansible run scope is shown as a raw id" - inventory_gen.describe_scope / scope_labels turn "steward:target:<uuid>" into "target web-1", "steward:group:<uuid>" into "group Docker Swarm", and a deleted one into "target abcdef01 (deleted)". - MCP run and schedule rows carry scope_label beside the stored scope; the ansible.run.started audit detail records it too. - The web run page and schedules table show the name, with the stored scope as the tooltip. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -128,3 +128,13 @@ def test_yaml_injected_hostvars_survive():
|
||||
def test_yaml_empty_targets():
|
||||
parsed = yaml.safe_load(inventory_to_yaml(generate_inventory([])))
|
||||
assert parsed == {"all": {"hosts": {}}}
|
||||
|
||||
|
||||
def test_describe_scope_names_what_a_run_targeted():
|
||||
from steward.ansible.inventory_gen import describe_scope
|
||||
targets, groups = {"t1": "web-1"}, {"g1": "Docker Swarm"}
|
||||
assert describe_scope("steward:all", targets, groups) == "all inventory targets"
|
||||
assert describe_scope("steward:target:t1", targets, groups) == "target web-1"
|
||||
assert describe_scope("steward:group:g1", targets, groups) == "group Docker Swarm"
|
||||
assert describe_scope("steward:target:abcdef0123", targets, groups) == "target abcdef01 (deleted)"
|
||||
assert describe_scope("repo:homelab:hosts.yml", targets, groups) == "homelab/hosts.yml"
|
||||
|
||||
Reference in New Issue
Block a user