mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-02 06:19:10 -07:00
linode: Allow templating token for dynamic inventory (#4040)
* linode: Allow templating token for dynamic inventory Template the value for the access_token if it's a Jinja template. Allows for looking up tokens from files or pulling from secrets stores like Vault. * add Linode changelog fragment * Fix lookup example for newer versions of Ansible Co-authored-by: Felix Fontein <felix@fontein.de> * Rename test case for clarity Co-authored-by: Felix Fontein <felix@fontein.de> Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
84124224ae
commit
f77a1114fb
3 changed files with 19 additions and 4 deletions
|
@ -31,6 +31,7 @@ mandatory_py_version = pytest.mark.skipif(
|
|||
|
||||
|
||||
from ansible.errors import AnsibleError, AnsibleParserError
|
||||
from ansible.parsing.dataloader import DataLoader
|
||||
from ansible_collections.community.general.plugins.inventory.linode import InventoryModule
|
||||
|
||||
|
||||
|
@ -39,10 +40,11 @@ def inventory():
|
|||
return InventoryModule()
|
||||
|
||||
|
||||
def test_access_token_lookup(inventory):
|
||||
def test_missing_access_token_lookup(inventory):
|
||||
loader = DataLoader()
|
||||
inventory._options = {'access_token': None}
|
||||
with pytest.raises(AnsibleError) as error_message:
|
||||
inventory._build_client()
|
||||
inventory._build_client(loader)
|
||||
assert 'Could not retrieve Linode access token' in error_message
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue