Skip to content

Commit

Permalink
github_actions: add flake8 fixes and enabled checks
Browse files Browse the repository at this point in the history
Co-Authored-By: Cristian Matiut <cmatiut@cloudbasesolutions.com>
  • Loading branch information
ader1990 and Cristi1324 committed Oct 19, 2023
1 parent 64d86bf commit ae41997
Show file tree
Hide file tree
Showing 107 changed files with 932 additions and 809 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,5 @@ jobs:
- name: Run unit tests with tox
shell: bash
run: |
tox -e py3 -v
tox -e py3,pep8 -v
7 changes: 3 additions & 4 deletions coriolis/api/v1/diagnostics.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
# Copyright 2016 Cloudbase Solutions Srl
# All Rights Reserved.

import logging

from coriolis import exception
from coriolis.api import wsgi as api_wsgi
from coriolis.api.v1.views import diagnostic_view
from coriolis.api import wsgi as api_wsgi
from coriolis.diagnostics import api
from coriolis.policies import diagnostics

import logging


LOG = logging.getLogger(__name__)

Expand Down
6 changes: 3 additions & 3 deletions coriolis/api/v1/endpoint_actions.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Copyright 2016 Cloudbase Solutions Srl
# All Rights Reserved.

from webob import exc

from coriolis import exception
from coriolis.api import wsgi as api_wsgi
from coriolis.endpoints import api
from coriolis import exception
from coriolis.policies import endpoints as endpoint_policies

from webob import exc


class EndpointActionsController(api_wsgi.Controller):
def __init__(self):
Expand Down
12 changes: 7 additions & 5 deletions coriolis/api/v1/endpoint_destination_minion_pool_options.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Copyright 2020 Cloudbase Solutions Srl
# All Rights Reserved.

from oslo_log import log as logging

from coriolis import utils
from coriolis.api.v1.views import endpoint_options_view
from coriolis.api import wsgi as api_wsgi
from coriolis.endpoint_options import api
from coriolis.policies import endpoints as endpoint_policies
from coriolis import utils

from oslo_log import log as logging


LOG = logging.getLogger(__name__)
Expand Down Expand Up @@ -35,9 +35,11 @@ def index(self, req, endpoint_id):
else:
options = {}

return endpoint_options_view.destination_minion_pool_options_collection(
return (endpoint_options_view.
destination_minion_pool_options_collection)(
req,
self._minion_pool_options_api.get_endpoint_destination_minion_pool_options(
(self._minion_pool_options_api.
get_endpoint_destination_minion_pool_options)(
context, endpoint_id, env=env, option_names=options))


Expand Down
6 changes: 3 additions & 3 deletions coriolis/api/v1/endpoint_destination_options.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Copyright 2018 Cloudbase Solutions Srl
# All Rights Reserved.

from oslo_log import log as logging

from coriolis import utils
from coriolis.api.v1.views import endpoint_options_view
from coriolis.api import wsgi as api_wsgi
from coriolis.endpoint_options import api
from coriolis.policies import endpoints as endpoint_policies
from coriolis import utils

from oslo_log import log as logging


LOG = logging.getLogger(__name__)
Expand Down
6 changes: 3 additions & 3 deletions coriolis/api/v1/endpoint_instances.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Copyright 2016 Cloudbase Solutions Srl
# All Rights Reserved.

from oslo_log import log as logging

from coriolis import utils
from coriolis.api import common
from coriolis.api.v1.views import endpoint_resources_view
from coriolis.api import wsgi as api_wsgi
from coriolis.endpoint_resources import api
from coriolis.policies import endpoints as endpoint_policies
from coriolis import utils

from oslo_log import log as logging

LOG = logging.getLogger(__name__)

Expand Down
6 changes: 3 additions & 3 deletions coriolis/api/v1/endpoint_networks.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Copyright 2017 Cloudbase Solutions Srl
# All Rights Reserved.

from oslo_log import log as logging

from coriolis import utils
from coriolis.api.v1.views import endpoint_resources_view
from coriolis.api import wsgi as api_wsgi
from coriolis.endpoint_resources import api
from coriolis.policies import endpoints as endpoint_policies
from coriolis import utils

from oslo_log import log as logging

LOG = logging.getLogger(__name__)

Expand Down
9 changes: 5 additions & 4 deletions coriolis/api/v1/endpoint_source_minion_pool_options.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Copyright 2020 Cloudbase Solutions Srl
# All Rights Reserved.

from oslo_log import log as logging

from coriolis import utils
from coriolis.api.v1.views import endpoint_options_view
from coriolis.api import wsgi as api_wsgi
from coriolis.endpoint_options import api
from coriolis.policies import endpoints as endpoint_policies
from coriolis import utils

from oslo_log import log as logging


LOG = logging.getLogger(__name__)
Expand Down Expand Up @@ -37,7 +37,8 @@ def index(self, req, endpoint_id):

return endpoint_options_view.source_minion_pool_options_collection(
req,
self._minion_pool_options_api.get_endpoint_source_minion_pool_options(
(self._minion_pool_options_api.
get_endpoint_source_minion_pool_options)(
context, endpoint_id, env=env, option_names=options))


Expand Down
6 changes: 3 additions & 3 deletions coriolis/api/v1/endpoint_source_options.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Copyright 2019 Cloudbase Solutions Srl
# All Rights Reserved.

from oslo_log import log as logging

from coriolis import utils
from coriolis.api.v1.views import endpoint_options_view
from coriolis.api import wsgi as api_wsgi
from coriolis.endpoint_options import api
from coriolis.policies import endpoints as endpoint_policies
from coriolis import utils

from oslo_log import log as logging


LOG = logging.getLogger(__name__)
Expand Down
6 changes: 3 additions & 3 deletions coriolis/api/v1/endpoint_storage.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Copyright 2018 Cloudbase Solutions Srl
# All Rights Reserved.

from oslo_log import log as logging

from coriolis import utils
from coriolis.api.v1.views import endpoint_resources_view
from coriolis.api import wsgi as api_wsgi
from coriolis.endpoint_resources import api
from coriolis.policies import endpoints as endpoint_policies
from coriolis import utils

from oslo_log import log as logging

LOG = logging.getLogger(__name__)

Expand Down
11 changes: 6 additions & 5 deletions coriolis/api/v1/endpoints.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
# Copyright 2016 Cloudbase Solutions Srl
# All Rights Reserved.

from oslo_log import log as logging
from webob import exc

from coriolis import exception
from coriolis.api.v1.views import endpoint_view
from coriolis.api.v1 import utils as api_utils
from coriolis.api.v1.views import endpoint_view
from coriolis.api import wsgi as api_wsgi
from coriolis.endpoints import api
from coriolis import exception
from coriolis.policies import endpoints as endpoint_policies

from oslo_log import log as logging
from webob import exc


LOG = logging.getLogger(__name__)


Expand Down
6 changes: 3 additions & 3 deletions coriolis/api/v1/migration_actions.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Copyright 2016 Cloudbase Solutions Srl
# All Rights Reserved.

from webob import exc

from coriolis import exception
from coriolis.api import wsgi as api_wsgi
from coriolis import exception
from coriolis.migrations import api
from coriolis.policies import migrations as migration_policies

from webob import exc


class MigrationActionsController(api_wsgi.Controller):
def __init__(self):
Expand Down
18 changes: 10 additions & 8 deletions coriolis/api/v1/migrations.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# Copyright 2016 Cloudbase Solutions Srl
# All Rights Reserved.

from oslo_config import cfg as conf
from oslo_log import log as logging
from webob import exc

from coriolis import exception
from coriolis.api.v1 import utils as api_utils
from coriolis.api.v1.views import migration_view
from coriolis.api import wsgi as api_wsgi
from coriolis.endpoints import api as endpoints_api
from coriolis import exception
from coriolis.migrations import api
from coriolis.policies import migrations as migration_policies

from oslo_config import cfg as conf
from oslo_log import log as logging
from webob import exc


MIGRATIONS_API_OPTS = [
conf.BoolOpt("include_task_info_in_migrations_api",
Expand Down Expand Up @@ -53,7 +53,8 @@ def _list(self, req):
req, self._migration_api.get_migrations(
context,
include_tasks=CONF.api.include_task_info_in_migrations_api,
include_task_info=CONF.api.include_task_info_in_migrations_api))
include_task_info=CONF.api.include_task_info_in_migrations_api
))

def index(self, req):
return self._list(req)
Expand Down Expand Up @@ -143,8 +144,9 @@ def create(self, req, body):
# NOTE: destination environment for replica should have been
# validated upon its creation.
migration = self._migration_api.deploy_replica_instances(
context, replica_id, instance_osmorphing_minion_pool_mappings, clone_disks,
force, skip_os_morphing, user_scripts=user_scripts)
context, replica_id, instance_osmorphing_minion_pool_mappings,
clone_disks, force, skip_os_morphing,
user_scripts=user_scripts)
else:
(origin_endpoint_id,
destination_endpoint_id,
Expand Down
8 changes: 4 additions & 4 deletions coriolis/api/v1/minion_pool_actions.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Copyright 2016 Cloudbase Solutions Srl
# All Rights Reserved.

from webob import exc

from coriolis import exception
from coriolis.api.v1.views import minion_pool_view
from coriolis.api import wsgi as api_wsgi
from coriolis.policies import minion_pools as minion_pool_policies
from coriolis import exception
from coriolis.minion_pools import api
from coriolis.policies import minion_pools as minion_pool_policies

from webob import exc


class MinionPoolActionsController(api_wsgi.Controller):
Expand Down
33 changes: 19 additions & 14 deletions coriolis/api/v1/minion_pools.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# Copyright 2020 Cloudbase Solutions Srl
# All Rights Reserved.

from oslo_log import log as logging
from webob import exc

from coriolis import constants
from coriolis import exception
from coriolis.api.v1.views import minion_pool_view
from coriolis.api.v1 import utils as api_utils
from coriolis.api.v1.views import minion_pool_view
from coriolis.api import wsgi as api_wsgi
from coriolis import constants
from coriolis.endpoints import api as endpoints_api
from coriolis.policies import minion_pools as pools_policies
from coriolis import exception
from coriolis.minion_pools import api
from coriolis.policies import minion_pools as pools_policies

from oslo_log import log as logging
from webob import exc

LOG = logging.getLogger(__name__)

Expand Down Expand Up @@ -65,15 +65,16 @@ def _check_pool_numeric_values(
if maximum_minions < minimum_minions:
raise Exception(
"'maximum_minions' value (%s) must be at least as large as"
" the 'minimum_minions' value (%s)." % (
maximum_minions, minimum_minions))
" the 'minimum_minions' value (%s)." %
(maximum_minions, minimum_minions))
if minion_max_idle_time is not None:
if minion_max_idle_time <= 0:
raise Exception(
"'minion_max_idle_time' must be a strictly positive "
"integer. Got: %s" % maximum_minions)

@api_utils.format_keyerror_message(resource='minion_pool', method='create')
@api_utils.format_keyerror_message(resource='minion_pool',
method='create')
def _validate_create_body(self, ctxt, body):
minion_pool = body["minion_pool"]
name = minion_pool["name"]
Expand Down Expand Up @@ -104,7 +105,8 @@ def _validate_create_body(self, ctxt, body):
self._endpoints_api.validate_endpoint_source_minion_pool_options(
ctxt, endpoint_id, environment_options)
elif pool_platform == constants.PROVIDER_PLATFORM_DESTINATION:
self._endpoints_api.validate_endpoint_destination_minion_pool_options(
(self._endpoints_api.
validate_endpoint_destination_minion_pool_options)(
ctxt, endpoint_id, environment_options)

minimum_minions = minion_pool.get("minimum_minions", 1)
Expand Down Expand Up @@ -141,7 +143,8 @@ def create(self, req, body):
minion_max_idle_time, minion_retention_strategy, notes=notes,
skip_allocation=skip_allocation))

@api_utils.format_keyerror_message(resource='minion_pool', method='update')
@api_utils.format_keyerror_message(resource='minion_pool',
method='update')
def _validate_update_body(self, id, context, body):
minion_pool = body["minion_pool"]
if 'endpoint_id' in minion_pool:
Expand Down Expand Up @@ -173,12 +176,14 @@ def _validate_update_body(self, id, context, body):
if 'environment_options' in vals:
if minion_pool['platform'] == (
constants.PROVIDER_PLATFORM_SOURCE):
self._endpoints_api.validate_endpoint_source_minion_pool_options(
(self._endpoints_api.
validate_endpoint_source_minion_pool_options)(
context, minion_pool['endpoint_id'],
vals['environment_options'])
elif minion_pool['platform'] == (
constants.PROVIDER_PLATFORM_DESTINATION):
self._endpoints_api.validate_endpoint_destination_minion_pool_options(
(self._endpoints_api.
validate_endpoint_destination_minion_pool_options)(
context, minion_pool['endpoint_id'],
vals['environment_options'])
else:
Expand Down
6 changes: 3 additions & 3 deletions coriolis/api/v1/providers.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Copyright 2016 Cloudbase Solutions Srl
# All Rights Reserved.

from oslo_log import log as logging

from coriolis.api import wsgi as api_wsgi
from coriolis.providers import api
from coriolis.policies import general as general_policies
from coriolis.providers import api

from oslo_log import log as logging

LOG = logging.getLogger(__name__)

Expand Down
Loading

0 comments on commit ae41997

Please sign in to comment.