Skip to content

Commit

Permalink
Merge pull request #472 from flyingcircusio/phil/relax-require_one
Browse files Browse the repository at this point in the history
relax require_one
  • Loading branch information
zagy authored Sep 10, 2024
2 parents c980406 + 97714ef commit 3f10a8a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
## 2.5.1 (unreleased)
---------------------

- Nothing changed yet.
- fix Component.require_one raising a configuration error with strict=False


## 2.5.0 (2024-09-04)
Expand Down
4 changes: 2 additions & 2 deletions src/batou/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -655,9 +655,9 @@ def require_one(
key, host
)
)
elif len(resources) == 0:
elif len(resources) == 0 and strict:
raise SilentConfigurationError()
return resources[0]
return resources[0] if resources else None

def assert_cmd(self, *args, **kw):
"""Assert that given command returns successfully, raise
Expand Down

0 comments on commit 3f10a8a

Please sign in to comment.