aboutsummaryrefslogtreecommitdiffstats
path: root/vicn/resource/linux/keypair.py
diff options
context:
space:
mode:
Diffstat (limited to 'vicn/resource/linux/keypair.py')
-rw-r--r--vicn/resource/linux/keypair.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/vicn/resource/linux/keypair.py b/vicn/resource/linux/keypair.py
index 66c98e5b..b748b756 100644
--- a/vicn/resource/linux/keypair.py
+++ b/vicn/resource/linux/keypair.py
@@ -23,6 +23,7 @@ from vicn.core.attribute import Attribute, Multiplicity, Reference
from vicn.core.exception import ResourceNotFound
from vicn.core.resource import Resource
from vicn.core.task import task, inline_task, BashTask
+from vicn.core.task import inherit_parent
from vicn.resource.linux.file import File
from vicn.resource.node import Node
@@ -48,8 +49,8 @@ class Keypair(Resource):
# Resource lifecycle
#--------------------------------------------------------------------------
- @inline_task
- def __initialize__(self):
+ def __init__(self, *args, **kwargs):
+ super().__init__(*args, **kwargs)
self._pubkey_file = File(node = Reference(self, 'node'),
filename = self.key + '.pub',
managed = False)
@@ -57,14 +58,17 @@ class Keypair(Resource):
filename = self.key,
managed = False)
+ @inherit_parent
def __get__(self):
return self._pubkey_file.__get__() | self._key_file.__get__()
+ @inherit_parent
def __create__(self):
return BashTask(self.node, CMD_CREATE, {
'dirname': os.path.dirname(self.key),
'self': self})
+ @inherit_parent
def __delete__(self):
return self._pubkey_file.__delete__() | self._key_file.__delete__()