Compare commits
2 Commits
8a6219718a
...
67692b372f
Author | SHA1 | Date | |
---|---|---|---|
|
67692b372f | ||
|
6a324e66da |
@ -1,4 +1,5 @@
|
|||||||
import os
|
import os
|
||||||
|
import json
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
class BitwardenCommandException(Exception):
|
class BitwardenCommandException(Exception):
|
||||||
@ -8,6 +9,11 @@ def get_secret_from_bitwarden(id):
|
|||||||
return command_wrapper(command=f"get item {id}")
|
return command_wrapper(command=f"get item {id}")
|
||||||
|
|
||||||
def unlock_bw(logger):
|
def unlock_bw(logger):
|
||||||
|
status_output = command_wrapper("status")
|
||||||
|
status = json.loads(status_output)['status']
|
||||||
|
if status == 'unlocked':
|
||||||
|
logger.info("Already unlocked")
|
||||||
|
return
|
||||||
token_output = command_wrapper("unlock --passwordenv BW_PASSWORD")
|
token_output = command_wrapper("unlock --passwordenv BW_PASSWORD")
|
||||||
tokens = token_output.split('"')[1::2]
|
tokens = token_output.split('"')[1::2]
|
||||||
os.environ["BW_SESSION"] = tokens[1]
|
os.environ["BW_SESSION"] = tokens[1]
|
||||||
|
Loading…
Reference in New Issue
Block a user