Skip to content

Commit

Permalink
Fix broken functionality (#215)
Browse files Browse the repository at this point in the history
  • Loading branch information
LBGarber authored Oct 17, 2022
1 parent 3a83ae2 commit f404cb2
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 14 deletions.
2 changes: 1 addition & 1 deletion plugins/module_utils/linode_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions plugins/modules/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@
}

MUTABLE_FIELDS = {
'email',
'restricted'
}

Expand Down Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion tests/integration/targets/image_basic/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
region: us-east
type: g6-standard-1
image: linode/alpine3.16
wait: no
state: present
register: instance_create

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
plugin: linode.cloud.instance
api_token: '{{ api_token }}'
ua_prefix: '{{ ua_prefix }}'
types:
- g6-nanode-1
tags:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
plugin: linode.cloud.instance
api_token: '{{ api_token }}'
ua_prefix: '{{ ua_prefix }}'
keyed_groups:
- key: tags
separator: ''
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
plugin: linode.cloud.instance
api_token: '{{ api_token }}'
ua_prefix: '{{ ua_prefix }}'
ua_prefix: '{{ ua_prefix }}
api_token: '{{ api_token }}'
2 changes: 1 addition & 1 deletion tests/integration/targets/mysql_complex/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions tests/integration/targets/user_basic/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,15 @@
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

- 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
Expand Down

0 comments on commit f404cb2

Please sign in to comment.