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.
|
It also retrieves YAML style keys stored as multilines in the passwordfile.
|
||||||
options:
|
options:
|
||||||
_terms:
|
_terms:
|
||||||
description: query key
|
description: query key.
|
||||||
required: True
|
required: True
|
||||||
passwordstore:
|
passwordstore:
|
||||||
description: location of the password store
|
description: location of the password store.
|
||||||
default: '~/.password-store'
|
default: '~/.password-store'
|
||||||
directory:
|
directory:
|
||||||
description: The directory of the password store.
|
description: The directory of the password store.
|
||||||
|
@ -42,7 +42,7 @@ DOCUMENTATION = '''
|
||||||
userpass:
|
userpass:
|
||||||
description: Specify a password to save, instead of a generated one.
|
description: Specify a password to save, instead of a generated one.
|
||||||
length:
|
length:
|
||||||
description: The length of the generated password
|
description: The length of the generated password.
|
||||||
type: integer
|
type: integer
|
||||||
default: 16
|
default: 16
|
||||||
backup:
|
backup:
|
||||||
|
@ -50,7 +50,7 @@ DOCUMENTATION = '''
|
||||||
type: bool
|
type: bool
|
||||||
default: 'no'
|
default: 'no'
|
||||||
nosymbols:
|
nosymbols:
|
||||||
description: use alphanumeric characters
|
description: use alphanumeric characters.
|
||||||
type: bool
|
type: bool
|
||||||
default: 'no'
|
default: 'no'
|
||||||
'''
|
'''
|
||||||
|
@ -153,7 +153,7 @@ class LookupModule(LookupBase):
|
||||||
# next parse the optional parameters in keyvalue pairs
|
# next parse the optional parameters in keyvalue pairs
|
||||||
try:
|
try:
|
||||||
for param in params[1:]:
|
for param in params[1:]:
|
||||||
name, value = param.split('=')
|
name, value = param.split('=', 1)
|
||||||
if name not in self.paramvals:
|
if name not in self.paramvals:
|
||||||
raise AnsibleAssertionError('%s not in paramvals' % name)
|
raise AnsibleAssertionError('%s not in paramvals' % name)
|
||||||
self.paramvals[name] = value
|
self.paramvals[name] = value
|
||||||
|
|
|
@ -47,3 +47,16 @@
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- readpass == newpass
|
- 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