Skip to content

Commit

Permalink
Merge branch 'main' into ISD-1160/rockfile
Browse files Browse the repository at this point in the history
  • Loading branch information
Thanhphan1147 authored Oct 16, 2023
2 parents ed32d64 + 97e3136 commit 90b2054
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
1 change: 1 addition & 0 deletions .github/workflows/integration_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ jobs:
name: Integration Test (With Secrets)
steps:
- uses: actions/checkout@v4
- run: sudo rm -rf /usr/local/lib/android
- name: Setup Devstack Swift
id: setup-devstack-swift
uses: canonical/setup-devstack-swift@v1
Expand Down
14 changes: 12 additions & 2 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 = 21
LIBPATCH = 22

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -1773,6 +1773,8 @@ def __init__(
recursive: bool = False,
container_name: str = "",
promtail_resource_name: Optional[str] = None,
*, # TODO: In v1, move the star up so everything after 'charm' is a kwarg
insecure_skip_verify: bool = False,
):
super().__init__(charm, relation_name, alert_rules_path, recursive)
self._charm = charm
Expand All @@ -1792,6 +1794,7 @@ def __init__(
self._is_syslog = enable_syslog
self.topology = JujuTopology.from_charm(charm)
self._promtail_resource_name = promtail_resource_name or "promtail-bin"
self.insecure_skip_verify = insecure_skip_verify

# architecture used for promtail binary
arch = platform.processor()
Expand Down Expand Up @@ -2153,8 +2156,15 @@ def _current_config(self) -> dict:

@property
def _promtail_config(self) -> dict:
"""Generates the config file for Promtail."""
"""Generates the config file for Promtail.
Reference: https://grafana.com/docs/loki/latest/send-data/promtail/configuration
"""
config = {"clients": self._clients_list()}
if self.insecure_skip_verify:
for client in config["clients"]:
client["tls_config"] = {"insecure_skip_verify": True}

config.update(self._server_config())
config.update(self._positions())
config.update(self._scrape_configs())
Expand Down
8 changes: 7 additions & 1 deletion src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,13 @@ def _wp_addon_list(self, addon_type: str):
keys: name, status, update and version.
"""
self._check_addon_type(addon_type)
process = self._run_wp_cli(["wp", addon_type, "list", "--format=json"], timeout=600)
# FIXME: the feedwordpress plugin causes the `wp theme list` command to fail occasionally
# use retries as a temporary workaround for this issue
for wait in (1, 3, 5, 5, 5):
process = self._run_wp_cli(["wp", addon_type, "list", "--format=json"], timeout=600)
if process.return_code == 0:
break
time.sleep(wait)
if process.return_code != 0:
return types_.ExecResult(
success=False, result=None, message=f"wp {addon_type} list command failed"
Expand Down

0 comments on commit 90b2054

Please sign in to comment.