Merge lp:~rharding/charmworld/support-implicit-relations into lp:charmworld
Status: | Merged |
---|---|
Approved by: | Richard Harding |
Approved revision: | 453 |
Merged at revision: | 453 |
Proposed branch: | lp:~rharding/charmworld/support-implicit-relations |
Merge into: | lp:charmworld |
Diff against target: |
53 lines (+35/-0) 2 files modified
charmworld/lib/proof.py (+9/-0) charmworld/lib/tests/test_proof.py (+26/-0) |
To merge this branch: | bzr merge lp:~rharding/charmworld/support-implicit-relations |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Juju Gui Bot | continuous-integration | Approve | |
Charmworld Developers | Pending | ||
Review via email: mp+194535@code.launchpad.net |
Commit message
Allow implicit juju-* relations to be valid.
- https:/
- juju-* is a namespace for implicit juju relations all charms support. This
adds a check for relations that start with juju- and auto approve them in
proof.
- Charms are not allowed to create any relation of their own that start with
juju-, so it's safe to assume anything that starts with this is a safe
implicit relation.
https:/
R=benji
Description of the change
Allow implicit juju-* relations to be valid.
- https:/
- juju-* is a namespace for implicit juju relations all charms support. This
adds a check for relations that start with juju- and auto approve them in
proof.
- Charms are not allowed to create any relation of their own that start with
juju-, so it's safe to assume anything that starts with this is a safe
implicit relation.
Reviewers: mp+194535_ code.launchpad. net,
Message:
Please take a look.
Description:
Allow implicit juju-* relations to be valid.
- https:/ /juju.ubuntu. com/docs/ authors- implicit- relations. html
- juju-* is a namespace for implicit juju relations all charms support.
This
adds a check for relations that start with juju- and auto approve them
in
proof.
- Charms are not allowed to create any relation of their own that start
with
juju-, so it's safe to assume anything that starts with this is a safe
implicit relation.
https:/ /code.launchpad .net/~rharding/ charmworld/ support- implicit- relations/ +merge/ 194535
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/23660043/
Affected files (+37, -0 lines): lib/proof. py lib/tests/ test_proof. py
A [revision details]
M charmworld/
M charmworld/
Index: [revision details] 20131108152057- vxjx6ibvpchmbuq w
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: tarmac-
+New revision: <email address hidden>
Index: charmworld/ lib/proof. py lib/proof. py' lib/proof. py 2013-11-06 19:10:38 +0000 lib/proof. py 2013-11-08 15:33:33 +0000
=== modified file 'charmworld/
--- charmworld/
+++ charmworld/
@@ -71,6 +71,15 @@
if check_requires in requires and check_provides in provides:
exist = True
+ # If the check type is a implicit interface then it's valid. startswith( 'juju-' ): startswith( 'juju-' ):
require_ type = requires[ check_requires] ['interface' ]
+ if check_requires and check_requires.
+ return True
+
+ if check_provides and check_provides.
+ return True
+
+ # If it's not implicit then continue to check that it's valid for the
two
+ # services in the relation.
if check_requires and check_requires in requires:
if check_provides and check_provides in provides:
Index: charmworld/ lib/tests/ test_proof. py lib/tests/ test_proof. py' lib/tests/ test_proof. py 2013-11-06 19:17:39 +0000 lib/tests/ test_proof. py 2013-11-08 15:33:33 +0000
=== modified file 'charmworld/
--- charmworld/
+++ charmworld/
@@ -322,3 +322,29 @@
# There's no ProofError raised. Just an empty function return value
self. assertTrue( res) relations_ are_safe( self): juju-info' ] points_ exist_and_ same_type( (res)
+
+ def test_implicit_
+ # relation = ['wiki:juju-info', 'haproxy:
+ check_requires = 'juju-info'
+ check_provides = 'juju-info'
+
+ # Note that none of the services defined a juju-info interface.
+ requires = {
+ 'website': {
+ 'interface': 'http'
+ }
+ }
+ provides = {
+ 'cache': {
+ 'interface': 'http'
+ }
+ }
+
+ res = verify_
+ check_requires,
+ check_provides,
+ requires,
+ provides)
+
+ # There's no ProofError raised. Just an empty function return value
+ self.assertTrue