Fix Hashi login method for approles

Moves Hashi Vault client login to use `auth.approle.login` as
current method is being deprecated in the next release.

```
DeprecationWarning: Call to deprecated function 'auth_approle'.
This method will be removed in version '0.12.0' Please use
the 'login' method on the 'hvac.api.auth_methods.approle'
class moving forward.
client.auth_approle(vault_role_id, vault_secret_id)
```

Change-Id: Ie5c1ebe99c8508336cc10944fdaa742ad7d1d85e
This commit is contained in:
Scott Solkhon 2022-09-02 16:39:36 +01:00
parent b0dc2423bc
commit 3300815529
1 changed files with 2 additions and 1 deletions

View File

@ -55,7 +55,8 @@ def hashicorp_vault_client(vault_namespace, vault_addr, vault_role_id,
namespace=vault_namespace)
else:
client = hvac.Client(url=vault_addr, namespace=vault_namespace)
client.auth_approle(vault_role_id, vault_secret_id)
client.auth.approle.login(role_id=vault_role_id,
secret_id=vault_secret_id)
if not client.is_authenticated():
print('Failed to authenticate to vault')