projects
/
osm
/
N2VC.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Move add_relation logic from BundleHandler up into Model
[osm/N2VC.git]
/
juju
/
unit.py
diff --git
a/juju/unit.py
b/juju/unit.py
index
2b7170e
..
78acaff
100644
(file)
--- a/
juju/unit.py
+++ b/
juju/unit.py
@@
-7,9
+7,6
@@
log = logging.getLogger(__name__)
class Unit(model.ModelEntity):
class Unit(model.ModelEntity):
- def _get_tag(self):
- return 'unit-{}'.format(self.data['Name'].replace('/', '-'))
-
def add_storage(self, name, constraints=None):
"""Add unit storage dynamically.
def add_storage(self, name, constraints=None):
"""Add unit storage dynamically.
@@
-26,11
+23,17
@@
class Unit(model.ModelEntity):
"""
pass
"""
pass
- def destroy(self):
+
async
def destroy(self):
"""Destroy this unit.
"""
"""Destroy this unit.
"""
- pass
+ app_facade = client.ApplicationFacade()
+ app_facade.connect(self.connection)
+
+ log.debug(
+ 'Destroying %s', self.name)
+
+ return await app_facade.DestroyUnits([self.name])
remove = destroy
def get_resources(self, details=False):
remove = destroy
def get_resources(self, details=False):
@@
-58,18
+61,17
@@
class Unit(model.ModelEntity):
"""
action = client.ActionFacade()
"""
action = client.ActionFacade()
- conn = await self.model.connection.clone()
- action.connect(conn)
+ action.connect(self.connection)
log.debug(
log.debug(
- 'Running `%s` on %s', command, self.
N
ame)
+ 'Running `%s` on %s', command, self.
n
ame)
return await action.Run(
[],
command,
[],
timeout,
return await action.Run(
[],
command,
[],
timeout,
- [self.
N
ame],
+ [self.
n
ame],
)
def run_action(self, action_name, **params):
)
def run_action(self, action_name, **params):