forked from Tendrl/commons
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added utility to update dashboard with required details
tendrl-bug-id: Tendrl/gluster-integration#385 Signed-off-by: Shubhendu <[email protected]>
- Loading branch information
Shubhendu
committed
Aug 31, 2017
1 parent
e04926c
commit 2274a84
Showing
1 changed file
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import uuid | ||
|
||
from tendrl.commons.objects.job import Job | ||
|
||
|
||
def update_dashboard(res_name, res_type, integration_id, action): | ||
_job_id = str(uuid.uuid4()) | ||
_params = { | ||
"TendrlContext.integration_id": NS.tendrl_context.integration_id, | ||
"Trigger.resource_name": res_name, | ||
"Trigger.resource_type": res_type, | ||
"Trigger.action": action | ||
} | ||
_job_payload = { | ||
"tags": ["tendrl/integration/monitoring"], | ||
"run": "monitoring.flows.UpdateDashboard", | ||
"status": "new", | ||
"parameters": _params, | ||
"type": "monitoring" | ||
} | ||
Job( | ||
job_id=_job_id, | ||
status="new", | ||
payload=_job_payload | ||
).save() |