Commit f9838798 authored by Jose Castro Leon's avatar Jose Castro Leon

Add job to synchronize a single project

parent b9e4fd02
Pipeline #1478493 passed with stages
in 5 minutes and 46 seconds
......@@ -89,6 +89,72 @@ workflows:
rgw_access_key: <% $.rgw_access_key %>
rgw_secret_key: <% $.rgw_secret_key %>
sync_job_one:
type: direct
description: This workflow syncs the keys on one project specified by project_id
input:
- project_id
- region: "cern"
tasks:
retrieve_project:
description: 'Retrieves project information'
action: keystone.projects_get
input:
project: <% $.project_id %>
publish:
project: <% task(retrieve_project).result %>
on-success:
- retrieve_credentials_for_project
retrieve_credentials_for_project:
description: 'Retrieves ec2 credentials mapped to that project'
action: keystone.credentials_list
input:
type: "ec2"
keep-result: false
publish:
raw_credentials: <% let(project_id => $.project_id) -> task(retrieve_credentials_for_project).result.where($.project_id = $project_id).select(dict(project_id => $.project_id, blob => json_parse($.blob))) %>
on-success:
- reduce_credentials_to_sync
reduce_credentials_to_sync:
action: std.noop
publish:
credentials: <% $.raw_credentials.select(dict(access_key => $.blob.access, secret_key => $.blob.secret, user => $.project_id)) %>
on-success:
- launch_sync_project
retrieve_access_key:
description: 'Retrieves the access key from barbican'
workflow: secret_retrieve
input:
name: rgw_access_key
publish:
rgw_access_key: <% task(retrieve_access_key).result.payload %>
on-success:
- launch_sync_project
retrieve_secret_key:
description: 'Retrieves the secret key from barbican'
workflow: secret_retrieve
input:
name: rgw_secret_key
publish:
rgw_secret_key: <% task(retrieve_secret_key).result.payload %>
on-success:
- launch_sync_project
launch_sync_project:
join: all
description: 'Fork to synchronize the projects'
workflow: radosgw_key_sync.sync_job_project
input:
project: <% $.project %>
credentials: <% let(project_id => $.project.id) -> $.credentials.where($.user = $project_id) %>
region: <% $.region %>
rgw_access_key: <% $.rgw_access_key %>
rgw_secret_key: <% $.rgw_secret_key %>
sync_job_project:
type: direct
description: Synchronizes a given projects with the credentials passed by parameter
......@@ -111,7 +177,7 @@ workflows:
radosgw_keys: <% task(retrieve_keys_from_radosgw).result.keys %>
on-success:
- calculate_differences
calculate_differences:
description: Calculates the keys that must be added and the ones that must be removed
action: std.noop
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment