mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
passwordstore: Honor equal sign in userpass (#19)
passwordstore lookup plugin now can handle equal sign in user input Fixes: ansible/ansible#68265 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
parent
5d47ab7096
commit
5dbdf14908
2 changed files with 18 additions and 5 deletions
|
@ -15,10 +15,10 @@ DOCUMENTATION = '''
|
|||
It also retrieves YAML style keys stored as multilines in the passwordfile.
|
||||
options:
|
||||
_terms:
|
||||
description: query key
|
||||
description: query key.
|
||||
required: True
|
||||
passwordstore:
|
||||
description: location of the password store
|
||||
description: location of the password store.
|
||||
default: '~/.password-store'
|
||||
directory:
|
||||
description: The directory of the password store.
|
||||
|
@ -42,7 +42,7 @@ DOCUMENTATION = '''
|
|||
userpass:
|
||||
description: Specify a password to save, instead of a generated one.
|
||||
length:
|
||||
description: The length of the generated password
|
||||
description: The length of the generated password.
|
||||
type: integer
|
||||
default: 16
|
||||
backup:
|
||||
|
@ -50,7 +50,7 @@ DOCUMENTATION = '''
|
|||
type: bool
|
||||
default: 'no'
|
||||
nosymbols:
|
||||
description: use alphanumeric characters
|
||||
description: use alphanumeric characters.
|
||||
type: bool
|
||||
default: 'no'
|
||||
'''
|
||||
|
@ -153,7 +153,7 @@ class LookupModule(LookupBase):
|
|||
# next parse the optional parameters in keyvalue pairs
|
||||
try:
|
||||
for param in params[1:]:
|
||||
name, value = param.split('=')
|
||||
name, value = param.split('=', 1)
|
||||
if name not in self.paramvals:
|
||||
raise AnsibleAssertionError('%s not in paramvals' % name)
|
||||
self.paramvals[name] = value
|
||||
|
|
|
@ -47,3 +47,16 @@
|
|||
assert:
|
||||
that:
|
||||
- readpass == newpass
|
||||
|
||||
- name: Create a password with equal sign
|
||||
set_fact:
|
||||
newpass: "{{ lookup('passwordstore', 'test-pass-equal userpass=SimpleSample= create=yes') }}"
|
||||
|
||||
- name: Fetch a password with equal sign
|
||||
set_fact:
|
||||
readpass: "{{ lookup('passwordstore', 'test-pass-equal') }}"
|
||||
|
||||
- name: Verify password
|
||||
assert:
|
||||
that:
|
||||
- readpass == newpass
|
||||
|
|
Loading…
Reference in a new issue