Expose deployment/config updated_at/created_at
This is useful information for the user, and is also useful to expose to support blueprint software-config-trigger. DocImpact Change-Id: I7ba58f83793fe993b5791cb2011afb9e81462df6
This commit is contained in:
parent
c207408d6a
commit
32f6e8fd5c
|
@ -387,7 +387,9 @@ def format_software_config(sc):
|
|||
rpc_api.SOFTWARE_CONFIG_CONFIG: sc.config['config'],
|
||||
rpc_api.SOFTWARE_CONFIG_INPUTS: sc.config['inputs'],
|
||||
rpc_api.SOFTWARE_CONFIG_OUTPUTS: sc.config['outputs'],
|
||||
rpc_api.SOFTWARE_CONFIG_OPTIONS: sc.config['options']
|
||||
rpc_api.SOFTWARE_CONFIG_OPTIONS: sc.config['options'],
|
||||
rpc_api.SOFTWARE_CONFIG_CREATION_TIME: timeutils.isotime(
|
||||
sc.created_at),
|
||||
}
|
||||
return result
|
||||
|
||||
|
@ -404,7 +406,12 @@ def format_software_deployment(sd):
|
|||
rpc_api.SOFTWARE_DEPLOYMENT_STATUS: sd.status,
|
||||
rpc_api.SOFTWARE_DEPLOYMENT_STATUS_REASON: sd.status_reason,
|
||||
rpc_api.SOFTWARE_DEPLOYMENT_CONFIG_ID: sd.config.id,
|
||||
rpc_api.SOFTWARE_DEPLOYMENT_CREATION_TIME: timeutils.isotime(
|
||||
sd.created_at)
|
||||
}
|
||||
if sd.updated_at:
|
||||
result[rpc_api.SOFTWARE_DEPLOYMENT_UPDATED_TIME] = timeutils.isotime(
|
||||
sd.updated_at)
|
||||
return result
|
||||
|
||||
|
||||
|
|
|
@ -199,6 +199,7 @@ SOFTWARE_CONFIG_KEYS = (
|
|||
SOFTWARE_CONFIG_INPUTS,
|
||||
SOFTWARE_CONFIG_OUTPUTS,
|
||||
SOFTWARE_CONFIG_OPTIONS,
|
||||
SOFTWARE_CONFIG_CREATION_TIME
|
||||
) = (
|
||||
'id',
|
||||
'name',
|
||||
|
@ -207,6 +208,7 @@ SOFTWARE_CONFIG_KEYS = (
|
|||
'inputs',
|
||||
'outputs',
|
||||
'options',
|
||||
'creation_time'
|
||||
)
|
||||
|
||||
SOFTWARE_DEPLOYMENT_KEYS = (
|
||||
|
@ -217,7 +219,9 @@ SOFTWARE_DEPLOYMENT_KEYS = (
|
|||
SOFTWARE_DEPLOYMENT_OUTPUT_VALUES,
|
||||
SOFTWARE_DEPLOYMENT_ACTION,
|
||||
SOFTWARE_DEPLOYMENT_STATUS,
|
||||
SOFTWARE_DEPLOYMENT_STATUS_REASON
|
||||
SOFTWARE_DEPLOYMENT_STATUS_REASON,
|
||||
SOFTWARE_DEPLOYMENT_CREATION_TIME,
|
||||
SOFTWARE_DEPLOYMENT_UPDATED_TIME
|
||||
) = (
|
||||
'id',
|
||||
'config_id',
|
||||
|
@ -226,7 +230,9 @@ SOFTWARE_DEPLOYMENT_KEYS = (
|
|||
'output_values',
|
||||
'action',
|
||||
'status',
|
||||
'status_reason'
|
||||
'status_reason',
|
||||
'creation_time',
|
||||
'updated_time'
|
||||
)
|
||||
|
||||
SNAPSHOT_KEYS = (
|
||||
|
|
|
@ -16,6 +16,7 @@ import json
|
|||
import uuid
|
||||
|
||||
import mock
|
||||
from oslo.utils import timeutils
|
||||
import six
|
||||
|
||||
from heat.common import identifier
|
||||
|
@ -920,9 +921,11 @@ class FormatSoftwareConfigDeploymentTest(common.HeatTestCase):
|
|||
|
||||
def _dummy_software_config(self):
|
||||
config = mock.Mock()
|
||||
self.now = timeutils.utcnow()
|
||||
config.name = 'config_mysql'
|
||||
config.group = 'Heat::Shell'
|
||||
config.id = str(uuid.uuid4())
|
||||
config.created_at = self.now
|
||||
config.config = {
|
||||
'inputs': [{'name': 'bar'}],
|
||||
'outputs': [{'name': 'result'}],
|
||||
|
@ -942,6 +945,8 @@ class FormatSoftwareConfigDeploymentTest(common.HeatTestCase):
|
|||
deployment.action = 'INIT'
|
||||
deployment.status = 'COMPLETE'
|
||||
deployment.status_reason = 'Because'
|
||||
deployment.created_at = config.created_at
|
||||
deployment.updated_at = config.created_at
|
||||
return deployment
|
||||
|
||||
def test_format_software_config(self):
|
||||
|
@ -950,7 +955,10 @@ class FormatSoftwareConfigDeploymentTest(common.HeatTestCase):
|
|||
self.assertIsNotNone(result)
|
||||
self.assertEqual([{'name': 'bar'}], result['inputs'])
|
||||
self.assertEqual([{'name': 'result'}], result['outputs'])
|
||||
self.assertEqual([{'name': 'result'}], result['outputs'])
|
||||
self.assertEqual({}, result['options'])
|
||||
self.assertEqual(timeutils.isotime(self.now),
|
||||
result['creation_time'])
|
||||
|
||||
def test_format_software_config_none(self):
|
||||
self.assertIsNone(api.format_software_config(None))
|
||||
|
@ -967,6 +975,10 @@ class FormatSoftwareConfigDeploymentTest(common.HeatTestCase):
|
|||
self.assertEqual(deployment.action, result['action'])
|
||||
self.assertEqual(deployment.status, result['status'])
|
||||
self.assertEqual(deployment.status_reason, result['status_reason'])
|
||||
self.assertEqual(timeutils.isotime(self.now),
|
||||
result['creation_time'])
|
||||
self.assertEqual(timeutils.isotime(self.now),
|
||||
result['updated_time'])
|
||||
|
||||
def test_format_software_deployment_none(self):
|
||||
self.assertIsNone(api.format_software_deployment(None))
|
||||
|
|
Loading…
Reference in New Issue