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
changes/16/281816/4
Peter Razumovsky 7 years ago
parent 1350ee4b7d
commit 1d16909dfd
  1. 10
      heat/engine/resources/openstack/ceilometer/alarm.py
  2. 10
      heat/engine/resources/openstack/ceilometer/gnocchi/alarm.py
  3. 2
      heat/engine/resources/openstack/heat/instance_group.py
  4. 2
      heat/engine/resources/openstack/heat/multi_part.py
  5. 12
      heat/engine/resources/openstack/heat/resource_group.py
  6. 2
      heat/engine/resources/openstack/heat/software_deployment.py
  7. 2
      heat/engine/resources/openstack/heat/structured_config.py
  8. 2
      heat/engine/resources/openstack/heat/swiftsignal.py
  9. 10
      heat/engine/resources/openstack/heat/test_resource.py
  10. 6
      heat/engine/resources/openstack/keystone/role_assignments.py
  11. 6
      heat/engine/resources/openstack/keystone/user.py
  12. 4
      heat/engine/resources/openstack/mistral/workflow.py
  13. 6
      heat/engine/resources/openstack/monasca/alarm_definition.py
  14. 2
      heat/engine/resources/openstack/neutron/net.py
  15. 6
      heat/engine/resources/openstack/neutron/port.py
  16. 5
      heat/engine/resources/openstack/neutron/subnet.py
  17. 6
      heat/engine/resources/openstack/neutron/subnetpool.py
  18. 5
      heat/engine/resources/openstack/nova/server.py
  19. 2
      heat/engine/resources/openstack/sahara/job_binary.py
  20. 2
      heat/engine/resources/openstack/senlin/profile.py
  21. 9
      tools/custom_guidelines.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.')
)
}
)

@ -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
),

@ -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
),
},

@ -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(

@ -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=[]
),

@ -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
),
}

@ -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(

@ -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,

@ -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,
),
}

@ -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')])
),

@ -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')]
)
)

@ -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,

@ -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')
]

@ -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')
),

@ -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(

@ -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')

@ -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,
),

@ -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

@ -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://<container>/<path> or internal-db://<uuid>'),
'swift://<container>/<path> or internal-db://<uuid>.'),
required=True,
update_allowed=True
),

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

@ -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__

Loading…
Cancel
Save