ossobv / vcutil

Misc. simple utilities to aid version control and host maintenance.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

zabdig fails when store is locked

osso-rkuper opened this issue · comments

problem:

Traceback (most recent call last):
  File "/usr/bin/zabdig", line 656, in <module>
    main()
  File "/usr/bin/zabdig", line 595, in main
    (user, password) = get_from_secret_storage(args.section)
  File "/usr/bin/zabdig", line 528, in get_from_secret_storage
    res[0].ensure_not_locked()
  File "/home/robin/.virtualenvs/kubernetes-ansible/lib/python3.10/site-packages/secretstorage/item.py", line 49, in ensure_not_locked
    raise LockedException('Item is locked!')
secretstorage.exceptions.LockedException: Item is locked!

fix:

--- /usr/bin/zabdig	2022-09-15 11:17:37.000000000 +0200
+++ zabdig	2022-09-30 11:47:12.660298476 +0200
@@ -507,6 +507,8 @@ def get_from_secret_storage(section):
         attrs = {'application': 'zabdig'}
         if section:
             attrs['section'] = section
+        if coll.is_locked():
+            coll.unlock()
         res = [i for i in coll.search_items(attrs)]
         # FIXME: add 'or True' to overwrite previous passwords
         if not res:   # or True: