diff --git a/magnum/api/controllers/v1/bay.py b/magnum/api/controllers/v1/bay.py index 0753e4ce48..93d177abc4 100755 --- a/magnum/api/controllers/v1/bay.py +++ b/magnum/api/controllers/v1/bay.py @@ -18,6 +18,7 @@ import uuid from oslo_log import log as logging from oslo_utils import timeutils import pecan +import six import wsme from wsme import types as wtypes @@ -92,7 +93,10 @@ class Bay(base.APIBase): docker_volume_size = wtypes.IntegerType(minimum=1) """The size in GB of the docker volume""" - labels = wtypes.DictType(str, str) + labels = wtypes.DictType(wtypes.text, types.MultiType(wtypes.text, + six.integer_types, + bool, + float)) """One or more key/value pairs""" master_flavor_id = wtypes.StringType(min_length=1, max_length=255) @@ -110,7 +114,7 @@ class Bay(base.APIBase): stack_id = wsme.wsattr(wtypes.text, readonly=True) """Stack id of the heat stack""" - status = wtypes.Enum(str, *fields.ClusterStatus.ALL) + status = wtypes.Enum(wtypes.text, *fields.ClusterStatus.ALL) """Status of the bay from the heat stack""" status_reason = wtypes.text @@ -135,7 +139,7 @@ class Bay(base.APIBase): master_addresses = wsme.wsattr([wtypes.text], readonly=True) """IP addresses of cluster master nodes""" - bay_faults = wsme.wsattr(wtypes.DictType(str, wtypes.text)) + bay_faults = wsme.wsattr(wtypes.DictType(wtypes.text, wtypes.text)) """Fault info collected from the heat resources of this bay""" def __init__(self, **kwargs): diff --git a/magnum/api/controllers/v1/baymodel.py b/magnum/api/controllers/v1/baymodel.py index 2143ee6609..a506724e31 100644 --- a/magnum/api/controllers/v1/baymodel.py +++ b/magnum/api/controllers/v1/baymodel.py @@ -46,7 +46,7 @@ class BayModel(base.APIBase): name = wtypes.StringType(min_length=1, max_length=255) """The name of the Baymodel""" - coe = wtypes.Enum(str, *fields.ClusterType.ALL, mandatory=True) + coe = wtypes.Enum(wtypes.text, *fields.ClusterType.ALL, mandatory=True) """The Container Orchestration Engine for this bay model""" image_id = wsme.wsattr(wtypes.StringType(min_length=1, max_length=255), @@ -111,7 +111,7 @@ class BayModel(base.APIBase): registry_enabled = wsme.wsattr(types.boolean, default=False) """Indicates whether the docker registry is enabled""" - labels = wtypes.DictType(str, str) + labels = wtypes.DictType(wtypes.text, wtypes.text) """One or more key/value pairs""" tls_disabled = wsme.wsattr(types.boolean, default=False) @@ -120,7 +120,7 @@ class BayModel(base.APIBase): public = wsme.wsattr(types.boolean, default=False) """Indicates whether the Baymodel is public or not.""" - server_type = wsme.wsattr(wtypes.Enum(str, *fields.ServerType.ALL), + server_type = wsme.wsattr(wtypes.Enum(wtypes.text, *fields.ServerType.ALL), default='vm') """Server type for this bay model""" diff --git a/magnum/api/controllers/v1/cluster.py b/magnum/api/controllers/v1/cluster.py index 23c924aa90..f41980b43c 100755 --- a/magnum/api/controllers/v1/cluster.py +++ b/magnum/api/controllers/v1/cluster.py @@ -18,6 +18,7 @@ import uuid from oslo_log import log as logging from oslo_utils import timeutils import pecan +import six import wsme from wsme import types as wtypes @@ -110,7 +111,10 @@ class Cluster(base.APIBase): docker_volume_size = wtypes.IntegerType(minimum=1) """The size in GB of the docker volume""" - labels = wtypes.DictType(str, str) + labels = wtypes.DictType(wtypes.text, types.MultiType(wtypes.text, + six.integer_types, + bool, + float)) """One or more key/value pairs""" master_flavor_id = wtypes.StringType(min_length=1, max_length=255) @@ -128,16 +132,16 @@ class Cluster(base.APIBase): stack_id = wsme.wsattr(wtypes.text, readonly=True) """Stack id of the heat stack""" - status = wtypes.Enum(str, *fields.ClusterStatus.ALL) + status = wtypes.Enum(wtypes.text, *fields.ClusterStatus.ALL) """Status of the cluster from the heat stack""" status_reason = wtypes.text """Status reason of the cluster from the heat stack""" - health_status = wtypes.Enum(str, *fields.ClusterStatus.ALL) + health_status = wtypes.Enum(wtypes.text, *fields.ClusterStatus.ALL) """Health status of the cluster from the native COE API""" - health_status_reason = wtypes.DictType(str, str) + health_status_reason = wtypes.DictType(wtypes.text, wtypes.text) """Health status reason of the cluster from the native COE API""" discovery_url = wtypes.text @@ -165,7 +169,7 @@ class Cluster(base.APIBase): master_addresses = wsme.wsattr([wtypes.text], readonly=True) """IP addresses of cluster master nodes""" - faults = wsme.wsattr(wtypes.DictType(str, wtypes.text)) + faults = wsme.wsattr(wtypes.DictType(wtypes.text, wtypes.text)) """Fault info collected from the heat resources of this cluster""" def __init__(self, **kwargs): diff --git a/magnum/api/controllers/v1/cluster_template.py b/magnum/api/controllers/v1/cluster_template.py index b820b13539..37087fda4f 100644 --- a/magnum/api/controllers/v1/cluster_template.py +++ b/magnum/api/controllers/v1/cluster_template.py @@ -14,6 +14,7 @@ from oslo_utils import timeutils import pecan +import six import wsme from wsme import types as wtypes @@ -47,7 +48,7 @@ class ClusterTemplate(base.APIBase): name = wtypes.StringType(min_length=1, max_length=255) """The name of the ClusterTemplate""" - coe = wtypes.Enum(str, *fields.ClusterType.ALL, mandatory=True) + coe = wtypes.Enum(wtypes.text, *fields.ClusterType.ALL, mandatory=True) """The Container Orchestration Engine for this clustertemplate""" image_id = wsme.wsattr(wtypes.StringType(min_length=1, max_length=255), @@ -112,7 +113,10 @@ class ClusterTemplate(base.APIBase): registry_enabled = wsme.wsattr(types.boolean, default=False) """Indicates whether the docker registry is enabled""" - labels = wtypes.DictType(str, str) + labels = wtypes.DictType(wtypes.text, types.MultiType(wtypes.text, + six.integer_types, + bool, + float)) """One or more key/value pairs""" tls_disabled = wsme.wsattr(types.boolean, default=False) @@ -121,7 +125,7 @@ class ClusterTemplate(base.APIBase): public = wsme.wsattr(types.boolean, default=False) """Indicates whether the ClusterTemplate is public or not.""" - server_type = wsme.wsattr(wtypes.Enum(str, *fields.ServerType.ALL), + server_type = wsme.wsattr(wtypes.Enum(wtypes.text, *fields.ServerType.ALL), default='vm') """Server type for this ClusterTemplate """ diff --git a/magnum/api/controllers/v1/federation.py b/magnum/api/controllers/v1/federation.py index ea0addb7f6..c02995c2c0 100644 --- a/magnum/api/controllers/v1/federation.py +++ b/magnum/api/controllers/v1/federation.py @@ -73,13 +73,13 @@ class Federation(base.APIBase): member_ids = wsme.wsattr([wtypes.text]) # Status of the federation. - status = wtypes.Enum(str, *fields.FederationStatus.ALL) + status = wtypes.Enum(wtypes.text, *fields.FederationStatus.ALL) # Status reason of the federation. status_reason = wtypes.text # Set of federation metadata (COE-specific in some cases). - properties = wtypes.DictType(str, str) + properties = wtypes.DictType(wtypes.text, wtypes.text) # A list containing a self link and associated federations links links = wsme.wsattr([link.Link], readonly=True) diff --git a/magnum/api/controllers/v1/magnum_services.py b/magnum/api/controllers/v1/magnum_services.py index 53ee96b029..b894561369 100644 --- a/magnum/api/controllers/v1/magnum_services.py +++ b/magnum/api/controllers/v1/magnum_services.py @@ -29,10 +29,10 @@ class MagnumService(base.APIBase): host = wtypes.StringType(min_length=1, max_length=255) """Name of the host """ - binary = wtypes.Enum(str, *fields.MagnumServiceBinary.ALL) + binary = wtypes.Enum(wtypes.text, *fields.MagnumServiceBinary.ALL) """Name of the binary""" - state = wtypes.Enum(str, *fields.MagnumServiceState.ALL) + state = wtypes.Enum(wtypes.text, *fields.MagnumServiceState.ALL) """State of the binary""" id = wsme.wsattr(wtypes.IntegerType(minimum=1)) diff --git a/magnum/api/controllers/v1/quota.py b/magnum/api/controllers/v1/quota.py index 5a2b0eb956..cdd0868aaf 100644 --- a/magnum/api/controllers/v1/quota.py +++ b/magnum/api/controllers/v1/quota.py @@ -46,7 +46,8 @@ class Quota(base.APIBase): default=None) """The project id""" - resource = wsme.wsattr(wtypes.Enum(str, *fields.QuotaResourceName.ALL), + resource = wsme.wsattr(wtypes.Enum(wtypes.text, + *fields.QuotaResourceName.ALL), default='Cluster') """The resource name""" diff --git a/magnum/api/controllers/v1/types.py b/magnum/api/controllers/v1/types.py index 220560b0d8..9a7955a66f 100644 --- a/magnum/api/controllers/v1/types.py +++ b/magnum/api/controllers/v1/types.py @@ -141,7 +141,7 @@ class JsonPatchType(wtypes.Base): path = wtypes.wsattr(wtypes.StringType(pattern='^(/[\w-]+)+$'), mandatory=True) - op = wtypes.wsattr(wtypes.Enum(str, 'add', 'replace', 'remove'), + op = wtypes.wsattr(wtypes.Enum(wtypes.text, 'add', 'replace', 'remove'), mandatory=True) value = MultiType(wtypes.text, int)