bitwarden: verifing if secret has been migrated to vault

Signed-off-by: Alexis Pentori <alexis@status.im>
This commit is contained in:
Alexis Pentori 2024-08-06 17:24:36 +02:00
parent 019772b96c
commit 7207048797
No known key found for this signature in database
GPG Key ID: 65250D2801E47A10
1 changed files with 3 additions and 0 deletions

View File

@ -143,6 +143,7 @@ class Bitwarden(object):
return json.loads(self.get_entry(key, 'item'))
def get_notes(self, key):
print(f"{self._run(['get', key])}")
return self.get_item(key).get('notes')
def get_custom_field(self, key, field):
@ -188,6 +189,8 @@ class LookupModule(LookupBase):
return values
def lookup(self, term, kwargs):
if "Migrated to Vault" in self.bw.get_notes(term):
raise AnsibleError("Secret Migrated to Vault, please update Secret Source")
if 'file' in kwargs:
# Try attachments first
itemid = self.bw.get_itemid(term)