diff --git a/plugins/module_utils/linode_helper.py b/plugins/module_utils/linode_helper.py index acb1c17a..7fbaf94c 100644 --- a/plugins/module_utils/linode_helper.py +++ b/plugins/module_utils/linode_helper.py @@ -277,7 +277,7 @@ def get_all_paginated(client: LinodeClient, endpoint: str, filters: Dict[str, An def format_api_error(err: ApiError) -> str: """Formats an API error into a readable string""" - return ';'.join(err.errors) + return f"Error from Linode API: {';'.join(err.errors)}" def poll_condition(condition_func: Callable[[], bool], step: int, timeout: int) -> None: diff --git a/plugins/modules/user.py b/plugins/modules/user.py index ac44a3fc..dcc98ff0 100644 --- a/plugins/modules/user.py +++ b/plugins/modules/user.py @@ -192,7 +192,6 @@ } MUTABLE_FIELDS = { - 'email', 'restricted' } @@ -324,8 +323,9 @@ def _create_user(self) -> Optional[User]: username = params.pop('username') email = params.pop('email') - for key in {'api_token', 'api_version', 'state', 'grants'}: - params.pop(key) + for key in {'api_token', 'api_version', 'state', 'grants', 'ua_prefix'}: + if key in params: + params.pop(key) try: return self.client.account.user_create(email, username, **params) diff --git a/tests/integration/targets/image_basic/tasks/main.yaml b/tests/integration/targets/image_basic/tasks/main.yaml index da2d30a4..5e3fd3b7 100644 --- a/tests/integration/targets/image_basic/tasks/main.yaml +++ b/tests/integration/targets/image_basic/tasks/main.yaml @@ -11,7 +11,6 @@ region: us-east type: g6-standard-1 image: linode/alpine3.16 - wait: no state: present register: instance_create diff --git a/tests/integration/targets/instance_inventory/templates/filter.instance.yml b/tests/integration/targets/instance_inventory/templates/filter.instance.yml index 307a152b..acd5b07d 100644 --- a/tests/integration/targets/instance_inventory/templates/filter.instance.yml +++ b/tests/integration/targets/instance_inventory/templates/filter.instance.yml @@ -1,6 +1,5 @@ plugin: linode.cloud.instance api_token: '{{ api_token }}' - ua_prefix: '{{ ua_prefix }}' types: - g6-nanode-1 tags: diff --git a/tests/integration/targets/instance_inventory/templates/keyedgroups.instance.yml b/tests/integration/targets/instance_inventory/templates/keyedgroups.instance.yml index 0c97c103..b8f712d7 100644 --- a/tests/integration/targets/instance_inventory/templates/keyedgroups.instance.yml +++ b/tests/integration/targets/instance_inventory/templates/keyedgroups.instance.yml @@ -1,6 +1,5 @@ plugin: linode.cloud.instance api_token: '{{ api_token }}' - ua_prefix: '{{ ua_prefix }}' keyed_groups: - key: tags separator: '' diff --git a/tests/integration/targets/instance_inventory/templates/nofilter.instance.yml b/tests/integration/targets/instance_inventory/templates/nofilter.instance.yml index aa733824..10942c6b 100644 --- a/tests/integration/targets/instance_inventory/templates/nofilter.instance.yml +++ b/tests/integration/targets/instance_inventory/templates/nofilter.instance.yml @@ -1,4 +1,2 @@ plugin: linode.cloud.instance -api_token: '{{ api_token }}' - ua_prefix: '{{ ua_prefix }}' -ua_prefix: '{{ ua_prefix }} \ No newline at end of file +api_token: '{{ api_token }}' \ No newline at end of file diff --git a/tests/integration/targets/mysql_complex/tasks/main.yaml b/tests/integration/targets/mysql_complex/tasks/main.yaml index 23bb84ef..b5b22380 100644 --- a/tests/integration/targets/mysql_complex/tasks/main.yaml +++ b/tests/integration/targets/mysql_complex/tasks/main.yaml @@ -50,7 +50,7 @@ - db_create.database.type == 'g6-standard-1' - db_create.database.cluster_size == 3 - db_create.database.encrypted == true - - db_create.database.replication_type == asynch + - db_create.database.replication_type == 'asynch' - db_create.database.ssl_connection == true - db_create.backups != None - db_create.credentials != None diff --git a/tests/integration/targets/user_basic/tasks/main.yaml b/tests/integration/targets/user_basic/tasks/main.yaml index 710c53a0..c568e88d 100644 --- a/tests/integration/targets/user_basic/tasks/main.yaml +++ b/tests/integration/targets/user_basic/tasks/main.yaml @@ -23,7 +23,7 @@ api_token: '{{ api_token }}' ua_prefix: '{{ ua_prefix }}' username: '{{ create_user.user.username }}' - email: 'ansible-test-{{ r }}-changed@linode.com' + email: 'ansible-test-{{ r }}@linode.com' restricted: False state: present register: update_user @@ -31,8 +31,7 @@ - name: Assert user updated assert: that: - - create_user.user.email == 'ansible-test-{{ r }}-changed@linode.com' - - create_user.user.restricted == False + - update_user.user.restricted == False always: - ignore_errors: yes