CUST-WP-0055 T05: add State Hub workplan_id scope to credential broker
Accept --state-hub-workplan-id / STATE_HUB_WORKPLAN_ID and dual-write workplan_id plus legacy workstream_id on progress events.
This commit is contained in:
parent
49eced2726
commit
9cbf64ebee
1 changed files with 11 additions and 2 deletions
|
|
@ -395,8 +395,10 @@ def record_state_hub(args: argparse.Namespace, metadata: dict[str, Any]) -> None
|
|||
"event_type": "note",
|
||||
"author": "credential-broker",
|
||||
}
|
||||
if args.state_hub_workstream_id:
|
||||
payload["workstream_id"] = args.state_hub_workstream_id
|
||||
scope_id = getattr(args, "state_hub_workplan_id", None) or args.state_hub_workstream_id
|
||||
if scope_id:
|
||||
payload["workplan_id"] = scope_id
|
||||
payload["workstream_id"] = scope_id
|
||||
try:
|
||||
post_json(url, payload, timeout=args.http_timeout)
|
||||
except Exception as exc: # noqa: BLE001
|
||||
|
|
@ -985,6 +987,9 @@ def build_parser() -> argparse.ArgumentParser:
|
|||
"--state-hub-url",
|
||||
default=os.environ.get("STATE_HUB_URL", "http://127.0.0.1:8000"),
|
||||
)
|
||||
parser.add_argument(
|
||||
"--state-hub-workplan-id", default=os.environ.get("STATE_HUB_WORKPLAN_ID")
|
||||
)
|
||||
parser.add_argument(
|
||||
"--state-hub-workstream-id", default=os.environ.get("STATE_HUB_WORKSTREAM_ID")
|
||||
)
|
||||
|
|
@ -1040,8 +1045,12 @@ def main() -> int:
|
|||
args = parser.parse_args()
|
||||
args.lease_dir = resolve_repo_path(args.lease_dir)
|
||||
catalog = load_catalog(resolve_repo_path(Path(args.catalog)))
|
||||
if not args.state_hub_workplan_id:
|
||||
args.state_hub_workplan_id = catalog.get("state_hub_workplan_id")
|
||||
if not args.state_hub_workstream_id:
|
||||
args.state_hub_workstream_id = catalog.get("state_hub_workstream_id")
|
||||
if not args.state_hub_workplan_id:
|
||||
args.state_hub_workplan_id = args.state_hub_workstream_id
|
||||
grant = None
|
||||
if args.command_name in {"request", "exec"}:
|
||||
grant = get_grant(catalog, args.grant)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue