Skip to content

Commit

Permalink
Merge branch 'canonical:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Zvirovyi authored Apr 5, 2024
2 parents 160fc25 + faa360a commit 5b31911
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 53 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ on:
jobs:
lint:
name: Lint
uses: canonical/data-platform-workflows/.github/workflows/lint.yaml@v13.0.0
uses: canonical/data-platform-workflows/.github/workflows/lint.yaml@v13.1.0

unit-test:
name: Unit test charm
Expand All @@ -43,7 +43,7 @@ jobs:

build:
name: Build charm
uses: canonical/data-platform-workflows/.github/workflows/build_charm.yaml@v13.0.0
uses: canonical/data-platform-workflows/.github/workflows/build_charm.yaml@v13.1.0
with:
cache: true

Expand All @@ -62,7 +62,7 @@ jobs:
- lint
- unit-test
- build
uses: canonical/data-platform-workflows/.github/workflows/integration_test_charm.yaml@v13.0.0
uses: canonical/data-platform-workflows/.github/workflows/integration_test_charm.yaml@v13.1.0
with:
artifact-prefix: ${{ needs.build.outputs.artifact-prefix }}
cloud: lxd
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ jobs:

build:
name: Build charm
uses: canonical/data-platform-workflows/.github/workflows/build_charm.yaml@v13.0.0
uses: canonical/data-platform-workflows/.github/workflows/build_charm.yaml@v13.1.0

release:
name: Release charm
needs:
- ci-tests
- build
uses: canonical/data-platform-workflows/.github/workflows/release_charm.yaml@v13.0.0
uses: canonical/data-platform-workflows/.github/workflows/release_charm.yaml@v13.1.0
with:
channel: 14/edge
artifact-prefix: ${{ needs.build.outputs.artifact-prefix }}
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
Expand Up @@ -9,7 +9,7 @@ on:
jobs:
sync:
name: Sync GitHub issue to Jira
uses: canonical/data-platform-workflows/.github/workflows/sync_issue_to_jira.yaml@v13.0.0
uses: canonical/data-platform-workflows/.github/workflows/sync_issue_to_jira.yaml@v13.1.0
with:
jira-base-url: https://warthogs.atlassian.net
jira-project-key: DPE
Expand Down
80 changes: 40 additions & 40 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ repository = "https://github.com/canonical/postgresql-operator"
python = "^3.10"
ops = "^2.12.0"
cryptography = "^42.0.5"
boto3 = "^1.34.74"
boto3 = "^1.34.76"
pgconnstr = "^1.0.1"
requests = "^2.31.0"
tenacity = "^8.2.3"
Expand All @@ -42,7 +42,7 @@ jsonschema = "*"
optional = true

[tool.poetry.group.format.dependencies]
ruff = "^0.3.4"
ruff = "^0.3.5"

[tool.poetry.group.lint]
optional = true
Expand All @@ -66,17 +66,17 @@ optional = true

[tool.poetry.group.integration.dependencies]
pytest = "^8.1.1"
pytest-github-secrets = {git = "https://github.com/canonical/data-platform-workflows", tag = "v13.0.0", subdirectory = "python/pytest_plugins/github_secrets"}
pytest-github-secrets = {git = "https://github.com/canonical/data-platform-workflows", tag = "v13.1.0", subdirectory = "python/pytest_plugins/github_secrets"}
pytest-operator = "^0.34.0"
pytest-operator-cache = {git = "https://github.com/canonical/data-platform-workflows", tag = "v13.0.0", subdirectory = "python/pytest_plugins/pytest_operator_cache"}
pytest-operator-groups = {git = "https://github.com/canonical/data-platform-workflows", tag = "v13.0.0", subdirectory = "python/pytest_plugins/pytest_operator_groups"}
pytest-operator-cache = {git = "https://github.com/canonical/data-platform-workflows", tag = "v13.1.0", subdirectory = "python/pytest_plugins/pytest_operator_cache"}
pytest-operator-groups = {git = "https://github.com/canonical/data-platform-workflows", tag = "v13.1.0", subdirectory = "python/pytest_plugins/pytest_operator_groups"}
juju = "^3.3.0.0"
boto3 = "*"
tenacity = "*"
landscape-api-py3 = "^0.9.0"
mailmanclient = "^3.3.5"
psycopg2-binary = "^2.9.9"
allure-pytest = "^2.13.4"
allure-pytest = "^2.13.5"

# Testing tools configuration
[tool.coverage.run]
Expand Down
12 changes: 12 additions & 0 deletions src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
import os
import platform
import subprocess
import sys
from pathlib import Path
from typing import Dict, List, Literal, Optional, Set, get_args

import psycopg2
Expand Down Expand Up @@ -106,6 +108,16 @@ class PostgresqlOperatorCharm(TypedCharmBase[CharmConfig]):
def __init__(self, *args):
super().__init__(*args)

# Support for disabling the operator.
disable_file = Path(f"{os.environ.get('CHARM_DIR')}/disable")
if disable_file.exists():
logger.warning(
f"\n\tDisable file `{disable_file.resolve()}` found, the charm will skip all events."
"\n\tTo resume normal operations, please remove the file."
)
self.unit.status = BlockedStatus("Disabled")
sys.exit(0)

self.peer_relation_app = DataPeer(
self,
relation_name=PEER,
Expand Down
2 changes: 1 addition & 1 deletion src/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ def get_patroni_health(self) -> Dict[str, str]:
timeout=API_REQUEST_TIMEOUT,
)

return r.json()
return r.json()

@property
def is_creating_backup(self) -> bool:
Expand Down

0 comments on commit 5b31911

Please sign in to comment.