Merge ~gabrielcocenza/charm-juju-lint:deprecation into charm-juju-lint:master

Proposed by Gabriel Cocenza
Status: Merged
Approved by: Gabriel Cocenza
Approved revision: c0bcb4ea87d487b7c0c685be86405cd037a3d96d
Merged at revision: 7c340a4a57957a5dc16e3888c5d6715c105dd11e
Proposed branch: ~gabrielcocenza/charm-juju-lint:deprecation
Merge into: charm-juju-lint:master
Diff against target: 36 lines (+18/-0)
1 file modified
src/charm.py (+18/-0)
Reviewer Review Type Date Requested Status
🤖 prod-jenkaas-bootstack (community) continuous-integration Approve
Andrea Ieri Approve
BootStack Reviewers Pending
Review via email: mp+436409@code.launchpad.net

Commit message

added deprecation logs and status for juju-lint as a principal charm.

To post a comment you must log in.
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

This merge proposal is being monitored by mergebot. Change the status to Approved to merge.

Revision history for this message
🤖 prod-jenkaas-bootstack (prod-jenkaas-bootstack) wrote :
review: Approve (continuous-integration)
Revision history for this message
Andrea Ieri (aieri) wrote :

small nit, lgtm otherwise

review: Approve
Revision history for this message
Gabriel Cocenza (gabrielcocenza) :
Revision history for this message
🤖 prod-jenkaas-bootstack (prod-jenkaas-bootstack) wrote :
review: Approve (continuous-integration)
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

Change successfully merged at revision 7c340a4a57957a5dc16e3888c5d6715c105dd11e

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/src/charm.py b/src/charm.py
2index d6c1b69..8518f9b 100755
3--- a/src/charm.py
4+++ b/src/charm.py
5@@ -9,6 +9,7 @@ import logging
6 from ops.charm import CharmBase
7 from ops.framework import StoredState
8 from ops.main import main
9+from ops.model import ActiveStatus
10
11 from lib_jujulint import JujuLintHelper
12
13@@ -37,6 +38,23 @@ class JujuLintCharm(CharmBase):
14 self.on.nrpe_external_master_relation_changed,
15 self.on_nem_changed,
16 )
17+ self.framework.observe(self.on.update_status, self.on_update_status)
18+
19+ # NOTE(gabrielcocenza) This should be removed in the next release
20+ # that the charm is subordinate.
21+ def on_update_status(self, event):
22+ """Set deprecation logs and status."""
23+ logging.warning("Juju-Lint as principal charm has been deprecated")
24+ logging.warning(
25+ (
26+ "To upgrade the charm you should re-deploy it as subordinate. "
27+ "See the readme on the project for more details"
28+ )
29+ )
30+ if self.helper.verify_config():
31+ self.model.unit.status = ActiveStatus(
32+ "Deprecated. See instructions on README"
33+ )
34
35 def on_upgrade_charm(self, event):
36 """Handle upgrade and resource updates."""

Subscribers

People subscribed via source and target branches

to all changes: