Merge "Basic resource.prop for ID attributes (cluster)"

This commit is contained in:
Jenkins
2016-02-17 14:05:19 +00:00
committed by Gerrit Code Review
9 changed files with 25 additions and 30 deletions

View File

@@ -29,13 +29,13 @@ class Action(resource.Resource):
#: Name of the action.
name = resource.prop('name')
#: ID of the target object, which can be a cluster or a node.
target = resource.prop('target')
target_id = resource.prop('target')
#: Built-in type name of action.
action = resource.prop('action')
#: A string representation of the reason why the action was created.
cause = resource.prop('cause')
#: The owning engine that is currently running the action.
owner = resource.prop('owner')
owner_id = resource.prop('owner')
#: Interval in seconds between two consecutive executions.
interval = resource.prop('interval')
#: The time the action was started.

View File

@@ -11,7 +11,6 @@
# under the License.
from openstack.cluster import cluster_service
from openstack.cluster.v1 import profile as _profile
from openstack import resource
from openstack import utils
@@ -34,15 +33,15 @@ class Cluster(resource.Resource):
#: The name of the cluster.
name = resource.prop('name')
#: The ID of the profile used by this cluster.
profile = resource.prop('profile_id', type=_profile.Profile)
profile_id = resource.prop('profile_id')
#: The ID of the user who created this cluster, thus the owner of it.
user = resource.prop('user')
user_id = resource.prop('user')
#: The ID of the project this cluster belongs to.
project = resource.prop('project')
project_id = resource.prop('project')
#: The domain ID of the cluster owner.
domain = resource.prop('domain')
domain_id = resource.prop('domain')
#: The ID of the parent cluster (if any).
parent = resource.prop('parent')
parent_id = resource.prop('parent')
#: Timestamp of when the cluster was initialized.
init_at = resource.prop('init_at')
#: Timestamp of when the cluster was created.
@@ -68,7 +67,7 @@ class Cluster(resource.Resource):
#: A dictionary with some runtime data associated with the cluster.
data = resource.prop('data', type=dict)
#: A list IDs of nodes that are members of the cluster.
nodes = resource.prop('nodes')
node_ids = resource.prop('nodes')
#: Name of the profile used by the cluster.
profile_name = resource.prop('profile_name')

View File

@@ -33,8 +33,8 @@ class Event(resource.Resource):
obj_type = resource.prop('obj_type')
cluster_id = resource.prop('cluster_id')
level = resource.prop('level')
user = resource.prop('user')
project = resource.prop('project')
user_id = resource.prop('user')
project_id = resource.prop('project')
action = resource.prop('action')
status = resource.prop('status')
status_reason = resource.prop('status_reason')

View File

@@ -11,8 +11,6 @@
# under the License.
from openstack.cluster import cluster_service
from openstack.cluster.v1 import cluster as _cluster
from openstack.cluster.v1 import profile as _profile
from openstack import resource
from openstack import utils
@@ -39,11 +37,11 @@ class Node(resource.Resource):
physical_id = resource.prop('physical_id')
#: The ID of the cluster in which this node is a member.
#: A node is an orphan node if this field is empty.
cluster = resource.prop('cluster_id', type=_cluster.Cluster)
cluster_id = resource.prop('cluster_id')
#: The ID of the profile used by this node.
profile = resource.prop('profile_id', type=_profile.Profile)
profile_id = resource.prop('profile_id')
#: The ID of the project this node belongs to.
project = resource.prop('project')
project_id = resource.prop('project')
#: The name of the profile used by this node.
profile_name = resource.prop('profile_name')
#: An integer that is unique inside the owning cluster.

View File

@@ -12,7 +12,6 @@
from openstack.cluster import cluster_service
from openstack.cluster.v1 import cluster as _cluster
from openstack import resource
@@ -34,13 +33,13 @@ class Receiver(resource.Resource):
#: The type of the receiver.
type = resource.prop('type')
#: The ID of the user who created the receiver, thus the owner of it.
user = resource.prop('user')
user_id = resource.prop('user')
#: The ID of the project this receiver belongs to.
project = resource.prop('project')
project_id = resource.prop('project')
#: The domain ID of the receiver.
domain = resource.prop('domain')
domain_id = resource.prop('domain')
#: The ID of the targeted cluster.
cluster = resource.prop('cluster_id', type=_cluster.Cluster)
cluster_id = resource.prop('cluster_id')
#: The name of the targeted action.
action = resource.prop('action')
#: Timestamp of when the receiver was created.

View File

@@ -57,10 +57,10 @@ class TestAction(testtools.TestCase):
sot = action.Action(FAKE)
self.assertIsNone(sot.id)
self.assertEqual(FAKE['name'], sot.name)
self.assertEqual(FAKE['target'], sot.target)
self.assertEqual(FAKE['target'], sot.target_id)
self.assertEqual(FAKE['action'], sot.action)
self.assertEqual(FAKE['cause'], sot.cause)
self.assertEqual(FAKE['owner'], sot.owner)
self.assertEqual(FAKE['owner'], sot.owner_id)
self.assertEqual(FAKE['interval'], sot.interval)
self.assertEqual(FAKE['start_time'], sot.start_time)
self.assertEqual(FAKE['end_time'], sot.end_time)

View File

@@ -58,8 +58,8 @@ class TestEvent(testtools.TestCase):
self.assertEqual(FAKE['obj_id'], sot.obj_id)
self.assertEqual(FAKE['obj_name'], sot.obj_name)
self.assertEqual(FAKE['obj_type'], sot.obj_type)
self.assertEqual(FAKE['project'], sot.project)
self.assertEqual(FAKE['project'], sot.project_id)
self.assertEqual(FAKE['status'], sot.status)
self.assertEqual(FAKE['status_reason'], sot.status_reason)
self.assertEqual(FAKE['timestamp'], sot.timestamp)
self.assertEqual(FAKE['user'], sot.user)
self.assertEqual(FAKE['user'], sot.user_id)

View File

@@ -72,7 +72,6 @@ class TestNode(testtools.TestCase):
sot = node.Node(FAKE)
self.assertEqual(FAKE['id'], sot.id)
self.assertEqual(FAKE['name'], sot.name)
self.assertEqual(FAKE['profile_id'], sot.profile_id)
self.assertEqual(FAKE['cluster_id'], sot.cluster_id)
self.assertEqual(FAKE['name'], sot.name)

View File

@@ -61,12 +61,12 @@ class TestReceiver(testtools.TestCase):
self.assertIsNone(sot.id)
self.assertEqual(FAKE['name'], sot.name)
self.assertEqual(FAKE['type'], sot.type)
self.assertEqual(FAKE['cluster_id'], sot.cluster.id)
self.assertEqual(FAKE['cluster_id'], sot.cluster_id)
self.assertEqual(FAKE['action'], sot.action)
self.assertEqual(FAKE['params'], sot.params)
self.assertEqual(FAKE['created_at'], sot.created_at)
self.assertEqual(FAKE['updated_at'], sot.updated_at)
self.assertEqual(FAKE['user'], sot.user)
self.assertEqual(FAKE['project'], sot.project)
self.assertEqual(FAKE['domain'], sot.domain)
self.assertEqual(FAKE['user'], sot.user_id)
self.assertEqual(FAKE['project'], sot.project_id)
self.assertEqual(FAKE['domain'], sot.domain_id)
self.assertEqual(FAKE['channel'], sot.channel)