Use MultiType and types.text instead of str
The goal of this is to fix python3 compatibility issues. story: 2003236 task: 23698 Change-Id: I555c7faecfcccaaa3649ef8c631b99a01e747c0b
This commit is contained in:
parent
54bea06b5a
commit
41cd85794f
@ -18,6 +18,7 @@ import uuid
|
|||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
from oslo_utils import timeutils
|
from oslo_utils import timeutils
|
||||||
import pecan
|
import pecan
|
||||||
|
import six
|
||||||
import wsme
|
import wsme
|
||||||
from wsme import types as wtypes
|
from wsme import types as wtypes
|
||||||
|
|
||||||
@ -92,7 +93,10 @@ class Bay(base.APIBase):
|
|||||||
docker_volume_size = wtypes.IntegerType(minimum=1)
|
docker_volume_size = wtypes.IntegerType(minimum=1)
|
||||||
"""The size in GB of the docker volume"""
|
"""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"""
|
"""One or more key/value pairs"""
|
||||||
|
|
||||||
master_flavor_id = wtypes.StringType(min_length=1, max_length=255)
|
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 = wsme.wsattr(wtypes.text, readonly=True)
|
||||||
"""Stack id of the heat stack"""
|
"""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 of the bay from the heat stack"""
|
||||||
|
|
||||||
status_reason = wtypes.text
|
status_reason = wtypes.text
|
||||||
@ -135,7 +139,7 @@ class Bay(base.APIBase):
|
|||||||
master_addresses = wsme.wsattr([wtypes.text], readonly=True)
|
master_addresses = wsme.wsattr([wtypes.text], readonly=True)
|
||||||
"""IP addresses of cluster master nodes"""
|
"""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"""
|
"""Fault info collected from the heat resources of this bay"""
|
||||||
|
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
|
@ -46,7 +46,7 @@ class BayModel(base.APIBase):
|
|||||||
name = wtypes.StringType(min_length=1, max_length=255)
|
name = wtypes.StringType(min_length=1, max_length=255)
|
||||||
"""The name of the Baymodel"""
|
"""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"""
|
"""The Container Orchestration Engine for this bay model"""
|
||||||
|
|
||||||
image_id = wsme.wsattr(wtypes.StringType(min_length=1, max_length=255),
|
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)
|
registry_enabled = wsme.wsattr(types.boolean, default=False)
|
||||||
"""Indicates whether the docker registry is enabled"""
|
"""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"""
|
"""One or more key/value pairs"""
|
||||||
|
|
||||||
tls_disabled = wsme.wsattr(types.boolean, default=False)
|
tls_disabled = wsme.wsattr(types.boolean, default=False)
|
||||||
@ -120,7 +120,7 @@ class BayModel(base.APIBase):
|
|||||||
public = wsme.wsattr(types.boolean, default=False)
|
public = wsme.wsattr(types.boolean, default=False)
|
||||||
"""Indicates whether the Baymodel is public or not."""
|
"""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')
|
default='vm')
|
||||||
"""Server type for this bay model"""
|
"""Server type for this bay model"""
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@ import uuid
|
|||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
from oslo_utils import timeutils
|
from oslo_utils import timeutils
|
||||||
import pecan
|
import pecan
|
||||||
|
import six
|
||||||
import wsme
|
import wsme
|
||||||
from wsme import types as wtypes
|
from wsme import types as wtypes
|
||||||
|
|
||||||
@ -110,7 +111,10 @@ class Cluster(base.APIBase):
|
|||||||
docker_volume_size = wtypes.IntegerType(minimum=1)
|
docker_volume_size = wtypes.IntegerType(minimum=1)
|
||||||
"""The size in GB of the docker volume"""
|
"""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"""
|
"""One or more key/value pairs"""
|
||||||
|
|
||||||
master_flavor_id = wtypes.StringType(min_length=1, max_length=255)
|
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 = wsme.wsattr(wtypes.text, readonly=True)
|
||||||
"""Stack id of the heat stack"""
|
"""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 of the cluster from the heat stack"""
|
||||||
|
|
||||||
status_reason = wtypes.text
|
status_reason = wtypes.text
|
||||||
"""Status reason of the cluster from the heat stack"""
|
"""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 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"""
|
"""Health status reason of the cluster from the native COE API"""
|
||||||
|
|
||||||
discovery_url = wtypes.text
|
discovery_url = wtypes.text
|
||||||
@ -165,7 +169,7 @@ class Cluster(base.APIBase):
|
|||||||
master_addresses = wsme.wsattr([wtypes.text], readonly=True)
|
master_addresses = wsme.wsattr([wtypes.text], readonly=True)
|
||||||
"""IP addresses of cluster master nodes"""
|
"""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"""
|
"""Fault info collected from the heat resources of this cluster"""
|
||||||
|
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
from oslo_utils import timeutils
|
from oslo_utils import timeutils
|
||||||
import pecan
|
import pecan
|
||||||
|
import six
|
||||||
import wsme
|
import wsme
|
||||||
from wsme import types as wtypes
|
from wsme import types as wtypes
|
||||||
|
|
||||||
@ -47,7 +48,7 @@ class ClusterTemplate(base.APIBase):
|
|||||||
name = wtypes.StringType(min_length=1, max_length=255)
|
name = wtypes.StringType(min_length=1, max_length=255)
|
||||||
"""The name of the ClusterTemplate"""
|
"""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"""
|
"""The Container Orchestration Engine for this clustertemplate"""
|
||||||
|
|
||||||
image_id = wsme.wsattr(wtypes.StringType(min_length=1, max_length=255),
|
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)
|
registry_enabled = wsme.wsattr(types.boolean, default=False)
|
||||||
"""Indicates whether the docker registry is enabled"""
|
"""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"""
|
"""One or more key/value pairs"""
|
||||||
|
|
||||||
tls_disabled = wsme.wsattr(types.boolean, default=False)
|
tls_disabled = wsme.wsattr(types.boolean, default=False)
|
||||||
@ -121,7 +125,7 @@ class ClusterTemplate(base.APIBase):
|
|||||||
public = wsme.wsattr(types.boolean, default=False)
|
public = wsme.wsattr(types.boolean, default=False)
|
||||||
"""Indicates whether the ClusterTemplate is public or not."""
|
"""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')
|
default='vm')
|
||||||
"""Server type for this ClusterTemplate """
|
"""Server type for this ClusterTemplate """
|
||||||
|
|
||||||
|
@ -73,13 +73,13 @@ class Federation(base.APIBase):
|
|||||||
member_ids = wsme.wsattr([wtypes.text])
|
member_ids = wsme.wsattr([wtypes.text])
|
||||||
|
|
||||||
# Status of the federation.
|
# 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 of the federation.
|
||||||
status_reason = wtypes.text
|
status_reason = wtypes.text
|
||||||
|
|
||||||
# Set of federation metadata (COE-specific in some cases).
|
# 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
|
# A list containing a self link and associated federations links
|
||||||
links = wsme.wsattr([link.Link], readonly=True)
|
links = wsme.wsattr([link.Link], readonly=True)
|
||||||
|
@ -29,10 +29,10 @@ class MagnumService(base.APIBase):
|
|||||||
host = wtypes.StringType(min_length=1, max_length=255)
|
host = wtypes.StringType(min_length=1, max_length=255)
|
||||||
"""Name of the host """
|
"""Name of the host """
|
||||||
|
|
||||||
binary = wtypes.Enum(str, *fields.MagnumServiceBinary.ALL)
|
binary = wtypes.Enum(wtypes.text, *fields.MagnumServiceBinary.ALL)
|
||||||
"""Name of the binary"""
|
"""Name of the binary"""
|
||||||
|
|
||||||
state = wtypes.Enum(str, *fields.MagnumServiceState.ALL)
|
state = wtypes.Enum(wtypes.text, *fields.MagnumServiceState.ALL)
|
||||||
"""State of the binary"""
|
"""State of the binary"""
|
||||||
|
|
||||||
id = wsme.wsattr(wtypes.IntegerType(minimum=1))
|
id = wsme.wsattr(wtypes.IntegerType(minimum=1))
|
||||||
|
@ -46,7 +46,8 @@ class Quota(base.APIBase):
|
|||||||
default=None)
|
default=None)
|
||||||
"""The project id"""
|
"""The project id"""
|
||||||
|
|
||||||
resource = wsme.wsattr(wtypes.Enum(str, *fields.QuotaResourceName.ALL),
|
resource = wsme.wsattr(wtypes.Enum(wtypes.text,
|
||||||
|
*fields.QuotaResourceName.ALL),
|
||||||
default='Cluster')
|
default='Cluster')
|
||||||
"""The resource name"""
|
"""The resource name"""
|
||||||
|
|
||||||
|
@ -141,7 +141,7 @@ class JsonPatchType(wtypes.Base):
|
|||||||
|
|
||||||
path = wtypes.wsattr(wtypes.StringType(pattern='^(/[\w-]+)+$'),
|
path = wtypes.wsattr(wtypes.StringType(pattern='^(/[\w-]+)+$'),
|
||||||
mandatory=True)
|
mandatory=True)
|
||||||
op = wtypes.wsattr(wtypes.Enum(str, 'add', 'replace', 'remove'),
|
op = wtypes.wsattr(wtypes.Enum(wtypes.text, 'add', 'replace', 'remove'),
|
||||||
mandatory=True)
|
mandatory=True)
|
||||||
value = MultiType(wtypes.text, int)
|
value = MultiType(wtypes.text, int)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user