Skip to content

Commit

Permalink
Update charm libraries (#121)
Browse files Browse the repository at this point in the history
* chore: update charm libraries

* Lint

---------

Co-authored-by: Github Actions <github-actions@github.com>
Co-authored-by: sed-i <82407168+sed-i@users.noreply.github.com>
  • Loading branch information
3 people authored Feb 1, 2023
1 parent efd670d commit afb95bc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def setUp(self, *unused):

# Increment this PATCH version before using `charmcraft publish-lib` or reset
# to 0 if you are raising the major API version
LIBPATCH = 2
LIBPATCH = 3


_Decimal = Union[Decimal, float, str, int] # types that are potentially convertible to Decimal
Expand All @@ -158,21 +158,23 @@ def adjust_resource_requirements(
An adjusted (limits, requests) 2-tuple.
>>> adjust_resource_requirements({}, {})
ResourceRequirements(limits={}, requests={})
ResourceRequirements(claims=None, limits={}, requests={})
>>> adjust_resource_requirements({"cpu": "1"}, {})
ResourceRequirements(limits={'cpu': '1'}, requests={'cpu': '1'})
ResourceRequirements(claims=None, limits={'cpu': '1'}, requests={'cpu': '1'})
>>> adjust_resource_requirements({"cpu": "1"}, {"cpu": "2"}, True)
ResourceRequirements(limits={'cpu': '2'}, requests={'cpu': '2'})
ResourceRequirements(claims=None, limits={'cpu': '2'}, requests={'cpu': '2'})
>>> adjust_resource_requirements({"cpu": "1"}, {"cpu": "2"}, False)
ResourceRequirements(limits={'cpu': '1'}, requests={'cpu': '1'})
ResourceRequirements(claims=None, limits={'cpu': '1'}, requests={'cpu': '1'})
>>> adjust_resource_requirements({"cpu": "1"}, {"memory": "1G"}, True)
ResourceRequirements(limits={'cpu': '1'}, requests={'memory': '1G', 'cpu': '1'})
ResourceRequirements(claims=None, limits={'cpu': '1'}, requests={'memory': '1G', 'cpu': '1'})
>>> adjust_resource_requirements({"cpu": "1"}, {"memory": "1G"}, False)
ResourceRequirements(limits={'cpu': '1'}, requests={'memory': '1G', 'cpu': '1'})
ResourceRequirements(claims=None, limits={'cpu': '1'}, requests={'memory': '1G', 'cpu': '1'})
>>> adjust_resource_requirements({"cpu": "1", "memory": "1"}, {"memory": "2"}, True)
ResourceRequirements(limits={'cpu': '1', 'memory': '2'}, requests={'memory': '2', 'cpu': '1'})
ResourceRequirements(\
claims=None, limits={'cpu': '1', 'memory': '2'}, requests={'memory': '2', 'cpu': '1'})
>>> adjust_resource_requirements({"cpu": "1", "memory": "1"}, {"memory": "1G"}, False)
ResourceRequirements(limits={'cpu': '1', 'memory': '1'}, requests={'memory': '1', 'cpu': '1'})
ResourceRequirements(\
claims=None, limits={'cpu': '1', 'memory': '1'}, requests={'memory': '1', 'cpu': '1'})
>>> adjust_resource_requirements({"custom-resource": "1"}, {"custom-resource": "2"}, False)
Traceback (most recent call last):
...
Expand Down
2 changes: 1 addition & 1 deletion src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ def _push_config_and_reload(self, pending_config: List[Tuple[str, str]]): # noq
Raises:
ConfigUpdateFailure, if config update fails.
"""
for (path, contents) in pending_config:
for path, contents in pending_config:
try:
self.container.push(path, contents, make_dirs=True)
except ConnectionError as e:
Expand Down

0 comments on commit afb95bc

Please sign in to comment.