Skip to content

Commit

Permalink
chore: update charm libraries (#196)
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Weii Wang <[email protected]>
  • Loading branch information
github-actions[bot] and weiiwang01 authored Mar 6, 2024
1 parent 4cb03dc commit d938cf8
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions lib/charms/loki_k8s/v0/loki_push_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ def _alert_rules_error(self, event):

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

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -2116,15 +2116,14 @@ def _download_and_push_promtail_to_workload(self, promtail_info: dict) -> None:
- "binsha": sha256 sum of unpacked promtail binary
"""
# Check for Juju proxy variables and fall back to standard ones if not set
proxies: Optional[Dict[str, str]] = {}
if proxies and os.environ.get("JUJU_CHARM_HTTP_PROXY"):
proxies.update({"http": os.environ["JUJU_CHARM_HTTP_PROXY"]})
if proxies and os.environ.get("JUJU_CHARM_HTTPS_PROXY"):
proxies.update({"https": os.environ["JUJU_CHARM_HTTPS_PROXY"]})
if proxies and os.environ.get("JUJU_CHARM_NO_PROXY"):
proxies.update({"no_proxy": os.environ["JUJU_CHARM_NO_PROXY"]})
else:
proxies = None
# If no Juju proxy variable was set, we set proxies to None to let the ProxyHandler get
# the proxy env variables from the environment
proxies = {
"https_proxy": os.environ.get("JUJU_CHARM_HTTPS_PROXY", ""),
"http_proxy": os.environ.get("JUJU_CHARM_HTTP_PROXY", ""),
"no_proxy": os.environ.get("JUJU_CHARM_NO_PROXY", ""),
}
proxies = {k: v for k, v in proxies.items() if v != ""} or None

proxy_handler = request.ProxyHandler(proxies)
opener = request.build_opener(proxy_handler)
Expand Down

0 comments on commit d938cf8

Please sign in to comment.