Skip to content

Commit

Permalink
bugfix - Prevent passwordstore lookup to create subkey when create ==…
Browse files Browse the repository at this point in the history
… false

Close #ansible-collections#9105
  • Loading branch information
mluzarreta committed Nov 7, 2024
1 parent e13d6de commit 4f9bf46
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- passwordstore lookup plugin - Fix subkey creation even when `create == false`.
6 changes: 3 additions & 3 deletions plugins/lookup/passwordstore.py
Original file line number Diff line number Diff line change
Expand Up @@ -582,9 +582,9 @@ def run(self, terms, variables, **kwargs):
if self.paramvals['overwrite']:
with self.opt_lock('write'):
result.append(self.update_password())
elif self.paramvals["subkey"] != "password" and not self.passdict.get(self.paramvals['subkey']): # password exists but not the subkey
with self.opt_lock('write'):
result.append(self.update_password())
if self.paramvals["subkey"] != "password" and not self.passdict.get(self.paramvals['subkey']): # password exists but not the subkey
with self.opt_lock('write'):
result.append(self.update_password())
else:
result.append(self.get_passresult())
else: # password does not exist
Expand Down

0 comments on commit 4f9bf46

Please sign in to comment.