mirror of
https://github.com/saltstack/salt.git
synced 2025-04-16 09:40:20 +00:00
Fix vault ext pillar return data for KV v2
This commit is contained in:
parent
468ebed676
commit
46339d9e79
2 changed files with 10 additions and 8 deletions
1
changelog/62651.fixed
Normal file
1
changelog/62651.fixed
Normal file
|
@ -0,0 +1 @@
|
|||
Fixed vault ext pillar return data for KV v2
|
|
@ -123,9 +123,9 @@ minion-passwd minionbadpasswd1
|
|||
|
||||
import logging
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
from requests.exceptions import HTTPError
|
||||
|
||||
__func_alias__ = {"set_": "set"}
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def __virtual__():
|
||||
|
@ -162,12 +162,13 @@ def ext_pillar(
|
|||
|
||||
url = "v1/{}".format(path)
|
||||
response = __utils__["vault.make_request"]("GET", url)
|
||||
if response.status_code == 200:
|
||||
response.raise_for_status()
|
||||
vault_pillar = response.json().get("data", {})
|
||||
else:
|
||||
|
||||
if vault_pillar and version2["v2"]:
|
||||
vault_pillar = vault_pillar["data"]
|
||||
except HTTPError:
|
||||
log.info("Vault secret not found for: %s", path)
|
||||
except KeyError:
|
||||
log.error("No such path in Vault: %s", path)
|
||||
|
||||
if nesting_key:
|
||||
vault_pillar = {nesting_key: vault_pillar}
|
||||
|
|
Loading…
Add table
Reference in a new issue