diff --git a/ironic/common/glance_service/service_utils.py b/ironic/common/glance_service/service_utils.py index 94cfd2353e..b389036092 100644 --- a/ironic/common/glance_service/service_utils.py +++ b/ironic/common/glance_service/service_utils.py @@ -155,7 +155,8 @@ def is_image_available(context, image): return True if ((getattr(image, 'is_public', None) - or getattr(image, 'visibility', None) == 'public') or context.is_admin): + or getattr(image, 'visibility', None) == 'public') + or context.is_admin): return True properties = image.properties if context.project_id and ('owner_id' in properties): diff --git a/ironic/conductor/base_manager.py b/ironic/conductor/base_manager.py index 4ea04303ee..3ed7fc7ba0 100644 --- a/ironic/conductor/base_manager.py +++ b/ironic/conductor/base_manager.py @@ -490,7 +490,8 @@ class BaseConductorManager(object): with task_manager.acquire(context, node_uuid, purpose='node state check') as task: if (task.node.maintenance - or task.node.provision_state not in provision_state): + or task.node.provision_state + not in provision_state): continue target_state = (None if not keep_target_state else diff --git a/ironic/conductor/manager.py b/ironic/conductor/manager.py index d832b1eefe..38e0178774 100644 --- a/ironic/conductor/manager.py +++ b/ironic/conductor/manager.py @@ -203,7 +203,8 @@ class ConductorManager(base_manager.BaseConductorManager): # result in the new resource class exposed on the node as available # for consumption, and nova may try to schedule on this node again. if ('resource_class' in delta and task.node.resource_class - and task.node.provision_state not in allowed_update_states): + and task.node.provision_state + not in allowed_update_states): raise exception.InvalidState( action % {'node': node_obj.uuid, 'allowed': ', '.join(allowed_update_states), @@ -1938,7 +1939,8 @@ class ConductorManager(base_manager.BaseConductorManager): # INSPECTIONFAIL -> MANAGEABLE # DEPLOYFAIL -> DELETING if (not node.maintenance - and node.provision_state not in states.DELETE_ALLOWED_STATES): + and node.provision_state + not in states.DELETE_ALLOWED_STATES): msg = (_('Can not delete node "%(node)s" while it is in ' 'provision state "%(state)s". Valid provision states ' 'to perform deletion are: "%(valid_states)s", ' diff --git a/ironic/db/sqlalchemy/api.py b/ironic/db/sqlalchemy/api.py index e8a2a4bc95..bced9d74ea 100644 --- a/ironic/db/sqlalchemy/api.py +++ b/ironic/db/sqlalchemy/api.py @@ -77,7 +77,7 @@ def _wrap_session(session): def _get_node_query_with_all(): - """Return a query object for the Node model joined with all relevant fields. + """Return a query object for the Node joined with all relevant fields. :returns: a query object. """ @@ -254,7 +254,8 @@ class Connection(api.Connection): filters['reserved_by_any_of'])) if 'provisioned_before' in filters: limit = (timeutils.utcnow() - - datetime.timedelta(seconds=filters['provisioned_before'])) + - datetime.timedelta( + seconds=filters['provisioned_before'])) query = query.filter(models.Node.provision_updated_at < limit) if 'inspection_started_before' in filters: limit = ((timeutils.utcnow()) diff --git a/ironic/drivers/modules/oneview/common.py b/ironic/drivers/modules/oneview/common.py index 811109edae..066730de4e 100644 --- a/ironic/drivers/modules/oneview/common.py +++ b/ironic/drivers/modules/oneview/common.py @@ -417,7 +417,7 @@ def _validate_server_profile_template_server_hardware_type( def _validate_spt_enclosure_group(server_profile_template, server_hardware): - """Validate Server Profile Template's Enclosure Group and Server Hardware's. + """Validate Server Profile Template's Enclosure Group and Hardware's. :param: server_profile_template: OneView Server Profile Template object. :param: server_hardware: OneView Server Hardware object. diff --git a/ironic/drivers/modules/oneview/inspect.py b/ironic/drivers/modules/oneview/inspect.py index 109790be6d..e2b99728bb 100644 --- a/ironic/drivers/modules/oneview/inspect.py +++ b/ironic/drivers/modules/oneview/inspect.py @@ -42,7 +42,7 @@ class OneViewInspect(inspector.Inspector): @METRICS.timer('OneViewInspect.validate') def validate(self, task): - """Checks required info on 'driver_info' and validates node with OneView + """Checks required info on 'driver_info' and validates node for OneView Validates whether the 'driver_info' property of the supplied task's node contains the required info such as server_hardware_uri, diff --git a/ironic/drivers/modules/oneview/management.py b/ironic/drivers/modules/oneview/management.py index 27defc2d89..7caeddc35e 100644 --- a/ironic/drivers/modules/oneview/management.py +++ b/ironic/drivers/modules/oneview/management.py @@ -185,7 +185,7 @@ class OneViewManagement(base.ManagementInterface): @METRICS.timer('OneViewManagement.validate') def validate(self, task): - """Checks required info on 'driver_info' and validates node with OneView + """Checks required info on 'driver_info' and validates node for OneView Validates whether the 'driver_info' property of the supplied task's node contains the required info such as server_hardware_uri, diff --git a/ironic/drivers/modules/oneview/power.py b/ironic/drivers/modules/oneview/power.py index 07bd6aa581..21013f1046 100644 --- a/ironic/drivers/modules/oneview/power.py +++ b/ironic/drivers/modules/oneview/power.py @@ -69,7 +69,7 @@ class OneViewPower(base.PowerInterface): @METRICS.timer('OneViewPower.validate') def validate(self, task): - """Checks required info on 'driver_info' and validates node with OneView + """Checks required info on 'driver_info' and validates node for OneView Validates whether the 'oneview_info' property of the supplied task's node contains the required info such as server_hardware_uri, diff --git a/ironic/objects/portgroup.py b/ironic/objects/portgroup.py index 360f876f61..add50ce259 100644 --- a/ironic/objects/portgroup.py +++ b/ironic/objects/portgroup.py @@ -146,7 +146,7 @@ class Portgroup(base.IronicObject, object_base.VersionedObjectDictCompat): # @object_base.remotable_classmethod @classmethod def get_by_id(cls, context, portgroup_id): - """Find a portgroup based on its integer ID and return a Portgroup object. + """Find a portgroup by its integer ID and return a Portgroup object. :param cls: the :class:`Portgroup` :param context: Security context @@ -165,7 +165,7 @@ class Portgroup(base.IronicObject, object_base.VersionedObjectDictCompat): # @object_base.remotable_classmethod @classmethod def get_by_uuid(cls, context, uuid): - """Find a portgroup based on UUID and return a :class:`Portgroup` object. + """Find a portgroup by UUID and return a :class:`Portgroup` object. :param cls: the :class:`Portgroup` :param context: Security context @@ -184,7 +184,7 @@ class Portgroup(base.IronicObject, object_base.VersionedObjectDictCompat): # @object_base.remotable_classmethod @classmethod def get_by_address(cls, context, address): - """Find a portgroup based on address and return a :class:`Portgroup` object. + """Find portgroup by address and return a :class:`Portgroup` object. :param cls: the :class:`Portgroup` :param context: Security context @@ -203,7 +203,7 @@ class Portgroup(base.IronicObject, object_base.VersionedObjectDictCompat): # @object_base.remotable_classmethod @classmethod def get_by_name(cls, context, name): - """Find a portgroup based on name and return a :class:`Portgroup` object. + """Find portgroup based on name and return a :class:`Portgroup` object. :param cls: the :class:`Portgroup` :param context: Security context diff --git a/tox.ini b/tox.ini index e838a0e6ec..939cbddc0b 100644 --- a/tox.ini +++ b/tox.ini @@ -106,9 +106,11 @@ commands = {posargs} [flake8] # [W503] Line break before binary operator. -# NOTE(TheJulia): Adding W606,E501 to the ignore list -# until we are able to clean them up in the code base. -ignore = E129,W503,W606,E501 +# NOTE(TheJulia): Adding W606 to the ignore list +# until we are able to remove them due to deprecation +# period passing. Patch merged in March 2018 to rename +# method arguments from reserved keywords. +ignore = E129,W503,W606 filename = *.py,app.wsgi exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build import-order-style = pep8