Skip to content

Commit

Permalink
Changed the webhook to work live or cold.
Browse files Browse the repository at this point in the history
  • Loading branch information
lizsalmon committed Dec 19, 2024
1 parent c9420a0 commit 12751d6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
13 changes: 10 additions & 3 deletions lib/workflows/search_by_property.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def search_by_property(
group_by: Optional[str] = None,
sort_by: Optional[List[str]] = None,
webhook: Optional[str] = None,
**kwargs
**kwargs,
):
"""
method that builds and runs a query to find generic resource with a selected property
Expand All @@ -43,6 +43,8 @@ def search_by_property(
query = getattr(openstackquery, query_type)()
if not properties_to_select:
query.select_all()
elif webhook:
query.select(*properties_to_select, "server_id")
else:
query.select(*properties_to_select)

Expand All @@ -58,9 +60,14 @@ def search_by_property(
query.group_by(group_by)

query.run(cloud_account, **kwargs)

payload = query.to_props()
payload[0]["cloud_account"] = cloud_account
print(f"test {payload}")
if webhook:
to_webhook(webhook=webhook, payload=query.to_props())
to_webhook(
webhook=webhook,
payload=payload,
)

return {
"to_html": query.to_html(),
Expand Down
3 changes: 1 addition & 2 deletions rules/webhook.server.migrate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,4 @@ action:
ref: "stackstorm_openstack.server.migrate"
parameters:
server_id: "{{ trigger.body.server_id }}"
cloud_account: "dev"
live: true
cloud_account: "{{ trigger.body.cloud_account }}"

0 comments on commit 12751d6

Please sign in to comment.