Skip to content

Commit b20a45d

Browse files
authored
Merge pull request #31 from canonical/fix-primary-failover
Refresh leader node during leader_elected hook
2 parents 3659075 + 22d0575 commit b20a45d

22 files changed

Lines changed: 26 additions & 23 deletions

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@
187187
same "printed page" as the copyright notice for easier
188188
identification within third-party archives.
189189

190-
Copyright 2025 Canonical Ltd.
190+
Copyright 2026 Canonical Ltd.
191191

192192
Licensed under the Apache License, Version 2.0 (the "License");
193193
you may not use this file except in compliance with the License.

charmcraft.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2025 Canonical Ltd.
1+
# Copyright 2026 Canonical Ltd.
22
# See LICENSE file for licensing details.
33

44
name: git-ubuntu

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2025 Canonical Ltd.
1+
# Copyright 2026 Canonical Ltd.
22
# See LICENSE file for licensing details.
33

44
[project]

src/charm.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env python3
2-
# Copyright 2025 Canonical Ltd.
2+
# Copyright 2026 Canonical Ltd.
33
# See LICENSE file for licensing details.
44
#
55
# Learn more at: https://juju.is/docs/sdk
@@ -456,7 +456,10 @@ def _on_config_changed(self, _: ops.ConfigChangedEvent) -> None:
456456

457457
def _on_leader_elected(self, _: ops.LeaderElectedEvent) -> None:
458458
"""Refresh services and update peer data when the unit is elected as leader."""
459-
if not self._set_peer_primary_node_address():
459+
if self._set_peer_primary_node_address():
460+
self._refresh_importer_node()
461+
self._start_services()
462+
else:
460463
self.unit.status = ops.BlockedStatus(
461464
"Failed to update primary node IP in peer relation."
462465
)

src/environment.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env python3
2-
# Copyright 2025 Canonical Ltd.
2+
# Copyright 2026 Canonical Ltd.
33
# See LICENSE file for licensing details.
44

55
"""Environment information extraction."""

src/git_ubuntu.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env python3
2-
# Copyright 2025 Canonical Ltd.
2+
# Copyright 2026 Canonical Ltd.
33
# See LICENSE file for licensing details.
44

55
"""Git Ubuntu service runner and configurator."""

src/importer_node.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env python3
2-
# Copyright 2025 Canonical Ltd.
2+
# Copyright 2026 Canonical Ltd.
33
# See LICENSE file for licensing details.
44

55
"""Manager of files and git-ubuntu instances on the local system."""

src/launchpad.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env python3
2-
# Copyright 2025 Canonical Ltd.
2+
# Copyright 2026 Canonical Ltd.
33
# See LICENSE file for licensing details.
44

55
"""Launchpad interaction and tools."""

src/package_installation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env python3
2-
# Copyright 2025 Canonical Ltd.
2+
# Copyright 2026 Canonical Ltd.
33
# See LICENSE file for licensing details.
44

55
"""Snap and Apt package installation and update functions."""

src/service_management.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env python3
2-
# Copyright 2025 Canonical Ltd.
2+
# Copyright 2026 Canonical Ltd.
33
# See LICENSE file for licensing details.
44

55
"""Systemd service management functions."""

0 commit comments

Comments
 (0)