Skip to content

Commit

Permalink
update cloud_config_requirer lib (#205)
Browse files Browse the repository at this point in the history
* update cloud_config_requirer lib

* Pin websockets

Signed-off-by: Leon <[email protected]>

---------

Signed-off-by: Leon <[email protected]>
Co-authored-by: Leon <[email protected]>
  • Loading branch information
Abuelodelanada and sed-i authored Nov 14, 2024
1 parent 4d94da5 commit 179588d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
16 changes: 4 additions & 12 deletions lib/charms/grafana_cloud_integrator/v0/cloud_config_requirer.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

LIBID = "e6f580481c1b4388aa4d2cdf412a47fa"
LIBAPI = 0
LIBPATCH = 6
LIBPATCH = 7

DEFAULT_RELATION_NAME = "grafana-cloud-config"

Expand Down Expand Up @@ -83,16 +83,8 @@ def _events(self):
@property
def credentials(self):
"""Return the credentials, if any; otherwise, return None."""
if not all(
self._is_not_empty(x)
for x in [
self._data.get("username", ""),
self._data.get("password", ""),
]):
return Credentials(
self._data.get("username", ""),
self._data.get("password", "")
)
if (username := self._data.get("username", "").strip()) and (password := self._data.get("password", "").strip()):
return Credentials(username, password)
return None

@property
Expand Down Expand Up @@ -148,4 +140,4 @@ def _data(self):
for relation in self._charm.model.relations[self._relation_name]:
logger.info("%s %s %s", relation, self._relation_name, relation.data[relation.app])
return relation.data[relation.app]
return {}
return {}
2 changes: 2 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ deps =
asyncstdlib
# Libjuju needs to track the juju version
juju ~= 3.3.0
# https://github.com/juju/python-libjuju/issues/1184
websockets<14.0
# Temporarily pinning pytest due to https://github.com/charmed-kubernetes/pytest-operator/issues/131
pytest ~= 8.1.1
prometheus-api-client
Expand Down

0 comments on commit 179588d

Please sign in to comment.