Browse Source

throttle the create/update/delete operations

pull/25/head
Nicolas Massé 8 years ago
parent
commit
9b47d500ca
  1. 1
      defaults/main.yml
  2. 4
      tasks/create_activedocs.yml
  3. 4
      tasks/create_application_plans.yml
  4. 4
      tasks/create_default_application.yml
  5. 4
      tasks/create_mapping_rule.yml
  6. 4
      tasks/create_service.yml
  7. 4
      tasks/delete_unused_metrics.yml
  8. 4
      tasks/patch_default_application_for_oauth.yml
  9. 4
      tasks/promote.yml
  10. 4
      tasks/update_mapping_rule.yml
  11. 4
      tasks/update_mapping_rules.yml
  12. 4
      tasks/update_method.yml
  13. 4
      tasks/update_proxy.yml

1
defaults/main.yml

@ -2,6 +2,7 @@
threescale_cicd_openapi_file_format: YAML threescale_cicd_openapi_file_format: YAML
threescale_cicd_delay: 10 threescale_cicd_delay: 10
threescale_cicd_retries: 50 threescale_cicd_retries: 50
threescale_cicd_throttling: 2
threescale_cicd_default_application_name: 'Ansible smoke-tests default application' threescale_cicd_default_application_name: 'Ansible smoke-tests default application'
threescale_cicd_default_application_description: 'This app is used to run smoke tests during the deployment phase. It will be automatically recreated if you delete it.' threescale_cicd_default_application_description: 'This app is used to run smoke tests during the deployment phase. It will be automatically recreated if you delete it.'
threescale_cicd_staging_environment_name: sandbox threescale_cicd_staging_environment_name: sandbox

4
tasks/create_activedocs.yml

@ -99,6 +99,10 @@
changed_when: 'threescale_cicd_tmpresponse.status == 201' changed_when: 'threescale_cicd_tmpresponse.status == 201'
when: 'threescale_cicd_api_system_name not in threescale_cicd_existing_activedocs' when: 'threescale_cicd_api_system_name not in threescale_cicd_existing_activedocs'
- name: Wait for a couple seconds
pause:
seconds: '{{ threescale_cicd_throttling }}'
- set_fact: - set_fact:
threescale_cicd_api_activedocs_id: '{{ threescale_cicd_tmpresponse.json.api_doc.id }}' threescale_cicd_api_activedocs_id: '{{ threescale_cicd_tmpresponse.json.api_doc.id }}'
when: 'threescale_cicd_api_system_name not in threescale_cicd_existing_activedocs' when: 'threescale_cicd_api_system_name not in threescale_cicd_existing_activedocs'

4
tasks/create_application_plans.yml

@ -32,3 +32,7 @@
threescale_cicd_existing_application_plans: '{{ threescale_cicd_existing_application_plans|union([ threescale_cicd_tmp_plan.system_name ]) }}' threescale_cicd_existing_application_plans: '{{ threescale_cicd_existing_application_plans|union([ threescale_cicd_tmp_plan.system_name ]) }}'
threescale_cicd_existing_application_plans_details: '{{ threescale_cicd_existing_application_plans_details|union([{ "system_name": threescale_cicd_tmp_plan.system_name, "id": threescale_cicd_tmpresponse.json.application_plan.id }]) }}' threescale_cicd_existing_application_plans_details: '{{ threescale_cicd_existing_application_plans_details|union([{ "system_name": threescale_cicd_tmp_plan.system_name, "id": threescale_cicd_tmpresponse.json.application_plan.id }]) }}'
when: 'threescale_cicd_tmp_plan.system_name not in threescale_cicd_existing_application_plans' when: 'threescale_cicd_tmp_plan.system_name not in threescale_cicd_existing_application_plans'
- name: Wait for a couple seconds
pause:
seconds: '{{ threescale_cicd_throttling }}'

4
tasks/create_default_application.yml

@ -83,3 +83,7 @@
- include_tasks: patch_default_application_for_oauth.yml - include_tasks: patch_default_application_for_oauth.yml
when: 'threescale_cicd_api_security_scheme.type == ''oauth2''' when: 'threescale_cicd_api_security_scheme.type == ''oauth2'''
- name: Wait for a couple seconds
pause:
seconds: '{{ threescale_cicd_throttling }}'

4
tasks/create_mapping_rule.yml

@ -22,3 +22,7 @@
status_code: 201 status_code: 201
register: threescale_cicd_tmpresponse register: threescale_cicd_tmpresponse
changed_when: 'threescale_cicd_tmpresponse.status == 201' changed_when: 'threescale_cicd_tmpresponse.status == 201'
- name: Wait for a couple seconds
pause:
seconds: '{{ threescale_cicd_throttling }}'

4
tasks/create_service.yml

@ -52,3 +52,7 @@
threescale_cicd_existing_services: '{{ threescale_cicd_existing_services|union([ threescale_cicd_tmpresponse.json.service.system_name ]) }}' threescale_cicd_existing_services: '{{ threescale_cicd_existing_services|union([ threescale_cicd_tmpresponse.json.service.system_name ]) }}'
threescale_cicd_existing_services_details: '{{ threescale_cicd_existing_services_details|union([ { ''id'': threescale_cicd_tmpresponse.json.service.id, ''system_name'': threescale_cicd_tmpresponse.json.service.system_name } ]) }}' threescale_cicd_existing_services_details: '{{ threescale_cicd_existing_services_details|union([ { ''id'': threescale_cicd_tmpresponse.json.service.id, ''system_name'': threescale_cicd_tmpresponse.json.service.system_name } ]) }}'
when: 'threescale_cicd_api_system_name not in threescale_cicd_existing_services' when: 'threescale_cicd_api_system_name not in threescale_cicd_existing_services'
- name: Wait for a couple seconds
pause:
seconds: '{{ threescale_cicd_throttling }}'

4
tasks/delete_unused_metrics.yml

@ -19,3 +19,7 @@
with_items: '{{ threescale_cicd_tmp_metrics_to_delete }}' with_items: '{{ threescale_cicd_tmp_metrics_to_delete }}'
loop_control: loop_control:
loop_var: threescale_cicd_tmp_metric loop_var: threescale_cicd_tmp_metric
- name: Wait for a couple seconds
pause:
seconds: '{{ threescale_cicd_throttling }}'

4
tasks/patch_default_application_for_oauth.yml

@ -59,3 +59,7 @@
headers: headers:
Authorization: 'Bearer {{ threescale_cicd_openapi_tmp_access_token }}' Authorization: 'Bearer {{ threescale_cicd_openapi_tmp_access_token }}'
Content-Type: 'application/json' Content-Type: 'application/json'
- name: Wait for a couple seconds
pause:
seconds: '{{ threescale_cicd_throttling }}'

4
tasks/promote.yml

@ -36,3 +36,7 @@
method: POST method: POST
register: threescale_cicd_tmpresponse register: threescale_cicd_tmpresponse
when: 'threescale_cicd_tmp_staging_proxy_version != threescale_cicd_tmp_production_proxy_version' when: 'threescale_cicd_tmp_staging_proxy_version != threescale_cicd_tmp_production_proxy_version'
- name: Wait for a couple seconds
pause:
seconds: '{{ threescale_cicd_throttling }}'

4
tasks/update_mapping_rule.yml

@ -24,3 +24,7 @@
status_code: 200 status_code: 200
register: threescale_cicd_tmpresponse register: threescale_cicd_tmpresponse
changed_when: 'threescale_cicd_tmpresponse.status == 200' changed_when: 'threescale_cicd_tmpresponse.status == 200'
- name: Wait for a couple seconds
pause:
seconds: '{{ threescale_cicd_throttling }}'

4
tasks/update_mapping_rules.yml

@ -53,3 +53,7 @@
with_items: '{{ threescale_cicd_tmp_mapping_rules_to_delete }}' with_items: '{{ threescale_cicd_tmp_mapping_rules_to_delete }}'
loop_control: loop_control:
loop_var: threescale_cicd_tmp_mapping_rule_to_delete loop_var: threescale_cicd_tmp_mapping_rule_to_delete
- name: Wait for a couple seconds
pause:
seconds: '{{ threescale_cicd_throttling }}'

4
tasks/update_method.yml

@ -41,3 +41,7 @@
threescale_cicd_existing_metrics: '{{ threescale_cicd_existing_metrics|union([ threescale_cicd_tmp_operation.key ]) }}' threescale_cicd_existing_metrics: '{{ threescale_cicd_existing_metrics|union([ threescale_cicd_tmp_operation.key ]) }}'
threescale_cicd_existing_metrics_details: '{{ threescale_cicd_existing_metrics_details|union([ { "system_name": threescale_cicd_tmp_operation.key, "id": threescale_cicd_tmpresponse.json|json_query("method.id") } ]) }}' threescale_cicd_existing_metrics_details: '{{ threescale_cicd_existing_metrics_details|union([ { "system_name": threescale_cicd_tmp_operation.key, "id": threescale_cicd_tmpresponse.json|json_query("method.id") } ]) }}'
when: 'threescale_cicd_tmp_operation.key not in threescale_cicd_existing_metrics' when: 'threescale_cicd_tmp_operation.key not in threescale_cicd_existing_metrics'
- name: Wait for a couple seconds
pause:
seconds: '{{ threescale_cicd_throttling }}'

4
tasks/update_proxy.yml

@ -17,3 +17,7 @@
body: '{{ threescale_cicd_tmp_body_update_proxy }}' body: '{{ threescale_cicd_tmp_body_update_proxy }}'
register: threescale_cicd_tmpresponse register: threescale_cicd_tmpresponse
changed_when: 'threescale_cicd_tmpresponse.status == 200' changed_when: 'threescale_cicd_tmpresponse.status == 200'
- name: Wait for a couple seconds
pause:
seconds: '{{ threescale_cicd_throttling }}'

Loading…
Cancel
Save