feat: add sync with bitwarden before getting a secret

This commit is contained in:
Matthias Ludwig 2023-07-12 11:05:01 +02:00
parent 4d36cd468f
commit 0e33c33415

View File

@ -8,9 +8,15 @@ class BitwardenCommandException(Exception):
def get_secret_from_bitwarden(logger, id): def get_secret_from_bitwarden(logger, id):
sync_bw(logger)
return command_wrapper(logger, command=f"get item {id}") return command_wrapper(logger, command=f"get item {id}")
def sync_bw(logger):
status_output = command_wrapper(logger, command=f"sync")
logger.info(f"Sync successful {status_output}")
def unlock_bw(logger): def unlock_bw(logger):
status_output = command_wrapper(logger, "status", False) status_output = command_wrapper(logger, "status", False)
status = status_output['data']['template']['status'] status = status_output['data']['template']['status']