mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
document BWS_ACCESS_TOKEN env var and declare as required
This commit is contained in:
parent
5ba172bccd
commit
b7d6c78808
1 changed files with 4 additions and 8 deletions
|
@ -23,7 +23,10 @@ DOCUMENTATION = """
|
||||||
type: list
|
type: list
|
||||||
elements: str
|
elements: str
|
||||||
bws_access_token:
|
bws_access_token:
|
||||||
description: A BWS access token to use for this lookup.
|
description: The BWS access token to use for this lookup.
|
||||||
|
env:
|
||||||
|
- name: BWS_ACCESS_TOKEN
|
||||||
|
required: true
|
||||||
type: str
|
type: str
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@ -66,7 +69,6 @@ RETURN = """
|
||||||
elements: raw
|
elements: raw
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
|
||||||
from subprocess import Popen, PIPE
|
from subprocess import Popen, PIPE
|
||||||
|
|
||||||
from ansible.errors import AnsibleError
|
from ansible.errors import AnsibleError
|
||||||
|
@ -122,12 +124,6 @@ class LookupModule(LookupBase):
|
||||||
self.set_options(var_options=variables, direct=kwargs)
|
self.set_options(var_options=variables, direct=kwargs)
|
||||||
bws_access_token = self.get_option('bws_access_token')
|
bws_access_token = self.get_option('bws_access_token')
|
||||||
|
|
||||||
if not bws_access_token:
|
|
||||||
bws_access_token = os.getenv('BWS_ACCESS_TOKEN')
|
|
||||||
|
|
||||||
if not bws_access_token:
|
|
||||||
raise AnsibleError("No access token. Pass the bws_access_token parameter or set the BWS_ACCESS_TOKEN environment variable.")
|
|
||||||
|
|
||||||
return [_bitwarden.get_secret(term, bws_access_token) for term in terms]
|
return [_bitwarden.get_secret(term, bws_access_token) for term in terms]
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue