From 08a1fe6497bb4027cd3324e885d919a2d406c96b Mon Sep 17 00:00:00 2001 From: Maciej Wilk Date: Thu, 18 Jun 2026 13:46:39 +0200 Subject: [PATCH 1/8] Refactor object_basic to create AWS keys in specific region --- .../targets/object_basic/tasks/main.yaml | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/tests/integration/targets/object_basic/tasks/main.yaml b/tests/integration/targets/object_basic/tasks/main.yaml index c52cd3cc8..4c307b0c1 100644 --- a/tests/integration/targets/object_basic/tasks/main.yaml +++ b/tests/integration/targets/object_basic/tasks/main.yaml @@ -2,33 +2,36 @@ block: - set_fact: r: "{{ 1000000000 | random }}" + region: "us-ord" - - name: Get info about clusters in us-ord + - name: Get info about clusters in {{ region }} linode.cloud.object_cluster_info: - region: us-ord + region: '{{ region }}' register: info_by_region - name: Assert cluster information is valid assert: that: - - info_by_region.clusters[0].id == 'us-ord-1' - - info_by_region.clusters[0].region == 'us-ord' + - info_by_region.clusters[0].id == '{{ region }}-1' + - info_by_region.clusters[0].region == '{{ region }}' - - name: Get info about cluster id us-ord-1 + - name: Get info about cluster id {{ region }}-1 linode.cloud.object_cluster_info: - id: us-ord-1 + id: '{{ region }}-1' register: info_by_id - name: Assert cluster information is valid assert: that: - - info_by_id.clusters[0].id == 'us-ord-1' - - info_by_id.clusters[0].region == 'us-ord' + - info_by_id.clusters[0].id == '{{ region }}-1' + - info_by_id.clusters[0].region == '{{ region }}' - name: Create a Linode key linode.cloud.object_keys: label: 'test-ansible-key-{{ r }}' state: present + regions: + - '{{ region }}' register: create_key - name: Assert key created @@ -57,10 +60,10 @@ linode.cloud.object_keys: label: 'test-ansible-key-access-{{ r }}' access: - - region: us-ord + - region: '{{ region }}' bucket_name: '{{ create_bucket.name }}' permissions: read_write - - region: us-ord + - region: '{{ region }}' bucket_name: '{{ create_bucket.name }}' permissions: read_only state: present @@ -71,9 +74,9 @@ that: - create_access.changed - 'not "REDACTED" in create_access.key.secret_key' - - create_access.key.bucket_access[0].cluster == 'us-ord-1' + - create_access.key.bucket_access[0].cluster == '{{ region }}-1' - create_access.key.bucket_access[0].bucket_name == create_bucket.name - - create_access.key.bucket_access[1].cluster == 'us-ord-1' + - create_access.key.bucket_access[1].cluster == '{{ region }}-1' - create_access.key.bucket_access[1].bucket_name == create_bucket.name - "['read_only', 'read_write'] | sort == (create_access.key.bucket_access | map(attribute='permissions') | sort)" From b19b90690ad551081045bbe0c00ec40398bf37f5 Mon Sep 17 00:00:00 2001 From: Maciej Wilk Date: Thu, 18 Jun 2026 16:38:09 +0200 Subject: [PATCH 2/8] Add condition for _get_raw_grants API does not return grants for unrestricted users so it is needed to handle _get_raw_grants with a condition --- plugins/modules/user.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/plugins/modules/user.py b/plugins/modules/user.py index daeb5198d..572008c73 100644 --- a/plugins/modules/user.py +++ b/plugins/modules/user.py @@ -437,7 +437,10 @@ def _handle_present(self) -> None: user._api_get() self.results["user"] = user._raw_json - self.results["grants"] = self._get_raw_grants(user) + + # Fetching grants for unrestricted users is not permitted + if self.results["user"]["restricted"]: + self.results["grants"] = self._get_raw_grants(user) def _handle_absent(self) -> None: username: str = self.module.params.get("username") @@ -446,7 +449,11 @@ def _handle_absent(self) -> None: if user is not None: self.results["user"] = user._raw_json - self.results["grants"] = self._get_raw_grants(user) + + # Fetching grants for unrestricted users is not permitted + if self.results["user"]["restricted"]: + self.results["grants"] = self._get_raw_grants(user) + user.delete() self.register_action("Deleted user {0}".format(user.username)) From c9f847c3f598f0144cd49e444f7e909c1e48afe5 Mon Sep 17 00:00:00 2001 From: Maciej Wilk Date: Thu, 18 Jun 2026 17:21:13 +0200 Subject: [PATCH 3/8] Update error message for invalid VPC label --- tests/integration/targets/vpc_basic/tasks/main.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/integration/targets/vpc_basic/tasks/main.yaml b/tests/integration/targets/vpc_basic/tasks/main.yaml index 3d37ba626..df3b3cbd6 100644 --- a/tests/integration/targets/vpc_basic/tasks/main.yaml +++ b/tests/integration/targets/vpc_basic/tasks/main.yaml @@ -26,7 +26,7 @@ description: test description state: present register: invalid_label - failed_when: "'Must only use ASCII letters, numbers, and dashes' not in invalid_label.msg" + failed_when: "'Must only use ASCII letters, numbers, and underscores' not in invalid_label.msg" - name: Update the VPC linode.cloud.vpc: @@ -50,7 +50,7 @@ description: test description updated state: present register: modify_vpc - failed_when: "'Must only use ASCII letters, numbers, and dashes' not in modify_vpc.msg" + failed_when: "'Must only use ASCII letters, numbers, and underscores' not in modify_vpc.msg" - name: Don't update the VPC linode.cloud.vpc: From 7cf43328fed47646a0995a28b62fd7ae542e1ff8 Mon Sep 17 00:00:00 2001 From: Maciej Wilk Date: Fri, 19 Jun 2026 16:04:54 +0200 Subject: [PATCH 4/8] Refactor dbs' UPDATE to handle major_version in different format than int --- plugins/modules/database_mysql_v2.py | 4 ++-- plugins/modules/database_postgresql_v2.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/modules/database_mysql_v2.py b/plugins/modules/database_mysql_v2.py index 1bc753a91..fa4d48319 100644 --- a/plugins/modules/database_mysql_v2.py +++ b/plugins/modules/database_mysql_v2.py @@ -486,14 +486,14 @@ def _update(self, database: MySQLDatabase) -> None: if len(engine_components) < 2: raise ValueError(f"Invalid engine: {engine}") - major_version = int(engine_components[1]) + major_version = engine_components[1].split(".")[0] # Evil hack to correct for the API returning a three-part value for the # `version` field while the user specifies the major version, while still # using handle_updates. # # If anyone can think of a better way to do this, please correct it :) - if int(database.version.split(".")[0]) != major_version: + if database.version.split(".")[0] != major_version: params["version"] = major_version # The `updates` field is returned with an additional `pending` key that isn't diff --git a/plugins/modules/database_postgresql_v2.py b/plugins/modules/database_postgresql_v2.py index ed0c35935..23a97f5b7 100644 --- a/plugins/modules/database_postgresql_v2.py +++ b/plugins/modules/database_postgresql_v2.py @@ -641,9 +641,9 @@ def _update(self, database: PostgreSQLDatabase) -> None: if len(engine_components) < 2: raise ValueError(f"Invalid engine: {engine}") - major_version = int(engine_components[1]) + major_version = engine_components[1].split(".")[0] - if int(database.version.split(".")[0]) != major_version: + if database.version.split(".")[0] != major_version: params["version"] = major_version # The `updates` field is returned with an additional `pending` key that isn't From 56307d6b859b60ae2a6f0bffebfbadeda8d6f3fa Mon Sep 17 00:00:00 2001 From: Maciej Wilk Date: Fri, 19 Jun 2026 16:06:08 +0200 Subject: [PATCH 5/8] Refactor database_mysql_v2 tests to use major version --- .../integration/targets/database_mysql_v2_basic/tasks/main.yaml | 2 +- .../targets/database_mysql_v2_complex/tasks/main.yaml | 2 +- tests/integration/targets/database_mysql_v2_vpc/tasks/main.yaml | 2 -- .../targets/database_mysql_v2_vpc_detach/tasks/main.yaml | 2 -- 4 files changed, 2 insertions(+), 6 deletions(-) diff --git a/tests/integration/targets/database_mysql_v2_basic/tasks/main.yaml b/tests/integration/targets/database_mysql_v2_basic/tasks/main.yaml index d01fff8d8..b06276710 100644 --- a/tests/integration/targets/database_mysql_v2_basic/tasks/main.yaml +++ b/tests/integration/targets/database_mysql_v2_basic/tasks/main.yaml @@ -24,7 +24,7 @@ - set_fact: engine_id: "{{ available_engines.database_engines[0]['id'] }}" - engine_version: "{{ available_engines.database_engines[0]['version'] }}" + engine_version: "{{ (available_engines.database_engines[0]['version'] | split('.'))[0] }}" - name: Create a database linode.cloud.database_mysql_v2: diff --git a/tests/integration/targets/database_mysql_v2_complex/tasks/main.yaml b/tests/integration/targets/database_mysql_v2_complex/tasks/main.yaml index ea92f280b..82058caf9 100644 --- a/tests/integration/targets/database_mysql_v2_complex/tasks/main.yaml +++ b/tests/integration/targets/database_mysql_v2_complex/tasks/main.yaml @@ -24,7 +24,7 @@ - set_fact: engine_id: "{{ available_engines.database_engines[0]['id'] }}" - engine_version: "{{ available_engines.database_engines[0]['version'] }}" + engine_version: "{{ (available_engines.database_engines[0]['version'] | split('.'))[0] }}" - name: Create a database linode.cloud.database_mysql_v2: diff --git a/tests/integration/targets/database_mysql_v2_vpc/tasks/main.yaml b/tests/integration/targets/database_mysql_v2_vpc/tasks/main.yaml index 65e580d0c..530c93a35 100644 --- a/tests/integration/targets/database_mysql_v2_vpc/tasks/main.yaml +++ b/tests/integration/targets/database_mysql_v2_vpc/tasks/main.yaml @@ -24,8 +24,6 @@ - set_fact: engine_id: "{{ available_engines.database_engines[0]['id'] }}" - engine_version: "{{ available_engines.database_engines[0]['version'] }}" - - name: Create a VPC linode.cloud.vpc: diff --git a/tests/integration/targets/database_mysql_v2_vpc_detach/tasks/main.yaml b/tests/integration/targets/database_mysql_v2_vpc_detach/tasks/main.yaml index 66e69b88d..7a9e3f70d 100644 --- a/tests/integration/targets/database_mysql_v2_vpc_detach/tasks/main.yaml +++ b/tests/integration/targets/database_mysql_v2_vpc_detach/tasks/main.yaml @@ -24,8 +24,6 @@ - set_fact: engine_id: "{{ available_engines.database_engines[0]['id'] }}" - engine_version: "{{ available_engines.database_engines[0]['version'] }}" - - name: Create a VPC linode.cloud.vpc: From 93b1975020be01806fbde298b32220d85352278d Mon Sep 17 00:00:00 2001 From: Maciej Wilk Date: Fri, 19 Jun 2026 17:26:52 +0200 Subject: [PATCH 6/8] Linter --- plugins/modules/user.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/plugins/modules/user.py b/plugins/modules/user.py index 572008c73..b5c818c7a 100644 --- a/plugins/modules/user.py +++ b/plugins/modules/user.py @@ -436,10 +436,11 @@ def _handle_present(self) -> None: # Force lazy-loading user._api_get() - self.results["user"] = user._raw_json + user_json = user._raw_json + self.results["user"] = user_json # Fetching grants for unrestricted users is not permitted - if self.results["user"]["restricted"]: + if user_json["restricted"]: self.results["grants"] = self._get_raw_grants(user) def _handle_absent(self) -> None: @@ -448,10 +449,11 @@ def _handle_absent(self) -> None: user = self._get_user_by_username(username) if user is not None: - self.results["user"] = user._raw_json + user_json = user._raw_json + self.results["user"] = user_json # Fetching grants for unrestricted users is not permitted - if self.results["user"]["restricted"]: + if user_json["restricted"]: self.results["grants"] = self._get_raw_grants(user) user.delete() From 0c9a71c20398773bab924a1f2708b28aa8239e89 Mon Sep 17 00:00:00 2001 From: Maciej Wilk Date: Wed, 24 Jun 2026 09:27:29 +0200 Subject: [PATCH 7/8] Update module name to v2 in mysql and postgresql tests --- tests/integration/targets/mysql_basic/tasks/main.yaml | 8 ++++---- tests/integration/targets/mysql_complex/tasks/main.yaml | 6 +++--- .../integration/targets/postgresql_basic/tasks/main.yaml | 8 ++++---- .../targets/postgresql_complex/tasks/main.yaml | 6 +++--- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/tests/integration/targets/mysql_basic/tasks/main.yaml b/tests/integration/targets/mysql_basic/tasks/main.yaml index 780cb8cbf..5aacfdace 100644 --- a/tests/integration/targets/mysql_basic/tasks/main.yaml +++ b/tests/integration/targets/mysql_basic/tasks/main.yaml @@ -21,7 +21,7 @@ engine_version: "{{ available_engines.database_engines[0]['version'] }}" - name: Create a database - linode.cloud.database_mysql: + linode.cloud.database_mysql_v2: label: 'ansible-test-{{ r }}' region: us-ord engine: '{{engine_id}}' @@ -73,7 +73,7 @@ - name: Update the database - linode.cloud.database_mysql: + linode.cloud.database_mysql_v2: label: 'ansible-test-{{ r }}' region: us-ord engine: "{{ engine_id }}" @@ -117,7 +117,7 @@ # - resolve_dbs.databases[0].label == db_create.database.label - name: Update the database - linode.cloud.database_mysql: + linode.cloud.database_mysql_v2: label: 'ansible-test-{{ r }}' region: us-ord engine: "{{ engine_id }}" @@ -133,7 +133,7 @@ - ignore_errors: true block: - name: Delete mysql db - linode.cloud.database_mysql: + linode.cloud.database_mysql_v2: label: '{{ db_create.database.label }}' state: absent diff --git a/tests/integration/targets/mysql_complex/tasks/main.yaml b/tests/integration/targets/mysql_complex/tasks/main.yaml index 047bd7d8d..59b149f3a 100644 --- a/tests/integration/targets/mysql_complex/tasks/main.yaml +++ b/tests/integration/targets/mysql_complex/tasks/main.yaml @@ -21,7 +21,7 @@ engine_version: "{{ available_engines.database_engines[0]['version'] }}" - name: Validation check - linode.cloud.database_mysql: + linode.cloud.database_mysql_v2: label: 'ansible-test-{{ r }}' region: us-ord engine: "{{ engine_id }}" @@ -33,7 +33,7 @@ failed_when: '"Invalid CIDR format for IP" not in allow_list_validation.msg' - name: Create a database - linode.cloud.database_mysql: + linode.cloud.database_mysql_v2: label: 'ansible-test-{{ r }}' region: us-ord engine: "{{ engine_id }}" @@ -78,7 +78,7 @@ - ignore_errors: true block: - name: Delete mysql database - linode.cloud.database_mysql: + linode.cloud.database_mysql_v2: label: '{{ db_create.database.label }}' state: absent diff --git a/tests/integration/targets/postgresql_basic/tasks/main.yaml b/tests/integration/targets/postgresql_basic/tasks/main.yaml index 90d53e17d..81a941741 100644 --- a/tests/integration/targets/postgresql_basic/tasks/main.yaml +++ b/tests/integration/targets/postgresql_basic/tasks/main.yaml @@ -21,7 +21,7 @@ engine_version: "{{ available_engines.database_engines[0]['version'] }}" - name: Create a database - linode.cloud.database_postgresql: + linode.cloud.database_postgresql_v2: label: 'ansible-test-{{ r }}' region: us-ord engine: '{{ engine_id }}' @@ -68,7 +68,7 @@ - by_id.database.type == 'g6-standard-1' - name: Update the database - linode.cloud.database_postgresql: + linode.cloud.database_postgresql_v2: label: 'ansible-test-{{ r }}' region: us-ord engine: '{{ engine_id }}' @@ -85,7 +85,7 @@ - db_update.database.allow_list[0] == '10.0.0.1/32' - name: Update the database - linode.cloud.database_postgresql: + linode.cloud.database_postgresql_v2: label: 'ansible-test-{{ r }}' region: us-ord engine: '{{ engine_id }}' @@ -101,7 +101,7 @@ - ignore_errors: true block: - name: Delete postgres db - linode.cloud.database_postgresql: + linode.cloud.database_postgresql_v2: label: '{{ db_create.database.label }}' state: absent diff --git a/tests/integration/targets/postgresql_complex/tasks/main.yaml b/tests/integration/targets/postgresql_complex/tasks/main.yaml index 168acbb1e..2c8272cc5 100644 --- a/tests/integration/targets/postgresql_complex/tasks/main.yaml +++ b/tests/integration/targets/postgresql_complex/tasks/main.yaml @@ -21,7 +21,7 @@ engine_version: "{{ available_engines.database_engines[0]['version'] }}" - name: Validation check - linode.cloud.database_postgresql: + linode.cloud.database_postgresql_v2: label: 'ansible-test-{{ r }}' region: us-ord engine: '{{ engine_id }}' @@ -33,7 +33,7 @@ failed_when: '"Invalid CIDR format for IP" not in allow_list_validation.msg' - name: Create a database - linode.cloud.database_postgresql: + linode.cloud.database_postgresql_v2: label: 'ansible-test-{{ r }}' region: us-ord engine: '{{ engine_id }}' @@ -80,7 +80,7 @@ - ignore_errors: true block: - name: Delete postgres db - linode.cloud.database_postgresql: + linode.cloud.database_postgresql_v2: label: '{{ db_create.database.label }}' state: absent From fe0a3f1cda15acc327990e4b82446b1cbc77120e Mon Sep 17 00:00:00 2001 From: Maciej Wilk Date: Wed, 1 Jul 2026 13:31:04 +0200 Subject: [PATCH 8/8] Align db engine used for fork --- .../targets/database_mysql_v2_complex/tasks/main.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/targets/database_mysql_v2_complex/tasks/main.yaml b/tests/integration/targets/database_mysql_v2_complex/tasks/main.yaml index 82058caf9..920cb83d7 100644 --- a/tests/integration/targets/database_mysql_v2_complex/tasks/main.yaml +++ b/tests/integration/targets/database_mysql_v2_complex/tasks/main.yaml @@ -153,7 +153,7 @@ linode.cloud.database_mysql_v2: label: "ansible-test-{{ r }}-forked" region: us-mia - engine: mysql/8 + engine: "{{ engine_id }}" type: g6-nanode-1 fork: source: "{{ db_refresh.database.id }}"