Fix all properties errors for custom guidelines

There are several errors, raised during properties schemas
checking by custom guidelines. Need to fix them for successful
pep8 running.

implements bp custom-guidelines

Change-Id: Icd24498b8d36106412a61d4b82b00eb92095ffe9
This commit is contained in:
Peter Razumovsky 2016-02-18 14:17:04 +03:00
parent 1350ee4b7d
commit 1d16909dfd
21 changed files with 58 additions and 53 deletions

View File

@ -91,8 +91,8 @@ common_properties_schema = {
_('Describe time constraints for the alarm. ' _('Describe time constraints for the alarm. '
'Only evaluate the alarm if the time at evaluation ' 'Only evaluate the alarm if the time at evaluation '
'is within this time constraint. Start point(s) of ' 'is within this time constraint. Start point(s) of '
'the constraint are specified with a cron expression,' 'the constraint are specified with a cron expression, '
'whereas its duration is given in seconds. ' 'whereas its duration is given in seconds.'
), ),
schema=properties.Schema( schema=properties.Schema(
properties.Schema.MAP, properties.Schema.MAP,
@ -127,7 +127,7 @@ common_properties_schema = {
TIMEZONE: properties.Schema( TIMEZONE: properties.Schema(
properties.Schema.STRING, properties.Schema.STRING,
_("Timezone for the time constraint " _("Timezone for the time constraint "
"(eg. 'Taiwan/Taipei', 'Europe/Amsterdam')"), "(eg. 'Taiwan/Taipei', 'Europe/Amsterdam')."),
constraints=[ constraints=[
constraints.CustomConstraint('timezone') constraints.CustomConstraint('timezone')
], ],
@ -279,12 +279,12 @@ class CeilometerAlarm(resource.Resource):
), ),
QF_OP: properties.Schema( QF_OP: properties.Schema(
properties.Schema.STRING, properties.Schema.STRING,
_('Comparison operator'), _('Comparison operator.'),
constraints=[QF_OP_VALS] constraints=[QF_OP_VALS]
), ),
QF_VALUE: properties.Schema( QF_VALUE: properties.Schema(
properties.Schema.STRING, properties.Schema.STRING,
_('String value with which to compare') _('String value with which to compare.')
) )
} }
) )

View File

@ -45,7 +45,7 @@ common_gnocchi_properties_schema = {
), ),
AGGREGATION_METHOD: properties.Schema( AGGREGATION_METHOD: properties.Schema(
properties.Schema.STRING, properties.Schema.STRING,
_('The aggregation method to compare to the threshold'), _('The aggregation method to compare to the threshold.'),
constraints=[ constraints=[
constraints.AllowedValues(['mean', 'sum', 'last', 'max', 'min', constraints.AllowedValues(['mean', 'sum', 'last', 'max', 'min',
'std', 'median', 'first', 'count']), 'std', 'median', 'first', 'count']),
@ -91,13 +91,13 @@ class CeilometerGnocchiResourcesAlarm(alarm.BaseCeilometerAlarm):
), ),
RESOURCE_ID: properties.Schema( RESOURCE_ID: properties.Schema(
properties.Schema.STRING, properties.Schema.STRING,
_('Id of a resource'), _('Id of a resource.'),
required=True, required=True,
update_allowed=True update_allowed=True
), ),
RESOURCE_TYPE: properties.Schema( RESOURCE_TYPE: properties.Schema(
properties.Schema.STRING, properties.Schema.STRING,
_('Resource type'), _('Resource type.'),
required=True, required=True,
update_allowed=True update_allowed=True
), ),
@ -162,13 +162,13 @@ class CeilometerGnocchiAggregationByResourcesAlarm(
), ),
QUERY: properties.Schema( QUERY: properties.Schema(
properties.Schema.STRING, properties.Schema.STRING,
_('The query to filter the metrics'), _('The query to filter the metrics.'),
required=True, required=True,
update_allowed=True update_allowed=True
), ),
RESOURCE_TYPE: properties.Schema( RESOURCE_TYPE: properties.Schema(
properties.Schema.STRING, properties.Schema.STRING,
_('Resource type'), _('Resource type.'),
required=True, required=True,
update_allowed=True update_allowed=True
), ),

View File

@ -97,10 +97,12 @@ class InstanceGroup(stack_resource.StackResource):
schema={ schema={
TAG_KEY: properties.Schema( TAG_KEY: properties.Schema(
properties.Schema.STRING, properties.Schema.STRING,
_('Tag key.'),
required=True required=True
), ),
TAG_VALUE: properties.Schema( TAG_VALUE: properties.Schema(
properties.Schema.STRING, properties.Schema.STRING,
_('Tag value.'),
required=True required=True
), ),
}, },

View File

@ -68,7 +68,7 @@ class MultipartMime(software_config.SoftwareConfig):
properties.Schema.STRING, properties.Schema.STRING,
_('Content of part to attach, either inline or by ' _('Content of part to attach, either inline or by '
'referencing the ID of another software config ' 'referencing the ID of another software config '
'resource'), 'resource.'),
required=True required=True
), ),
FILENAME: properties.Schema( FILENAME: properties.Schema(

View File

@ -144,16 +144,16 @@ class ResourceGroup(stack_resource.StackResource):
schema={ schema={
RESOURCE_DEF_TYPE: properties.Schema( RESOURCE_DEF_TYPE: properties.Schema(
properties.Schema.STRING, properties.Schema.STRING,
_('The type of the resources in the group'), _('The type of the resources in the group.'),
required=True required=True
), ),
RESOURCE_DEF_PROPERTIES: properties.Schema( RESOURCE_DEF_PROPERTIES: properties.Schema(
properties.Schema.MAP, properties.Schema.MAP,
_('Property values for the resources in the group') _('Property values for the resources in the group.')
), ),
RESOURCE_DEF_METADATA: properties.Schema( RESOURCE_DEF_METADATA: properties.Schema(
properties.Schema.MAP, properties.Schema.MAP,
_('Supplied metadata for the resources in the group'), _('Supplied metadata for the resources in the group.'),
support_status=support.SupportStatus(version='5.0.0') support_status=support.SupportStatus(version='5.0.0')
), ),
@ -163,7 +163,7 @@ class ResourceGroup(stack_resource.StackResource):
), ),
REMOVAL_POLICIES: properties.Schema( REMOVAL_POLICIES: properties.Schema(
properties.Schema.LIST, properties.Schema.LIST,
_('Policies for removal of resources on update'), _('Policies for removal of resources on update.'),
schema=properties.Schema( schema=properties.Schema(
properties.Schema.MAP, properties.Schema.MAP,
_('Policy to be processed when doing an update which ' _('Policy to be processed when doing an update which '
@ -178,11 +178,11 @@ class ResourceGroup(stack_resource.StackResource):
"(1) The resource name, as in the nested stack, " "(1) The resource name, as in the nested stack, "
"(2) The resource reference returned from " "(2) The resource reference returned from "
"get_resource in a template, as available via " "get_resource in a template, as available via "
"the 'refs' attribute " "the 'refs' attribute. "
"Note this is destructive on update when specified; " "Note this is destructive on update when specified; "
"even if the count is not being reduced, and once " "even if the count is not being reduced, and once "
"a resource name is removed, it's name is never " "a resource name is removed, it's name is never "
"reused in subsequent updates" "reused in subsequent updates."
), ),
default=[] default=[]
), ),

View File

@ -614,7 +614,7 @@ class SoftwareDeploymentGroup(resource_group.ResourceGroup):
), ),
STATUS_CODES: attributes.Schema( STATUS_CODES: attributes.Schema(
_("A map of Nova names and returned status code from the " _("A map of Nova names and returned status code from the "
"configuration execution"), "configuration execution."),
type=attributes.Schema.MAP type=attributes.Schema.MAP
), ),
} }

View File

@ -117,7 +117,7 @@ class StructuredDeployment(sd.SoftwareDeployment):
NAME: _sd_ps[NAME], NAME: _sd_ps[NAME],
INPUT_KEY: properties.Schema( INPUT_KEY: properties.Schema(
properties.Schema.STRING, properties.Schema.STRING,
_('Name of key to use for substituting inputs during deployment'), _('Name of key to use for substituting inputs during deployment.'),
default='get_input', default='get_input',
), ),
INPUT_VALUES_VALIDATE: properties.Schema( INPUT_VALUES_VALIDATE: properties.Schema(

View File

@ -163,7 +163,7 @@ class SwiftSignal(resource.Resource):
TIMEOUT: properties.Schema( TIMEOUT: properties.Schema(
properties.Schema.NUMBER, properties.Schema.NUMBER,
description=_('The maximum number of seconds to wait for the ' description=_('The maximum number of seconds to wait for the '
'resource to signal completion. Once the timeout ' 'resource to signal completion. Once the timeout '
'is reached, creation of the signal resource will ' 'is reached, creation of the signal resource will '
'fail.'), 'fail.'),
required=True, required=True,

View File

@ -93,13 +93,13 @@ class TestResource(resource.Resource):
UPDATE_REPLACE: properties.Schema( UPDATE_REPLACE: properties.Schema(
properties.Schema.BOOLEAN, properties.Schema.BOOLEAN,
_('Value which can be set to trigger update replace for ' _('Value which can be set to trigger update replace for '
'the particular resource'), 'the particular resource.'),
update_allowed=True, update_allowed=True,
default=False default=False
), ),
WAIT_SECS: properties.Schema( WAIT_SECS: properties.Schema(
properties.Schema.NUMBER, properties.Schema.NUMBER,
_('Seconds to wait after an action (-1 is infinite)'), _('Seconds to wait after an action (-1 is infinite).'),
update_allowed=True, update_allowed=True,
default=0, default=0,
), ),
@ -111,19 +111,19 @@ class TestResource(resource.Resource):
CREATE_WAIT_SECS: properties.Schema( CREATE_WAIT_SECS: properties.Schema(
properties.Schema.NUMBER, properties.Schema.NUMBER,
_('Seconds to wait after a create. ' _('Seconds to wait after a create. '
'Defaults to the global wait_secs'), 'Defaults to the global wait_secs.'),
update_allowed=True, update_allowed=True,
), ),
UPDATE_WAIT_SECS: properties.Schema( UPDATE_WAIT_SECS: properties.Schema(
properties.Schema.NUMBER, properties.Schema.NUMBER,
_('Seconds to wait after an update. ' _('Seconds to wait after an update. '
'Defaults to the global wait_secs'), 'Defaults to the global wait_secs.'),
update_allowed=True, update_allowed=True,
), ),
DELETE_WAIT_SECS: properties.Schema( DELETE_WAIT_SECS: properties.Schema(
properties.Schema.NUMBER, properties.Schema.NUMBER,
_('Seconds to wait after a delete. ' _('Seconds to wait after a delete. '
'Defaults to the global wait_secs'), 'Defaults to the global wait_secs.'),
update_allowed=True, update_allowed=True,
), ),
} }

View File

@ -70,20 +70,20 @@ class KeystoneRoleAssignmentMixin(object):
schema={ schema={
ROLE: properties.Schema( ROLE: properties.Schema(
properties.Schema.STRING, properties.Schema.STRING,
_('Keystone role'), _('Keystone role.'),
required=True, required=True,
constraints=([constraints. constraints=([constraints.
CustomConstraint('keystone.role')]) CustomConstraint('keystone.role')])
), ),
PROJECT: properties.Schema( PROJECT: properties.Schema(
properties.Schema.STRING, properties.Schema.STRING,
_('Keystone project'), _('Keystone project.'),
constraints=([constraints. constraints=([constraints.
CustomConstraint('keystone.project')]) CustomConstraint('keystone.project')])
), ),
DOMAIN: properties.Schema( DOMAIN: properties.Schema(
properties.Schema.STRING, properties.Schema.STRING,
_('Keystone domain'), _('Keystone domain.'),
constraints=([constraints. constraints=([constraints.
CustomConstraint('keystone.domain')]) CustomConstraint('keystone.domain')])
), ),

View File

@ -65,7 +65,7 @@ class KeystoneUser(resource.Resource,
), ),
ENABLED: properties.Schema( ENABLED: properties.Schema(
properties.Schema.BOOLEAN, properties.Schema.BOOLEAN,
_('Keystone user is enabled or disabled'), _('Keystone user is enabled or disabled.'),
default=True, default=True,
update_allowed=True update_allowed=True
), ),
@ -87,11 +87,11 @@ class KeystoneUser(resource.Resource,
), ),
GROUPS: properties.Schema( GROUPS: properties.Schema(
properties.Schema.LIST, properties.Schema.LIST,
_('keystone user groups.'), _('Keystone user groups.'),
update_allowed=True, update_allowed=True,
schema=properties.Schema( schema=properties.Schema(
properties.Schema.STRING, properties.Schema.STRING,
_('keystone user group.'), _('Keystone user group.'),
constraints=[constraints.CustomConstraint('keystone.group')] constraints=[constraints.CustomConstraint('keystone.group')]
) )
) )

View File

@ -103,7 +103,7 @@ class Workflow(signal_responder.SignalResponder,
'True, the body would be parsed as a simple json where each ' 'True, the body would be parsed as a simple json where each '
'key is a workflow input, in other cases body would be parsed ' 'key is a workflow input, in other cases body would be parsed '
'expecting a specific json format with two keys: "input" and ' 'expecting a specific json format with two keys: "input" and '
'"params"'), '"params".'),
update_allowed=True, update_allowed=True,
support_status=support.SupportStatus(version='6.0.0') support_status=support.SupportStatus(version='6.0.0')
), ),
@ -178,7 +178,7 @@ class Workflow(signal_responder.SignalResponder,
PAUSE_BEFORE: properties.Schema( PAUSE_BEFORE: properties.Schema(
properties.Schema.BOOLEAN, properties.Schema.BOOLEAN,
_('Defines whether Mistral Engine should put the ' _('Defines whether Mistral Engine should put the '
'workflow on hold or not before starting a task') 'workflow on hold or not before starting a task.')
), ),
TIMEOUT: properties.Schema( TIMEOUT: properties.Schema(
properties.Schema.INTEGER, properties.Schema.INTEGER,

View File

@ -93,7 +93,7 @@ class MonascaAlarmDefinition(resource.Resource):
update_allowed=True, update_allowed=True,
schema=properties.Schema( schema=properties.Schema(
properties.Schema.STRING, properties.Schema.STRING,
_('Monasca notification'), _('Monasca notification.'),
constraints=[constraints.CustomConstraint( constraints=[constraints.CustomConstraint(
'monasca.notification') 'monasca.notification')
] ]
@ -105,7 +105,7 @@ class MonascaAlarmDefinition(resource.Resource):
update_allowed=True, update_allowed=True,
schema=properties.Schema( schema=properties.Schema(
properties.Schema.STRING, properties.Schema.STRING,
_('Monasca notification'), _('Monasca notification.'),
constraints=[constraints.CustomConstraint( constraints=[constraints.CustomConstraint(
'monasca.notification') 'monasca.notification')
] ]
@ -118,7 +118,7 @@ class MonascaAlarmDefinition(resource.Resource):
update_allowed=True, update_allowed=True,
schema=properties.Schema( schema=properties.Schema(
properties.Schema.STRING, properties.Schema.STRING,
_('Monasca notification'), _('Monasca notification.'),
constraints=[constraints.CustomConstraint( constraints=[constraints.CustomConstraint(
'monasca.notification') 'monasca.notification')
] ]

View File

@ -88,7 +88,7 @@ class Net(neutron.NeutronResource):
properties.Schema.BOOLEAN, properties.Schema.BOOLEAN,
_('Flag to enable/disable port security on the network. It ' _('Flag to enable/disable port security on the network. It '
'provides the default value for the attribute of the ports ' 'provides the default value for the attribute of the ports '
'created on this network'), 'created on this network.'),
update_allowed=True, update_allowed=True,
support_status=support.SupportStatus(version='5.0.0') support_status=support.SupportStatus(version='5.0.0')
), ),

View File

@ -108,8 +108,8 @@ class Port(neutron.NeutronResource):
properties.Schema.STRING, properties.Schema.STRING,
_('Network this port belongs to. If you plan to use current port ' _('Network this port belongs to. If you plan to use current port '
'to assign Floating IP, you should specify %(fixed_ips)s ' 'to assign Floating IP, you should specify %(fixed_ips)s '
'with %(subnet)s. Note if this changes to a different network ' 'with %(subnet)s. Note if this changes to a different network '
'update, the port will be replaced') % 'update, the port will be replaced.') %
{'fixed_ips': FIXED_IPS, 'subnet': FIXED_IP_SUBNET}, {'fixed_ips': FIXED_IPS, 'subnet': FIXED_IP_SUBNET},
support_status=support.SupportStatus(version='2014.2'), support_status=support.SupportStatus(version='2014.2'),
required=True, required=True,
@ -126,7 +126,7 @@ class Port(neutron.NeutronResource):
properties.Schema.STRING, properties.Schema.STRING,
_('Name of the network owning the port. ' _('Name of the network owning the port. '
'The value is typically network:floatingip ' 'The value is typically network:floatingip '
'or network:router_interface or network:dhcp'), 'or network:router_interface or network:dhcp.'),
update_allowed=True update_allowed=True
), ),
FIXED_IPS: properties.Schema( FIXED_IPS: properties.Schema(

View File

@ -167,6 +167,7 @@ class Subnet(neutron.NeutronResource):
schema={ schema={
ALLOCATION_POOL_START: properties.Schema( ALLOCATION_POOL_START: properties.Schema(
properties.Schema.STRING, properties.Schema.STRING,
_('Start address for the allocation pool.'),
required=True, required=True,
constraints=[ constraints=[
constraints.CustomConstraint('ip_addr') constraints.CustomConstraint('ip_addr')
@ -174,6 +175,7 @@ class Subnet(neutron.NeutronResource):
), ),
ALLOCATION_POOL_END: properties.Schema( ALLOCATION_POOL_END: properties.Schema(
properties.Schema.STRING, properties.Schema.STRING,
_('End address for the allocation pool.'),
required=True, required=True,
constraints=[ constraints=[
constraints.CustomConstraint('ip_addr') constraints.CustomConstraint('ip_addr')
@ -190,11 +192,13 @@ class Subnet(neutron.NeutronResource):
), ),
HOST_ROUTES: properties.Schema( HOST_ROUTES: properties.Schema(
properties.Schema.LIST, properties.Schema.LIST,
_('A list of host route dictionaries for the subnet.'),
schema=properties.Schema( schema=properties.Schema(
properties.Schema.MAP, properties.Schema.MAP,
schema={ schema={
ROUTE_DESTINATION: properties.Schema( ROUTE_DESTINATION: properties.Schema(
properties.Schema.STRING, properties.Schema.STRING,
_('The destination for static route.'),
required=True, required=True,
constraints=[ constraints=[
constraints.CustomConstraint('net_cidr') constraints.CustomConstraint('net_cidr')
@ -202,6 +206,7 @@ class Subnet(neutron.NeutronResource):
), ),
ROUTE_NEXTHOP: properties.Schema( ROUTE_NEXTHOP: properties.Schema(
properties.Schema.STRING, properties.Schema.STRING,
_('The next hop for the destination.'),
required=True, required=True,
constraints=[ constraints=[
constraints.CustomConstraint('ip_addr') constraints.CustomConstraint('ip_addr')

View File

@ -99,10 +99,10 @@ class SubnetPool(neutron.NeutronResource):
), ),
IS_DEFAULT: properties.Schema( IS_DEFAULT: properties.Schema(
properties.Schema.BOOLEAN, properties.Schema.BOOLEAN,
_('Whether this is default IPv4/IPv6 subnet pool.' _('Whether this is default IPv4/IPv6 subnet pool. '
'There can only be one default subnet pool for each IP family.' 'There can only be one default subnet pool for each IP family. '
'Note that the default policy setting restricts administrative ' 'Note that the default policy setting restricts administrative '
'users to set this to True'), 'users to set this to True.'),
default=False, default=False,
update_allowed=True, update_allowed=True,
), ),

View File

@ -288,7 +288,8 @@ class Server(stack_user.StackUser, sh.SchedulerHintsMixin,
IMAGE_UPDATE_POLICY: properties.Schema( IMAGE_UPDATE_POLICY: properties.Schema(
properties.Schema.STRING, properties.Schema.STRING,
_('Policy on how to apply an image-id update; either by ' _('Policy on how to apply an image-id update; either by '
'requesting a server rebuild or by replacing the entire server'), 'requesting a server rebuild or by replacing '
'the entire server.'),
default='REBUILD', default='REBUILD',
constraints=[ constraints=[
constraints.AllowedValues(['REBUILD', 'REPLACE', constraints.AllowedValues(['REBUILD', 'REPLACE',
@ -409,7 +410,7 @@ class Server(stack_user.StackUser, sh.SchedulerHintsMixin,
METADATA: properties.Schema( METADATA: properties.Schema(
properties.Schema.MAP, properties.Schema.MAP,
_('Arbitrary key/value metadata to store for this server. Both ' _('Arbitrary key/value metadata to store for this server. Both '
'keys and values must be 255 characters or less. Non-string ' 'keys and values must be 255 characters or less. Non-string '
'values will be serialized to JSON (and the serialized ' 'values will be serialized to JSON (and the serialized '
'string must be 255 characters or less).'), 'string must be 255 characters or less).'),
update_allowed=True update_allowed=True

View File

@ -52,7 +52,7 @@ class JobBinary(resource.Resource):
URL: properties.Schema( URL: properties.Schema(
properties.Schema.STRING, properties.Schema.STRING,
_('URL for the job binary. Must be in the format ' _('URL for the job binary. Must be in the format '
'swift://<container>/<path> or internal-db://<uuid>'), 'swift://<container>/<path> or internal-db://<uuid>.'),
required=True, required=True,
update_allowed=True update_allowed=True
), ),

View File

@ -59,7 +59,7 @@ class Profile(resource.Resource):
), ),
PROFILE_PROPERTIES: properties.Schema( PROFILE_PROPERTIES: properties.Schema(
properties.Schema.MAP, properties.Schema.MAP,
_('Properties for profile'), _('Properties for profile.'),
) )
} }

View File

@ -25,7 +25,7 @@ from heat.engine import support
class HeatCustomGuidelines(object): class HeatCustomGuidelines(object):
_RULES = [] _RULES = ['resource_descriptions']
def __init__(self, exclude): def __init__(self, exclude):
self.error_count = 0 self.error_count = 0
@ -55,16 +55,13 @@ class HeatCustomGuidelines(object):
# check resource's description # check resource's description
#self._check_resource_description(cls) #self._check_resource_description(cls)
# check properties' descriptions # check properties' descriptions
#self._check_resource_schemas(cls, cls.properties_schema, self._check_resource_schemas(cls, cls.properties_schema,
# 'property') 'property')
# check attributes' descriptions # check attributes' descriptions
#self._check_resource_schemas(cls, cls.attributes_schema, #self._check_resource_schemas(cls, cls.attributes_schema,
# 'attribute') # 'attribute')
# check methods descriptions # check methods descriptions
#self._check_resource_methods(cls) #self._check_resource_methods(cls)
# TODO(prazumovsky): remove when at least one check will be
# available
pass
def _check_resource_description(self, resource): def _check_resource_description(self, resource):
description = resource.__doc__ description = resource.__doc__