New N2VC interface + updated libjuju
This commit introduces the Python3 N2VC module, which acts as a standard
interface to the VCA.
The goal of this is to provide a common way for modules to interface
with the VCA.
- Updated libjuju from 0.6.1 to 0.7.3
Signed-off-by: Adam Israel <adam.israel@canonical.com>
Change-Id: Ide70fb5ae5797eb6486de24653dc09a23f9c009e
diff --git a/modules/libjuju/juju/application.py b/modules/libjuju/juju/application.py
index 620e9c9..555bb3d 100644
--- a/modules/libjuju/juju/application.py
+++ b/modules/libjuju/juju/application.py
@@ -52,6 +52,24 @@
]
@property
+ def relations(self):
+ return [rel for rel in self.model.relations if rel.matches(self.name)]
+
+ def related_applications(self, endpoint_name=None):
+ apps = {}
+ for rel in self.relations:
+ if rel.is_peer:
+ local_ep, remote_ep = rel.endpoints[0]
+ else:
+ def is_us(ep):
+ return ep.application.name == self.name
+ local_ep, remote_ep = sorted(rel.endpoints, key=is_us)
+ if endpoint_name is not None and endpoint_name != local_ep.name:
+ continue
+ apps[remote_ep.application.name] = remote_ep.application
+ return apps
+
+ @property
def status(self):
"""Get the application status, as set by the charm's leader.