Skip to content

Commit

Permalink
Update dependencies of the charm (#313)
Browse files Browse the repository at this point in the history
## Issue
This PR updates dependencies of the charm:
- charm libs
- pip packages 
- juju version on CI
- copyright date on header of every file
  • Loading branch information
Mehdi-Bendriss authored May 24, 2024
1 parent 4887802 commit b330452
Show file tree
Hide file tree
Showing 101 changed files with 303 additions and 276 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2022 Canonical Ltd.
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.
name: Tests

Expand Down Expand Up @@ -67,7 +67,7 @@ jobs:
cache: true

integration-test:
name: Integration test charm | 3.3.4
name: Integration test charm | 3.4.2
needs:
- lint
- unit-test
Expand All @@ -76,7 +76,7 @@ jobs:
with:
artifact-prefix: packed-charm-cache-true
cloud: lxd
juju-agent-version: 3.3.4
juju-agent-version: 3.4.2
secrets:
# GitHub appears to redact each line of a multi-line secret
# Avoid putting `{` or `}` on a line by itself so that it doesn't get redacted in logs
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2023 Canonical Ltd.
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.
name: Release to latest/edge

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sync_issue_to_jira.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2023 Canonical Ltd.
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.
name: Sync issue to Jira

Expand Down
29 changes: 26 additions & 3 deletions lib/charms/data_platform_libs/v0/s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def _on_credential_gone(self, event: CredentialsGoneEvent):

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

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -212,7 +212,7 @@ class S3CredentialEvents(CharmEvents):
class S3Provider(Object):
"""A provider handler for communicating S3 credentials to consumers."""

on = S3CredentialEvents() # pyright: ignore [reportGeneralTypeIssues]
on = S3CredentialEvents() # pyright: ignore [reportAssignmentType]

def __init__(
self,
Expand Down Expand Up @@ -481,6 +481,18 @@ def set_s3_api_version(self, relation_id: int, s3_api_version: str) -> None:
"""
self.update_connection_info(relation_id, {"s3-api-version": s3_api_version})

def set_delete_older_than_days(self, relation_id: int, days: int) -> None:
"""Sets the retention days for full backups in application databag.
This function writes in the application data bag, therefore,
only the leader unit can call it.
Args:
relation_id: the identifier for a particular relation.
days: the value.
"""
self.update_connection_info(relation_id, {"delete-older-than-days": str(days)})

def set_attributes(self, relation_id: int, attributes: List[str]) -> None:
"""Sets the connection attributes in application databag.
Expand Down Expand Up @@ -580,6 +592,17 @@ def s3_api_version(self) -> Optional[str]:

return self.relation.data[self.relation.app].get("s3-api-version")

@property
def delete_older_than_days(self) -> Optional[int]:
"""Returns the retention days for full backups."""
if not self.relation.app:
return None

days = self.relation.data[self.relation.app].get("delete-older-than-days")
if days is None:
return None
return int(days)

@property
def attributes(self) -> Optional[List[str]]:
"""Returns the attributes."""
Expand Down Expand Up @@ -613,7 +636,7 @@ class S3CredentialRequiresEvents(ObjectEvents):
class S3Requirer(Object):
"""Requires-side of the s3 relation."""

on = S3CredentialRequiresEvents() # pyright: ignore[reportGeneralTypeIssues]
on = S3CredentialRequiresEvents() # pyright: ignore[reportAssignmentType]

def __init__(
self, charm: ops.charm.CharmBase, relation_name: str, bucket_name: Optional[str] = None
Expand Down
2 changes: 1 addition & 1 deletion lib/charms/opensearch/v0/constants_charm.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2023 Canonical Ltd.
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.

"""In this file we declare the constants and enums used by the charm."""
Expand Down
2 changes: 1 addition & 1 deletion lib/charms/opensearch/v0/constants_secrets.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2023 Canonical Ltd.
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.

"""In this file we declare the constants and enums used by Juju secrets in Opensearch."""
Expand Down
2 changes: 1 addition & 1 deletion lib/charms/opensearch/v0/constants_tls.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2023 Canonical Ltd.
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.

"""In this file we declare the constants and enums used by TLS related components."""
Expand Down
2 changes: 1 addition & 1 deletion lib/charms/opensearch/v0/helper_charm.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2023 Canonical Ltd.
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.

"""Utility functions for charms related operations."""
Expand Down
2 changes: 1 addition & 1 deletion lib/charms/opensearch/v0/helper_cluster.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2023 Canonical Ltd.
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.

"""Utility classes and methods for getting cluster info, configuration info and suggestions."""
Expand Down
2 changes: 1 addition & 1 deletion lib/charms/opensearch/v0/helper_conf_setter.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2023 Canonical Ltd.
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.

"""Utilities for editing yaml config files at any depth level and maintaining comments."""
Expand Down
2 changes: 1 addition & 1 deletion lib/charms/opensearch/v0/helper_enums.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2023 Canonical Ltd.
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.

"""In this file we declare the base enum types with string and other types' representations."""
Expand Down
2 changes: 1 addition & 1 deletion lib/charms/opensearch/v0/helper_http.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2023 Canonical Ltd.
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.

"""File containing http related helpers."""
Expand Down
2 changes: 1 addition & 1 deletion lib/charms/opensearch/v0/helper_networking.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2023 Canonical Ltd.
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.

"""Helpers for networking related operations."""
Expand Down
2 changes: 1 addition & 1 deletion lib/charms/opensearch/v0/helper_security.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2023 Canonical Ltd.
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.

"""Helpers for security related operations, such as password generation etc."""
Expand Down
2 changes: 1 addition & 1 deletion lib/charms/opensearch/v0/models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2023 Canonical Ltd.
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.

"""Cluster-related data structures / model classes."""
Expand Down
2 changes: 1 addition & 1 deletion lib/charms/opensearch/v0/opensearch_backups.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2023 Canonical Ltd.
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.

"""OpenSearch Backup.
Expand Down
2 changes: 1 addition & 1 deletion lib/charms/opensearch/v0/opensearch_base_charm.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2023 Canonical Ltd.
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.

"""Base class for the OpenSearch Operators."""
Expand Down
2 changes: 1 addition & 1 deletion lib/charms/opensearch/v0/opensearch_config.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2023 Canonical Ltd.
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.

"""Class for Setting configuration in opensearch config files."""
Expand Down
2 changes: 1 addition & 1 deletion lib/charms/opensearch/v0/opensearch_distro.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2023 Canonical Ltd.
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.

"""Base class for Opensearch distributions."""
Expand Down
2 changes: 1 addition & 1 deletion lib/charms/opensearch/v0/opensearch_exceptions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2023 Canonical Ltd.
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.

"""File containing all OpenSearch related exceptions."""
Expand Down
2 changes: 1 addition & 1 deletion lib/charms/opensearch/v0/opensearch_fixes.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2023 Canonical Ltd.
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.

"""Base class for the OpenSearch Fixes of bugs introduced by upstream."""
Expand Down
2 changes: 1 addition & 1 deletion lib/charms/opensearch/v0/opensearch_health.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2023 Canonical Ltd.
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.

"""Base class for the OpenSearch Health management."""
Expand Down
2 changes: 1 addition & 1 deletion lib/charms/opensearch/v0/opensearch_internal_data.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2023 Canonical Ltd.
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.

"""Utility classes for app / unit data bag related operations."""
Expand Down
2 changes: 1 addition & 1 deletion lib/charms/opensearch/v0/opensearch_keystore.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2023 Canonical Ltd.
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.

"""Implements the keystore logic.
Expand Down
2 changes: 1 addition & 1 deletion lib/charms/opensearch/v0/opensearch_locking.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2023 Canonical Ltd.
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.

"""Ensure that only one node (re)starts, joins the cluster, or leaves the cluster at a time."""
Expand Down
2 changes: 1 addition & 1 deletion lib/charms/opensearch/v0/opensearch_nodes_exclusions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2023 Canonical Ltd.
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.

"""Base class for OpenSearch node exclusions management."""
Expand Down
2 changes: 1 addition & 1 deletion lib/charms/opensearch/v0/opensearch_peer_clusters.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2023 Canonical Ltd.
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.

"""Class for Managing simple or large deployments and configuration related changes."""
Expand Down
2 changes: 1 addition & 1 deletion lib/charms/opensearch/v0/opensearch_plugin_manager.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2023 Canonical Ltd.
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.

"""Implements the plugin manager class.
Expand Down
2 changes: 1 addition & 1 deletion lib/charms/opensearch/v0/opensearch_plugins.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2023 Canonical Ltd.
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.

"""OpenSearch Plugin Model.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2023 Canonical Ltd.
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.

"""Peer clusters relation related classes for OpenSearch."""
Expand Down
2 changes: 1 addition & 1 deletion lib/charms/opensearch/v0/opensearch_relation_provider.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2023 Canonical Ltd.
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.

"""OpenSearch client relation hooks & helpers.
Expand Down
2 changes: 1 addition & 1 deletion lib/charms/opensearch/v0/opensearch_secrets.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2023 Canonical Ltd.
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.

"""This class is to handle Juju3 Secrets.
Expand Down
2 changes: 1 addition & 1 deletion lib/charms/opensearch/v0/opensearch_tls.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2023 Canonical Ltd.
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.

"""In this class we manage certificates relation.
Expand Down
2 changes: 1 addition & 1 deletion lib/charms/opensearch/v0/opensearch_users.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2023 Canonical Ltd.
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.

"""OpenSearch user helper functions.
Expand Down
9 changes: 6 additions & 3 deletions lib/charms/operator_libs_linux/v2/snap.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@

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


# Regex to locate 7-bit C1 ANSI sequences
Expand Down Expand Up @@ -584,13 +584,16 @@ def ensure(
"Installing snap %s, revision %s, tracking %s", self._name, revision, channel
)
self._install(channel, cohort, revision)
else:
logger.info("The snap installation completed successfully")
elif revision is None or revision != self._revision:
# The snap is installed, but we are changing it (e.g., switching channels).
logger.info(
"Refreshing snap %s, revision %s, tracking %s", self._name, revision, channel
)
self._refresh(channel=channel, cohort=cohort, revision=revision, devmode=devmode)
logger.info("The snap installation completed successfully")
logger.info("The snap refresh completed successfully")
else:
logger.info("Refresh of snap %s was unnecessary", self._name)

self._update_snap_apps()
self._state = state
Expand Down
Loading

0 comments on commit b330452

Please sign in to comment.