mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-25 06:10:22 -07:00
Clarify Error message when bitwarden vault not unlocked (#5811)
* Clarify Error message when vault not unlocked You can be logged into the Bitwarden-CLI, but it can still be locked. This took me several hours to debug, since every time I ran 'bw login' it told me, that I am already logged in. If you run 'bw unlock' without being logged in, you are prompted to log in. This clarifies the Error occurring and can drastically reduce debugging time, since you don't have to look into the source code to get an understanding of whats wrong. * RM: negation Nobody needs negation * Update function name * FIX: tests * ADD: changelog * Update changelogs/fragments/5811-clarify-bitwarden-error.yml Co-authored-by: Felix Fontein <felix@fontein.de> Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
6781dd1918
commit
bf117c839c
3 changed files with 8 additions and 6 deletions
|
@ -111,7 +111,7 @@ MOCK_RECORDS = [
|
|||
|
||||
class MockBitwarden(Bitwarden):
|
||||
|
||||
logged_in = True
|
||||
unlocked = True
|
||||
|
||||
def _get_matches(self, search_value, search_field="name"):
|
||||
return list(filter(lambda record: record[search_field] == search_value, MOCK_RECORDS))
|
||||
|
@ -119,7 +119,7 @@ class MockBitwarden(Bitwarden):
|
|||
|
||||
class LoggedOutMockBitwarden(MockBitwarden):
|
||||
|
||||
logged_in = False
|
||||
unlocked = False
|
||||
|
||||
|
||||
class TestLookupModule(unittest.TestCase):
|
||||
|
@ -155,7 +155,7 @@ class TestLookupModule(unittest.TestCase):
|
|||
self.lookup.run(['a_test'])[0])
|
||||
|
||||
@patch('ansible_collections.community.general.plugins.lookup.bitwarden._bitwarden', LoggedOutMockBitwarden())
|
||||
def test_bitwarden_plugin_logged_out(self):
|
||||
def test_bitwarden_plugin_unlocked(self):
|
||||
record = MOCK_RECORDS[0]
|
||||
record_name = record['name']
|
||||
with self.assertRaises(AnsibleError):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue