From 1d16909dfd4f90513b8e011eea02dc6800c64062 Mon Sep 17 00:00:00 2001 From: Peter Razumovsky Date: Thu, 18 Feb 2016 14:17:04 +0300 Subject: [PATCH] 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 --- heat/engine/resources/openstack/ceilometer/alarm.py | 10 +++++----- .../resources/openstack/ceilometer/gnocchi/alarm.py | 10 +++++----- .../resources/openstack/heat/instance_group.py | 2 ++ heat/engine/resources/openstack/heat/multi_part.py | 2 +- .../resources/openstack/heat/resource_group.py | 12 ++++++------ .../resources/openstack/heat/software_deployment.py | 2 +- .../resources/openstack/heat/structured_config.py | 2 +- heat/engine/resources/openstack/heat/swiftsignal.py | 2 +- .../engine/resources/openstack/heat/test_resource.py | 10 +++++----- .../resources/openstack/keystone/role_assignments.py | 6 +++--- heat/engine/resources/openstack/keystone/user.py | 6 +++--- heat/engine/resources/openstack/mistral/workflow.py | 4 ++-- .../resources/openstack/monasca/alarm_definition.py | 6 +++--- heat/engine/resources/openstack/neutron/net.py | 2 +- heat/engine/resources/openstack/neutron/port.py | 6 +++--- heat/engine/resources/openstack/neutron/subnet.py | 5 +++++ .../engine/resources/openstack/neutron/subnetpool.py | 6 +++--- heat/engine/resources/openstack/nova/server.py | 5 +++-- heat/engine/resources/openstack/sahara/job_binary.py | 2 +- heat/engine/resources/openstack/senlin/profile.py | 2 +- tools/custom_guidelines.py | 9 +++------ 21 files changed, 58 insertions(+), 53 deletions(-) diff --git a/heat/engine/resources/openstack/ceilometer/alarm.py b/heat/engine/resources/openstack/ceilometer/alarm.py index 78232aab16..d0de06015c 100644 --- a/heat/engine/resources/openstack/ceilometer/alarm.py +++ b/heat/engine/resources/openstack/ceilometer/alarm.py @@ -91,8 +91,8 @@ common_properties_schema = { _('Describe time constraints for the alarm. ' 'Only evaluate the alarm if the time at evaluation ' 'is within this time constraint. Start point(s) of ' - 'the constraint are specified with a cron expression,' - 'whereas its duration is given in seconds. ' + 'the constraint are specified with a cron expression, ' + 'whereas its duration is given in seconds.' ), schema=properties.Schema( properties.Schema.MAP, @@ -127,7 +127,7 @@ common_properties_schema = { TIMEZONE: properties.Schema( properties.Schema.STRING, _("Timezone for the time constraint " - "(eg. 'Taiwan/Taipei', 'Europe/Amsterdam')"), + "(eg. 'Taiwan/Taipei', 'Europe/Amsterdam')."), constraints=[ constraints.CustomConstraint('timezone') ], @@ -279,12 +279,12 @@ class CeilometerAlarm(resource.Resource): ), QF_OP: properties.Schema( properties.Schema.STRING, - _('Comparison operator'), + _('Comparison operator.'), constraints=[QF_OP_VALS] ), QF_VALUE: properties.Schema( properties.Schema.STRING, - _('String value with which to compare') + _('String value with which to compare.') ) } ) diff --git a/heat/engine/resources/openstack/ceilometer/gnocchi/alarm.py b/heat/engine/resources/openstack/ceilometer/gnocchi/alarm.py index f740ce1d40..adfcbf0447 100644 --- a/heat/engine/resources/openstack/ceilometer/gnocchi/alarm.py +++ b/heat/engine/resources/openstack/ceilometer/gnocchi/alarm.py @@ -45,7 +45,7 @@ common_gnocchi_properties_schema = { ), AGGREGATION_METHOD: properties.Schema( properties.Schema.STRING, - _('The aggregation method to compare to the threshold'), + _('The aggregation method to compare to the threshold.'), constraints=[ constraints.AllowedValues(['mean', 'sum', 'last', 'max', 'min', 'std', 'median', 'first', 'count']), @@ -91,13 +91,13 @@ class CeilometerGnocchiResourcesAlarm(alarm.BaseCeilometerAlarm): ), RESOURCE_ID: properties.Schema( properties.Schema.STRING, - _('Id of a resource'), + _('Id of a resource.'), required=True, update_allowed=True ), RESOURCE_TYPE: properties.Schema( properties.Schema.STRING, - _('Resource type'), + _('Resource type.'), required=True, update_allowed=True ), @@ -162,13 +162,13 @@ class CeilometerGnocchiAggregationByResourcesAlarm( ), QUERY: properties.Schema( properties.Schema.STRING, - _('The query to filter the metrics'), + _('The query to filter the metrics.'), required=True, update_allowed=True ), RESOURCE_TYPE: properties.Schema( properties.Schema.STRING, - _('Resource type'), + _('Resource type.'), required=True, update_allowed=True ), diff --git a/heat/engine/resources/openstack/heat/instance_group.py b/heat/engine/resources/openstack/heat/instance_group.py index 60be576d63..6edc2d4096 100644 --- a/heat/engine/resources/openstack/heat/instance_group.py +++ b/heat/engine/resources/openstack/heat/instance_group.py @@ -97,10 +97,12 @@ class InstanceGroup(stack_resource.StackResource): schema={ TAG_KEY: properties.Schema( properties.Schema.STRING, + _('Tag key.'), required=True ), TAG_VALUE: properties.Schema( properties.Schema.STRING, + _('Tag value.'), required=True ), }, diff --git a/heat/engine/resources/openstack/heat/multi_part.py b/heat/engine/resources/openstack/heat/multi_part.py index 6284fc6aea..e18ca950fc 100644 --- a/heat/engine/resources/openstack/heat/multi_part.py +++ b/heat/engine/resources/openstack/heat/multi_part.py @@ -68,7 +68,7 @@ class MultipartMime(software_config.SoftwareConfig): properties.Schema.STRING, _('Content of part to attach, either inline or by ' 'referencing the ID of another software config ' - 'resource'), + 'resource.'), required=True ), FILENAME: properties.Schema( diff --git a/heat/engine/resources/openstack/heat/resource_group.py b/heat/engine/resources/openstack/heat/resource_group.py index 3a7c693545..a00bd33e3a 100644 --- a/heat/engine/resources/openstack/heat/resource_group.py +++ b/heat/engine/resources/openstack/heat/resource_group.py @@ -144,16 +144,16 @@ class ResourceGroup(stack_resource.StackResource): schema={ RESOURCE_DEF_TYPE: properties.Schema( properties.Schema.STRING, - _('The type of the resources in the group'), + _('The type of the resources in the group.'), required=True ), RESOURCE_DEF_PROPERTIES: properties.Schema( properties.Schema.MAP, - _('Property values for the resources in the group') + _('Property values for the resources in the group.') ), RESOURCE_DEF_METADATA: properties.Schema( 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') ), @@ -163,7 +163,7 @@ class ResourceGroup(stack_resource.StackResource): ), REMOVAL_POLICIES: properties.Schema( properties.Schema.LIST, - _('Policies for removal of resources on update'), + _('Policies for removal of resources on update.'), schema=properties.Schema( properties.Schema.MAP, _('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, " "(2) The resource reference returned from " "get_resource in a template, as available via " - "the 'refs' attribute " + "the 'refs' attribute. " "Note this is destructive on update when specified; " "even if the count is not being reduced, and once " "a resource name is removed, it's name is never " - "reused in subsequent updates" + "reused in subsequent updates." ), default=[] ), diff --git a/heat/engine/resources/openstack/heat/software_deployment.py b/heat/engine/resources/openstack/heat/software_deployment.py index 547b2dadb6..69f204dfbf 100644 --- a/heat/engine/resources/openstack/heat/software_deployment.py +++ b/heat/engine/resources/openstack/heat/software_deployment.py @@ -614,7 +614,7 @@ class SoftwareDeploymentGroup(resource_group.ResourceGroup): ), STATUS_CODES: attributes.Schema( _("A map of Nova names and returned status code from the " - "configuration execution"), + "configuration execution."), type=attributes.Schema.MAP ), } diff --git a/heat/engine/resources/openstack/heat/structured_config.py b/heat/engine/resources/openstack/heat/structured_config.py index 4e3a2485b7..cce08d7986 100644 --- a/heat/engine/resources/openstack/heat/structured_config.py +++ b/heat/engine/resources/openstack/heat/structured_config.py @@ -117,7 +117,7 @@ class StructuredDeployment(sd.SoftwareDeployment): NAME: _sd_ps[NAME], INPUT_KEY: properties.Schema( 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', ), INPUT_VALUES_VALIDATE: properties.Schema( diff --git a/heat/engine/resources/openstack/heat/swiftsignal.py b/heat/engine/resources/openstack/heat/swiftsignal.py index 69c358bc83..8e80ea01d4 100644 --- a/heat/engine/resources/openstack/heat/swiftsignal.py +++ b/heat/engine/resources/openstack/heat/swiftsignal.py @@ -163,7 +163,7 @@ class SwiftSignal(resource.Resource): TIMEOUT: properties.Schema( properties.Schema.NUMBER, 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 ' 'fail.'), required=True, diff --git a/heat/engine/resources/openstack/heat/test_resource.py b/heat/engine/resources/openstack/heat/test_resource.py index 0b21026e82..e54c9f9269 100644 --- a/heat/engine/resources/openstack/heat/test_resource.py +++ b/heat/engine/resources/openstack/heat/test_resource.py @@ -93,13 +93,13 @@ class TestResource(resource.Resource): UPDATE_REPLACE: properties.Schema( properties.Schema.BOOLEAN, _('Value which can be set to trigger update replace for ' - 'the particular resource'), + 'the particular resource.'), update_allowed=True, default=False ), WAIT_SECS: properties.Schema( properties.Schema.NUMBER, - _('Seconds to wait after an action (-1 is infinite)'), + _('Seconds to wait after an action (-1 is infinite).'), update_allowed=True, default=0, ), @@ -111,19 +111,19 @@ class TestResource(resource.Resource): CREATE_WAIT_SECS: properties.Schema( properties.Schema.NUMBER, _('Seconds to wait after a create. ' - 'Defaults to the global wait_secs'), + 'Defaults to the global wait_secs.'), update_allowed=True, ), UPDATE_WAIT_SECS: properties.Schema( properties.Schema.NUMBER, _('Seconds to wait after an update. ' - 'Defaults to the global wait_secs'), + 'Defaults to the global wait_secs.'), update_allowed=True, ), DELETE_WAIT_SECS: properties.Schema( properties.Schema.NUMBER, _('Seconds to wait after a delete. ' - 'Defaults to the global wait_secs'), + 'Defaults to the global wait_secs.'), update_allowed=True, ), } diff --git a/heat/engine/resources/openstack/keystone/role_assignments.py b/heat/engine/resources/openstack/keystone/role_assignments.py index 64530f4bf3..f649a99f1c 100644 --- a/heat/engine/resources/openstack/keystone/role_assignments.py +++ b/heat/engine/resources/openstack/keystone/role_assignments.py @@ -70,20 +70,20 @@ class KeystoneRoleAssignmentMixin(object): schema={ ROLE: properties.Schema( properties.Schema.STRING, - _('Keystone role'), + _('Keystone role.'), required=True, constraints=([constraints. CustomConstraint('keystone.role')]) ), PROJECT: properties.Schema( properties.Schema.STRING, - _('Keystone project'), + _('Keystone project.'), constraints=([constraints. CustomConstraint('keystone.project')]) ), DOMAIN: properties.Schema( properties.Schema.STRING, - _('Keystone domain'), + _('Keystone domain.'), constraints=([constraints. CustomConstraint('keystone.domain')]) ), diff --git a/heat/engine/resources/openstack/keystone/user.py b/heat/engine/resources/openstack/keystone/user.py index 8a5ffab76e..3308916919 100644 --- a/heat/engine/resources/openstack/keystone/user.py +++ b/heat/engine/resources/openstack/keystone/user.py @@ -65,7 +65,7 @@ class KeystoneUser(resource.Resource, ), ENABLED: properties.Schema( properties.Schema.BOOLEAN, - _('Keystone user is enabled or disabled'), + _('Keystone user is enabled or disabled.'), default=True, update_allowed=True ), @@ -87,11 +87,11 @@ class KeystoneUser(resource.Resource, ), GROUPS: properties.Schema( properties.Schema.LIST, - _('keystone user groups.'), + _('Keystone user groups.'), update_allowed=True, schema=properties.Schema( properties.Schema.STRING, - _('keystone user group.'), + _('Keystone user group.'), constraints=[constraints.CustomConstraint('keystone.group')] ) ) diff --git a/heat/engine/resources/openstack/mistral/workflow.py b/heat/engine/resources/openstack/mistral/workflow.py index faf7819817..da970cd0c8 100644 --- a/heat/engine/resources/openstack/mistral/workflow.py +++ b/heat/engine/resources/openstack/mistral/workflow.py @@ -103,7 +103,7 @@ class Workflow(signal_responder.SignalResponder, 'True, the body would be parsed as a simple json where each ' 'key is a workflow input, in other cases body would be parsed ' 'expecting a specific json format with two keys: "input" and ' - '"params"'), + '"params".'), update_allowed=True, support_status=support.SupportStatus(version='6.0.0') ), @@ -178,7 +178,7 @@ class Workflow(signal_responder.SignalResponder, PAUSE_BEFORE: properties.Schema( properties.Schema.BOOLEAN, _('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( properties.Schema.INTEGER, diff --git a/heat/engine/resources/openstack/monasca/alarm_definition.py b/heat/engine/resources/openstack/monasca/alarm_definition.py index 56b6bc416f..c97bd62432 100644 --- a/heat/engine/resources/openstack/monasca/alarm_definition.py +++ b/heat/engine/resources/openstack/monasca/alarm_definition.py @@ -93,7 +93,7 @@ class MonascaAlarmDefinition(resource.Resource): update_allowed=True, schema=properties.Schema( properties.Schema.STRING, - _('Monasca notification'), + _('Monasca notification.'), constraints=[constraints.CustomConstraint( 'monasca.notification') ] @@ -105,7 +105,7 @@ class MonascaAlarmDefinition(resource.Resource): update_allowed=True, schema=properties.Schema( properties.Schema.STRING, - _('Monasca notification'), + _('Monasca notification.'), constraints=[constraints.CustomConstraint( 'monasca.notification') ] @@ -118,7 +118,7 @@ class MonascaAlarmDefinition(resource.Resource): update_allowed=True, schema=properties.Schema( properties.Schema.STRING, - _('Monasca notification'), + _('Monasca notification.'), constraints=[constraints.CustomConstraint( 'monasca.notification') ] diff --git a/heat/engine/resources/openstack/neutron/net.py b/heat/engine/resources/openstack/neutron/net.py index 0c0703e696..9febf3a9bd 100644 --- a/heat/engine/resources/openstack/neutron/net.py +++ b/heat/engine/resources/openstack/neutron/net.py @@ -88,7 +88,7 @@ class Net(neutron.NeutronResource): properties.Schema.BOOLEAN, _('Flag to enable/disable port security on the network. It ' 'provides the default value for the attribute of the ports ' - 'created on this network'), + 'created on this network.'), update_allowed=True, support_status=support.SupportStatus(version='5.0.0') ), diff --git a/heat/engine/resources/openstack/neutron/port.py b/heat/engine/resources/openstack/neutron/port.py index f77f7815ed..22c255d0ef 100644 --- a/heat/engine/resources/openstack/neutron/port.py +++ b/heat/engine/resources/openstack/neutron/port.py @@ -108,8 +108,8 @@ class Port(neutron.NeutronResource): properties.Schema.STRING, _('Network this port belongs to. If you plan to use current port ' 'to assign Floating IP, you should specify %(fixed_ips)s ' - 'with %(subnet)s. Note if this changes to a different network ' - 'update, the port will be replaced') % + 'with %(subnet)s. Note if this changes to a different network ' + 'update, the port will be replaced.') % {'fixed_ips': FIXED_IPS, 'subnet': FIXED_IP_SUBNET}, support_status=support.SupportStatus(version='2014.2'), required=True, @@ -126,7 +126,7 @@ class Port(neutron.NeutronResource): properties.Schema.STRING, _('Name of the network owning the port. ' 'The value is typically network:floatingip ' - 'or network:router_interface or network:dhcp'), + 'or network:router_interface or network:dhcp.'), update_allowed=True ), FIXED_IPS: properties.Schema( diff --git a/heat/engine/resources/openstack/neutron/subnet.py b/heat/engine/resources/openstack/neutron/subnet.py index 7edd94e061..81d0858a6a 100644 --- a/heat/engine/resources/openstack/neutron/subnet.py +++ b/heat/engine/resources/openstack/neutron/subnet.py @@ -167,6 +167,7 @@ class Subnet(neutron.NeutronResource): schema={ ALLOCATION_POOL_START: properties.Schema( properties.Schema.STRING, + _('Start address for the allocation pool.'), required=True, constraints=[ constraints.CustomConstraint('ip_addr') @@ -174,6 +175,7 @@ class Subnet(neutron.NeutronResource): ), ALLOCATION_POOL_END: properties.Schema( properties.Schema.STRING, + _('End address for the allocation pool.'), required=True, constraints=[ constraints.CustomConstraint('ip_addr') @@ -190,11 +192,13 @@ class Subnet(neutron.NeutronResource): ), HOST_ROUTES: properties.Schema( properties.Schema.LIST, + _('A list of host route dictionaries for the subnet.'), schema=properties.Schema( properties.Schema.MAP, schema={ ROUTE_DESTINATION: properties.Schema( properties.Schema.STRING, + _('The destination for static route.'), required=True, constraints=[ constraints.CustomConstraint('net_cidr') @@ -202,6 +206,7 @@ class Subnet(neutron.NeutronResource): ), ROUTE_NEXTHOP: properties.Schema( properties.Schema.STRING, + _('The next hop for the destination.'), required=True, constraints=[ constraints.CustomConstraint('ip_addr') diff --git a/heat/engine/resources/openstack/neutron/subnetpool.py b/heat/engine/resources/openstack/neutron/subnetpool.py index d4c16effcd..1a8b0966ec 100644 --- a/heat/engine/resources/openstack/neutron/subnetpool.py +++ b/heat/engine/resources/openstack/neutron/subnetpool.py @@ -99,10 +99,10 @@ class SubnetPool(neutron.NeutronResource): ), IS_DEFAULT: properties.Schema( properties.Schema.BOOLEAN, - _('Whether this is default IPv4/IPv6 subnet pool.' - 'There can only be one default subnet pool for each IP family.' + _('Whether this is default IPv4/IPv6 subnet pool. ' + 'There can only be one default subnet pool for each IP family. ' 'Note that the default policy setting restricts administrative ' - 'users to set this to True'), + 'users to set this to True.'), default=False, update_allowed=True, ), diff --git a/heat/engine/resources/openstack/nova/server.py b/heat/engine/resources/openstack/nova/server.py index 20b90639ea..71ad368ac5 100644 --- a/heat/engine/resources/openstack/nova/server.py +++ b/heat/engine/resources/openstack/nova/server.py @@ -288,7 +288,8 @@ class Server(stack_user.StackUser, sh.SchedulerHintsMixin, IMAGE_UPDATE_POLICY: properties.Schema( properties.Schema.STRING, _('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', constraints=[ constraints.AllowedValues(['REBUILD', 'REPLACE', @@ -409,7 +410,7 @@ class Server(stack_user.StackUser, sh.SchedulerHintsMixin, METADATA: properties.Schema( properties.Schema.MAP, _('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 ' 'string must be 255 characters or less).'), update_allowed=True diff --git a/heat/engine/resources/openstack/sahara/job_binary.py b/heat/engine/resources/openstack/sahara/job_binary.py index 8fca31966c..2c8b0a5191 100644 --- a/heat/engine/resources/openstack/sahara/job_binary.py +++ b/heat/engine/resources/openstack/sahara/job_binary.py @@ -52,7 +52,7 @@ class JobBinary(resource.Resource): URL: properties.Schema( properties.Schema.STRING, _('URL for the job binary. Must be in the format ' - 'swift:/// or internal-db://'), + 'swift:/// or internal-db://.'), required=True, update_allowed=True ), diff --git a/heat/engine/resources/openstack/senlin/profile.py b/heat/engine/resources/openstack/senlin/profile.py index 07e78b242b..cd4ed8438e 100644 --- a/heat/engine/resources/openstack/senlin/profile.py +++ b/heat/engine/resources/openstack/senlin/profile.py @@ -59,7 +59,7 @@ class Profile(resource.Resource): ), PROFILE_PROPERTIES: properties.Schema( properties.Schema.MAP, - _('Properties for profile'), + _('Properties for profile.'), ) } diff --git a/tools/custom_guidelines.py b/tools/custom_guidelines.py index 8f435af6a4..4b7861a373 100644 --- a/tools/custom_guidelines.py +++ b/tools/custom_guidelines.py @@ -25,7 +25,7 @@ from heat.engine import support class HeatCustomGuidelines(object): - _RULES = [] + _RULES = ['resource_descriptions'] def __init__(self, exclude): self.error_count = 0 @@ -55,16 +55,13 @@ class HeatCustomGuidelines(object): # check resource's description #self._check_resource_description(cls) # check properties' descriptions - #self._check_resource_schemas(cls, cls.properties_schema, - # 'property') + self._check_resource_schemas(cls, cls.properties_schema, + 'property') # check attributes' descriptions #self._check_resource_schemas(cls, cls.attributes_schema, # 'attribute') # check methods descriptions #self._check_resource_methods(cls) - # TODO(prazumovsky): remove when at least one check will be - # available - pass def _check_resource_description(self, resource): description = resource.__doc__