1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

proxmox module utils: better error msg when token fails with old proxmoxer (#6839)

* proxmox module utils: clear msg when token fails with old proxmoxer

* add changelog frag

* better way to determine version
This commit is contained in:
Alexei Znamensky 2023-07-04 08:07:05 +12:00 committed by GitHub
parent b6883492c7
commit e5dc697887
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 0 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- proxmox module utils - add logic to detect whether an old Promoxer complains about the ``token_name`` and ``token_value`` parameters and provide a better error message when that happens (https://github.com/ansible-collections/community.general/pull/6839, https://github.com/ansible-collections/community.general/issues/5371).

View file

@ -29,11 +29,13 @@ options:
api_token_id: api_token_id:
description: description:
- Specify the token ID. - Specify the token ID.
- Requires C(proxmoxer>=1.1.0) to work.
type: str type: str
version_added: 1.3.0 version_added: 1.3.0
api_token_secret: api_token_secret:
description: description:
- Specify the token secret. - Specify the token secret.
- Requires C(proxmoxer>=1.1.0) to work.
type: str type: str
version_added: 1.3.0 version_added: 1.3.0
validate_certs: validate_certs:

View file

@ -100,6 +100,8 @@ class ProxmoxAnsible(object):
if api_password: if api_password:
auth_args['password'] = api_password auth_args['password'] = api_password
else: else:
if self.version() < LooseVersion('1.1.0'):
self.module.fail_json('Using "token_name" and "token_value" require proxmoxer>=1.1.0')
auth_args['token_name'] = api_token_id auth_args['token_name'] = api_token_id
auth_args['token_value'] = api_token_secret auth_args['token_value'] = api_token_secret