Merge ~mthaddon/mojo/+git/subordinates:source-relation-landscape into ~mojo-maintainers/mojo/+git/subordinates:master

Proposed by Tom Haddon
Status: Merged
Approved by: Tom Haddon
Approved revision: 6315704ce3fa429816b4489f89ecc77ee1927ca7
Merged at revision: dcb50e6de473999b7c3011774f792813f93610a9
Proposed branch: ~mthaddon/mojo/+git/subordinates:source-relation-landscape
Merge into: ~mojo-maintainers/mojo/+git/subordinates:master
Diff against target: 64 lines (+7/-4)
3 files modified
charms_to_relate.yaml (+1/-0)
tests/test_relations.py (+4/-4)
utils/relations.py (+2/-0)
Reviewer Review Type Date Requested Status
Gareth Woolridge Approve
Canonical IS Reviewers Pending
Review via email: mp+401931@code.launchpad.net

Commit message

Allow us to specify the source-relation of a charm we're installing everywhere, and do so for landscape-client

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
Gareth Woolridge (moon127) wrote :

LGTM

review: Approve
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

Change successfully merged at revision dcb50e6de473999b7c3011774f792813f93610a9

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/charms_to_relate.yaml b/charms_to_relate.yaml
2index 287c4df..1d081d3 100644
3--- a/charms_to_relate.yaml
4+++ b/charms_to_relate.yaml
5@@ -1,5 +1,6 @@
6 landscape-client:
7 install-everywhere: true
8+ source-relation: container
9 telegraf:
10 install-everywhere: true
11 relations:
12diff --git a/tests/test_relations.py b/tests/test_relations.py
13index ce9bed7..42fef33 100644
14--- a/tests/test_relations.py
15+++ b/tests/test_relations.py
16@@ -26,7 +26,7 @@ class TestUtilsRelations(unittest.TestCase):
17 _is_hulk_smashed.return_value = False
18 with self.assertLogs() as _logs:
19 expected_logs = [
20- "WARNING:root:DRYRUN: would run 'juju relate landscape-client:juju-info rabbitmq:juju-info'",
21+ "WARNING:root:DRYRUN: would run 'juju relate landscape-client:container rabbitmq:juju-info'",
22 "WARNING:root:DRYRUN: would run 'juju relate telegraf:juju-info rabbitmq:juju-info'",
23 "WARNING:root:DRYRUN: would run 'juju relate ubuntu-advantage:juju-info rabbitmq:juju-info'",
24 ]
25@@ -36,7 +36,7 @@ class TestUtilsRelations(unittest.TestCase):
26 applications = (('mysql', ''),)
27 with self.assertLogs() as _logs:
28 expected_logs = [
29- "WARNING:root:DRYRUN: would run 'juju relate landscape-client:juju-info mysql:juju-info'",
30+ "WARNING:root:DRYRUN: would run 'juju relate landscape-client:container mysql:juju-info'",
31 "WARNING:root:DRYRUN: would run 'juju relate telegraf:juju-info mysql:juju-info'",
32 "WARNING:root:DRYRUN: would run 'juju relate telegraf:mysql mysql:db-admin'",
33 "WARNING:root:DRYRUN: would run 'juju relate ubuntu-advantage:juju-info mysql:juju-info'",
34@@ -48,7 +48,7 @@ class TestUtilsRelations(unittest.TestCase):
35 applications = (('rabbitmq', ''),)
36 with self.assertLogs() as _logs:
37 expected_logs = [
38- "WARNING:root:DRYRUN: would run 'juju relate landscape-client:juju-info rabbitmq:juju-info'",
39+ "WARNING:root:DRYRUN: would run 'juju relate landscape-client:container rabbitmq:juju-info'",
40 "WARNING:root:DRYRUN: would run 'juju relate telegraf:juju-info rabbitmq:juju-info'",
41 'WARNING:root:ubuntu-advantage is deployed in containers - skipping ubuntu-advantage',
42 ]
43@@ -71,7 +71,7 @@ class TestUtilsRelations(unittest.TestCase):
44 applications = (('mysql', ''),)
45 with self.assertLogs() as _logs:
46 expected_logs = [
47- "WARNING:root:DRYRUN: would run 'juju relate landscape-client:juju-info mysql:juju-info'",
48+ "WARNING:root:DRYRUN: would run 'juju relate landscape-client:container mysql:juju-info'",
49 "WARNING:root:Not adding relation between telegraf:juju-info and mysql:juju-info due to hulk-smashed "
50 "primary",
51 "WARNING:root:Not adding relation between telegraf:mysql and mysql:db-admin due to hulk-smashed "
52diff --git a/utils/relations.py b/utils/relations.py
53index 77d2954..7b00683 100644
54--- a/utils/relations.py
55+++ b/utils/relations.py
56@@ -14,6 +14,8 @@ def parse_charms_to_relate():
57 for item in charm_config:
58 charm_relation = {"source_application": item}
59 if "install-everywhere" in charm_config[item] and charm_config[item]["install-everywhere"]:
60+ if "source-relation" in charm_config[item]:
61+ charm_relation["source_relation"] = charm_config[item]["source-relation"]
62 charms_to_relate.append(charm_relation)
63 if "relations" in charm_config[item]:
64 for relation in charm_config[item]["relations"]:

Subscribers

People subscribed via source and target branches

to all changes: