Skip to content

Commit

Permalink
Fix retrieving a password in case a function returns another callable
Browse files Browse the repository at this point in the history
  • Loading branch information
dmach committed Oct 13, 2023
1 parent 225fea0 commit 53968bf
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions osc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ def data(self):
# we use the password only from time to time to make a session cookie
# and there's no need to keep the password in program memory longer than necessary
result = self._data()

# the function can also return a function, let's evaluate them recursively
while callable(result):
result = result()

Check warning on line 110 in osc/conf.py

View check run for this annotation

Codecov / codecov/patch

osc/conf.py#L109-L110

Added lines #L109 - L110 were not covered by tests

if result is None:
raise oscerr.OscIOError(None, "Unable to retrieve password")
return result
Expand Down

0 comments on commit 53968bf

Please sign in to comment.