Skip to content

Commit 88b4cc7

Browse files
committed
chore: correct version_added
Remove changelog files that are managed in release PRs
1 parent df115f2 commit 88b4cc7

File tree

3 files changed

+11
-22
lines changed

3 files changed

+11
-22
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
minor_changes:
3+
- community.hashi_vault collection - add support for ``kubernetes`` auth method (https://github.com/ansible-collections/community.hashi_vault/pull/353).

plugins/doc_fragments/auth.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class ModuleDocFragment(object):
2020
- C(aws_iam_login) was renamed C(aws_iam) in collection version C(2.1.0) and was removed in C(3.0.0).
2121
- C(azure) auth method was added in collection version C(3.2.0).
2222
- C(gcp) auth method was added in collection version C(7.1.0).
23-
- C(kubernetes) auth method was added in collection version C(8.0.0).
23+
- C(kubernetes) auth method was added in collection version C(7.2.0).
2424
choices:
2525
- token
2626
- userpass
@@ -82,12 +82,12 @@ class ModuleDocFragment(object):
8282
kubernetes_token:
8383
description: The Kubernetes Token (JWT) to use for Kubernetes authentication to Vault.
8484
type: str
85-
version_added: 6.3.0
85+
version_added: 7.2.0
8686
kubernetes_token_path:
8787
description: If no kubernetes_token is specified, will try to read the token from this path.
8888
default: '/var/run/secrets/kubernetes.io/serviceaccount/token'
8989
type: str
90-
version_added: 6.3.0
90+
version_added: 7.2.0
9191
aws_profile:
9292
description: The AWS profile
9393
type: str

plugins/lookup/hashi_vault.py

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,6 @@
4949
secret:
5050
description: Vault path to the secret being requested in the format C(path[:field]).
5151
required: True
52-
secret_field:
53-
description:
54-
- Field within the secret being requested.
55-
- This is set automatically when using the C(secret:field) syntax.
56-
- Use of this option is discouraged in favor of the C(:field) syntax.
57-
required: False
58-
version_added: 6.3.0
5952
return_format:
6053
description:
6154
- Controls how multiple key/value pairs in a path are treated on return.
@@ -257,18 +250,9 @@
257250

258251
display = Display()
259252

260-
HAS_HVAC = False
261-
try:
262-
import hvac
263-
HAS_HVAC = True
264-
except ImportError:
265-
HAS_HVAC = False
266-
267253

268254
class LookupModule(HashiVaultLookupBase):
269255
def run(self, terms, variables=None, **kwargs):
270-
if not HAS_HVAC:
271-
raise AnsibleError("Please pip install hvac to use the hashi_vault lookup module.")
272256

273257
ret = []
274258

@@ -318,18 +302,20 @@ def field_ops(self):
318302
field = s_f[1]
319303
else:
320304
field = None
321-
self.set_option('secret_field', field)
305+
306+
self._secret_field = field
322307

323308
def get(self):
324309
'''gets a secret. should always return a list'''
325310

311+
field = self._secret_field
326312
secret = self.get_option('secret')
327-
field = self.get_option('secret_field')
328313
return_as = self.get_option('return_format')
314+
hvac_exceptions = self.helper.get_hvac().exceptions
329315

330316
try:
331317
data = self.client.read(secret)
332-
except hvac.exceptions.Forbidden:
318+
except hvac_exceptions.Forbidden:
333319
raise AnsibleError("Forbidden: Permission Denied to secret '%s'." % secret)
334320

335321
if data is None:

0 commit comments

Comments
 (0)