From a5bf184ebd23cfa5b80d8c0651d37d9308b69de9 Mon Sep 17 00:00:00 2001 From: Brian Curtin Date: Tue, 15 Dec 2015 17:37:34 -0600 Subject: [PATCH] cluster: Use typed props instead of *_id This change converts several props on cluster resources to their typed equivalent, allowing either an ID or an actual Resource to be passed for that value. Change-Id: I62894903239160944c1c2ec474b06b25ed64ed28 --- openstack/cluster/v1/cluster.py | 3 ++- openstack/cluster/v1/node.py | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/openstack/cluster/v1/cluster.py b/openstack/cluster/v1/cluster.py index c690b0f57..ef1b7f9d8 100644 --- a/openstack/cluster/v1/cluster.py +++ b/openstack/cluster/v1/cluster.py @@ -11,6 +11,7 @@ # 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 @@ -33,7 +34,7 @@ class Cluster(resource.Resource): #: The name of the cluster. name = resource.prop('name') #: The ID of the profile used by this cluster. - profile_id = resource.prop('profile_id') + profile = resource.prop('profile_id', type=_profile.Profile) #: The ID of the user who created this cluster, thus the owner of it. user = resource.prop('user') #: The ID of the project this cluster belongs to. diff --git a/openstack/cluster/v1/node.py b/openstack/cluster/v1/node.py index 5f8785e3a..b005a93fd 100644 --- a/openstack/cluster/v1/node.py +++ b/openstack/cluster/v1/node.py @@ -11,6 +11,8 @@ # 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 @@ -37,9 +39,9 @@ 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_id = resource.prop('cluster_id') + cluster = resource.prop('cluster_id', type=_cluster.Cluster) #: The ID of the profile used by this node. - profile_id = resource.prop('profile_id') + profile = resource.prop('profile_id', type=_profile.Profile) #: The ID of the project this node belongs to. project = resource.prop('project') #: The name of the profile used by this node.