From 7d0eb7b7bc061437ca15518904be62b889744f63 Mon Sep 17 00:00:00 2001 From: The Magician Date: Fri, 14 Dec 2018 12:49:08 -0800 Subject: [PATCH] Ansible integration test fixes - pt 2 (#147) /cc @rambleraptor --- .../cloud/google/gcp_compute_vpn_tunnel.py | 4 ++-- .../cloud/google/gcp_iam_service_account.py | 4 +++- .../modules/cloud/google/gcp_sql_database.py | 2 +- .../modules/cloud/google/gcp_sql_instance.py | 2 +- .../modules/cloud/google/gcp_sql_user.py | 2 +- .../gcp_storage_bucket_access_control.py | 2 +- .../gcp_compute_vpn_tunnel/tasks/main.yml | 20 +++++++++---------- .../gcp_iam_service_account/tasks/main.yml | 20 ++++++++++++++----- .../targets/gcp_sql_database/tasks/main.yml | 4 ++-- .../targets/gcp_sql_instance/tasks/main.yml | 10 +++++----- .../targets/gcp_sql_user/tasks/main.yml | 4 ++-- .../tasks/main.yml | 4 ++-- 12 files changed, 45 insertions(+), 33 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py index abd6749be90333..76d023059f599a 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py @@ -162,8 +162,8 @@ state: present register: gateway -- name: create a vpn-tunnel - gcp_compute_vpn-tunnel: +- name: create a vpn tunnel + gcp_compute_vpn_tunnel: name: "test_object" region: us-west1 target_vpn_gateway: "{{ gateway }}" diff --git a/lib/ansible/modules/cloud/google/gcp_iam_service_account.py b/lib/ansible/modules/cloud/google/gcp_iam_service_account.py index 122c32b51157fc..07e337e63277b9 100644 --- a/lib/ansible/modules/cloud/google/gcp_iam_service_account.py +++ b/lib/ansible/modules/cloud/google/gcp_iam_service_account.py @@ -62,7 +62,9 @@ EXAMPLES = ''' - name: create a service account gcp_iam_service_account: - name: test-ansible@graphite-playground.google.com.iam.gserviceaccount.com + name: '"{{resource_name}}@{{gcp_project}}.google.com.iam.gserviceaccount.com" + + ' display_name: My Ansible test key project: "test_project" auth_kind: "serviceaccount" diff --git a/lib/ansible/modules/cloud/google/gcp_sql_database.py b/lib/ansible/modules/cloud/google/gcp_sql_database.py index f46435aeaf2223..5a1818104498be 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_database.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_database.py @@ -76,7 +76,7 @@ EXAMPLES = ''' - name: create a instance gcp_sql_instance: - name: "{{ resource_name }}" + name: "{{resource_name}}-3" settings: ip_configuration: authorized_networks: diff --git a/lib/ansible/modules/cloud/google/gcp_sql_instance.py b/lib/ansible/modules/cloud/google/gcp_sql_instance.py index 161aa88976243f..7322d2bd7a36b4 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_instance.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_instance.py @@ -273,7 +273,7 @@ EXAMPLES = ''' - name: create a instance gcp_sql_instance: - name: "test_object" + name: "{{resource_name}}-2" settings: ip_configuration: authorized_networks: diff --git a/lib/ansible/modules/cloud/google/gcp_sql_user.py b/lib/ansible/modules/cloud/google/gcp_sql_user.py index 8de5a07d571dbe..693c7465e9f297 100644 --- a/lib/ansible/modules/cloud/google/gcp_sql_user.py +++ b/lib/ansible/modules/cloud/google/gcp_sql_user.py @@ -77,7 +77,7 @@ EXAMPLES = ''' - name: create a instance gcp_sql_instance: - name: "{{ resource_name }}" + name: "{{resource_name}}-1" settings: ip_configuration: authorized_networks: diff --git a/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py b/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py index 09e141f4bc08e6..c64b4a90a40887 100644 --- a/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py +++ b/lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py @@ -110,7 +110,7 @@ EXAMPLES = ''' - name: create a bucket gcp_storage_bucket: - name: "bucket-bac" + name: "{{ resource_name }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" diff --git a/test/integration/targets/gcp_compute_vpn_tunnel/tasks/main.yml b/test/integration/targets/gcp_compute_vpn_tunnel/tasks/main.yml index a46191a7246ffb..7cdd3de88a0a93 100644 --- a/test/integration/targets/gcp_compute_vpn_tunnel/tasks/main.yml +++ b/test/integration/targets/gcp_compute_vpn_tunnel/tasks/main.yml @@ -49,8 +49,8 @@ service_account_file: "{{ gcp_cred_file }}" state: present register: gateway -- name: delete a vpn-tunnel - gcp_compute_vpn-tunnel: +- name: delete a vpn tunnel + gcp_compute_vpn_tunnel: name: "{{ resource_name }}" region: us-west1 target_vpn_gateway: "{{ gateway }}" @@ -61,8 +61,8 @@ service_account_file: "{{ gcp_cred_file }}" state: absent #---------------------------------------------------------- -- name: create a vpn-tunnel - gcp_compute_vpn-tunnel: +- name: create a vpn tunnel + gcp_compute_vpn_tunnel: name: "{{ resource_name }}" region: us-west1 target_vpn_gateway: "{{ gateway }}" @@ -94,8 +94,8 @@ that: - results['items'] | length == 1 # ---------------------------------------------------------------------------- -- name: create a vpn-tunnel that already exists - gcp_compute_vpn-tunnel: +- name: create a vpn tunnel that already exists + gcp_compute_vpn_tunnel: name: "{{ resource_name }}" region: us-west1 target_vpn_gateway: "{{ gateway }}" @@ -112,8 +112,8 @@ - result.changed == false - "result.kind == 'compute#vpnTunnel'" #---------------------------------------------------------- -- name: delete a vpn-tunnel - gcp_compute_vpn-tunnel: +- name: delete a vpn tunnel + gcp_compute_vpn_tunnel: name: "{{ resource_name }}" region: us-west1 target_vpn_gateway: "{{ gateway }}" @@ -145,8 +145,8 @@ that: - results['items'] | length == 0 # ---------------------------------------------------------------------------- -- name: delete a vpn-tunnel that does not exist - gcp_compute_vpn-tunnel: +- name: delete a vpn tunnel that does not exist + gcp_compute_vpn_tunnel: name: "{{ resource_name }}" region: us-west1 target_vpn_gateway: "{{ gateway }}" diff --git a/test/integration/targets/gcp_iam_service_account/tasks/main.yml b/test/integration/targets/gcp_iam_service_account/tasks/main.yml index 519df9937f3b9a..2e06eb7f5d9cef 100644 --- a/test/integration/targets/gcp_iam_service_account/tasks/main.yml +++ b/test/integration/targets/gcp_iam_service_account/tasks/main.yml @@ -15,7 +15,9 @@ # Pre-test setup - name: delete a service account gcp_iam_service_account: - name: test-ansible@graphite-playground.google.com.iam.gserviceaccount.com + name: '"{{resource_name}}@{{gcp_project}}.google.com.iam.gserviceaccount.com" + + ' display_name: My Ansible test key project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" @@ -24,7 +26,9 @@ #---------------------------------------------------------- - name: create a service account gcp_iam_service_account: - name: test-ansible@graphite-playground.google.com.iam.gserviceaccount.com + name: '"{{resource_name}}@{{gcp_project}}.google.com.iam.gserviceaccount.com" + + ' display_name: My Ansible test key project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" @@ -50,7 +54,9 @@ # ---------------------------------------------------------------------------- - name: create a service account that already exists gcp_iam_service_account: - name: test-ansible@graphite-playground.google.com.iam.gserviceaccount.com + name: '"{{resource_name}}@{{gcp_project}}.google.com.iam.gserviceaccount.com" + + ' display_name: My Ansible test key project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" @@ -64,7 +70,9 @@ #---------------------------------------------------------- - name: delete a service account gcp_iam_service_account: - name: test-ansible@graphite-playground.google.com.iam.gserviceaccount.com + name: '"{{resource_name}}@{{gcp_project}}.google.com.iam.gserviceaccount.com" + + ' display_name: My Ansible test key project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" @@ -90,7 +98,9 @@ # ---------------------------------------------------------------------------- - name: delete a service account that does not exist gcp_iam_service_account: - name: test-ansible@graphite-playground.google.com.iam.gserviceaccount.com + name: '"{{resource_name}}@{{gcp_project}}.google.com.iam.gserviceaccount.com" + + ' display_name: My Ansible test key project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" diff --git a/test/integration/targets/gcp_sql_database/tasks/main.yml b/test/integration/targets/gcp_sql_database/tasks/main.yml index a74f50f5f4b244..a9dd18bdf4534e 100644 --- a/test/integration/targets/gcp_sql_database/tasks/main.yml +++ b/test/integration/targets/gcp_sql_database/tasks/main.yml @@ -15,7 +15,7 @@ # Pre-test setup - name: create a instance gcp_sql_instance: - name: "{{ resource_name }}" + name: "{{resource_name}}-3" settings: ip_configuration: authorized_networks: @@ -132,7 +132,7 @@ # If errors happen, don't crash the playbook! - name: delete a instance gcp_sql_instance: - name: "{{ resource_name }}" + name: "{{resource_name}}-3" settings: ip_configuration: authorized_networks: diff --git a/test/integration/targets/gcp_sql_instance/tasks/main.yml b/test/integration/targets/gcp_sql_instance/tasks/main.yml index 6fa18f2d0aa56b..fa7690c1e80c11 100644 --- a/test/integration/targets/gcp_sql_instance/tasks/main.yml +++ b/test/integration/targets/gcp_sql_instance/tasks/main.yml @@ -15,7 +15,7 @@ # Pre-test setup - name: delete a instance gcp_sql_instance: - name: "{{ resource_name }}" + name: "{{resource_name}}-2" settings: ip_configuration: authorized_networks: @@ -30,7 +30,7 @@ #---------------------------------------------------------- - name: create a instance gcp_sql_instance: - name: "{{ resource_name }}" + name: "{{resource_name}}-2" settings: ip_configuration: authorized_networks: @@ -63,7 +63,7 @@ # ---------------------------------------------------------------------------- - name: create a instance that already exists gcp_sql_instance: - name: "{{ resource_name }}" + name: "{{resource_name}}-2" settings: ip_configuration: authorized_networks: @@ -84,7 +84,7 @@ #---------------------------------------------------------- - name: delete a instance gcp_sql_instance: - name: "{{ resource_name }}" + name: "{{resource_name}}-2" settings: ip_configuration: authorized_networks: @@ -117,7 +117,7 @@ # ---------------------------------------------------------------------------- - name: delete a instance that does not exist gcp_sql_instance: - name: "{{ resource_name }}" + name: "{{resource_name}}-2" settings: ip_configuration: authorized_networks: diff --git a/test/integration/targets/gcp_sql_user/tasks/main.yml b/test/integration/targets/gcp_sql_user/tasks/main.yml index 5d1bfeca0a2d32..ac8f8b510e36fd 100644 --- a/test/integration/targets/gcp_sql_user/tasks/main.yml +++ b/test/integration/targets/gcp_sql_user/tasks/main.yml @@ -15,7 +15,7 @@ # Pre-test setup - name: create a instance gcp_sql_instance: - name: "{{ resource_name }}" + name: "{{resource_name}}-1" settings: ip_configuration: authorized_networks: @@ -137,7 +137,7 @@ # If errors happen, don't crash the playbook! - name: delete a instance gcp_sql_instance: - name: "{{ resource_name }}" + name: "{{resource_name}}-1" settings: ip_configuration: authorized_networks: diff --git a/test/integration/targets/gcp_storage_bucket_access_control/tasks/main.yml b/test/integration/targets/gcp_storage_bucket_access_control/tasks/main.yml index 446ca4ab9cf5da..c4a28f0c854b39 100644 --- a/test/integration/targets/gcp_storage_bucket_access_control/tasks/main.yml +++ b/test/integration/targets/gcp_storage_bucket_access_control/tasks/main.yml @@ -15,7 +15,7 @@ # Pre-test setup - name: create a bucket gcp_storage_bucket: - name: "bucket-bac" + name: "{{ resource_name }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" @@ -99,7 +99,7 @@ # If errors happen, don't crash the playbook! - name: delete a bucket gcp_storage_bucket: - name: "bucket-bac" + name: "{{ resource_name }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}"