Request object for node adopt operation
This adds a new request object for node adopt operation Blueprint: senlin-adopt-function Change-Id: I5be76505c5ce63f489afd677436a8b274de1c8b6
This commit is contained in:
parent
630f5539ef
commit
efdec747f6
|
@ -107,3 +107,15 @@ class NodeOperationRequest(base.SenlinObject):
|
|||
'operation': fields.StringField(),
|
||||
'params': fields.JsonField(nullable=True)
|
||||
}
|
||||
|
||||
|
||||
@base.SenlinObjectRegistry.register
|
||||
class NodeAdoptRequest(base.SenlinObject):
|
||||
|
||||
fields = {
|
||||
'identity': fields.StringField(),
|
||||
'type': fields.StringField(),
|
||||
'overrides': fields.JsonField(nullable=True),
|
||||
'preview': fields.BooleanField(default=True),
|
||||
'snapshot': fields.BooleanField(default=False)
|
||||
}
|
||||
|
|
|
@ -206,3 +206,22 @@ class TestNodeOperation(test_base.SenlinTestCase):
|
|||
self.assertEqual('test-node', sot.identity)
|
||||
self.assertEqual('dance', sot.operation)
|
||||
self.assertEqual({'foo': 'bar'}, sot.params)
|
||||
|
||||
|
||||
class TestNodeAdopt(test_base.SenlinTestCase):
|
||||
|
||||
body = {
|
||||
'identity': 'test-node',
|
||||
'type': 'test-type',
|
||||
'overrides': {'foo': 'bar'},
|
||||
'preview': False,
|
||||
'snapshot': True
|
||||
}
|
||||
|
||||
def test_node_adopt_request(self):
|
||||
sot = nodes.NodeAdoptRequest(**self.body)
|
||||
self.assertEqual('test-node', sot.identity)
|
||||
self.assertEqual('test-type', sot.type)
|
||||
self.assertEqual({'foo': 'bar'}, sot.overrides)
|
||||
self.assertFalse(sot.preview)
|
||||
self.assertTrue(sot.snapshot)
|
||||
|
|
Loading…
Reference in New Issue