mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 13:52:54 +00:00
Bug fixes and cleanup for ansible-test. (#45991)
* Remove unused imports. * Clean up ConfigParser usage in ansible-test. * Fix bare except statements in ansible-test. * Miscellaneous cleanup from PyCharm inspections. * Enable pylint no-self-use for ansible-test. * Remove obsolete pylint ignores for Python 3.7. * Fix shellcheck issuers under newer shellcheck. * Use newer path for ansible-test. * Fix issues in code-smell tests.
This commit is contained in:
@@ -28,13 +28,6 @@ from lib.docker_util import (
|
||||
get_docker_container_id,
|
||||
)
|
||||
|
||||
try:
|
||||
# noinspection PyPep8Naming
|
||||
import ConfigParser as configparser
|
||||
except ImportError:
|
||||
# noinspection PyUnresolvedReferences
|
||||
import configparser
|
||||
|
||||
|
||||
class ACMEProvider(CloudProvider):
|
||||
"""ACME plugin. Sets up cloud resources for tests."""
|
||||
|
||||
@@ -17,6 +17,7 @@ from lib.util import (
|
||||
display,
|
||||
SubprocessError,
|
||||
is_shippable,
|
||||
ConfigParser,
|
||||
)
|
||||
|
||||
from lib.http import (
|
||||
@@ -34,13 +35,6 @@ from lib.docker_util import (
|
||||
get_docker_container_id,
|
||||
)
|
||||
|
||||
try:
|
||||
# noinspection PyPep8Naming
|
||||
import ConfigParser as configparser
|
||||
except ImportError:
|
||||
# noinspection PyUnresolvedReferences
|
||||
import configparser
|
||||
|
||||
|
||||
class CsCloudProvider(CloudProvider):
|
||||
"""CloudStack cloud provider plugin. Sets up cloud resources before delegation."""
|
||||
@@ -119,7 +113,7 @@ class CsCloudProvider(CloudProvider):
|
||||
|
||||
def _setup_static(self):
|
||||
"""Configure CloudStack tests for use with static configuration."""
|
||||
parser = configparser.RawConfigParser()
|
||||
parser = ConfigParser()
|
||||
parser.read(self.config_static_path)
|
||||
|
||||
self.endpoint = parser.get('cloudstack', 'endpoint')
|
||||
@@ -211,7 +205,7 @@ class CsCloudProvider(CloudProvider):
|
||||
containers = bridge['Containers']
|
||||
container = [containers[container] for container in containers if containers[container]['Name'] == self.DOCKER_SIMULATOR_NAME][0]
|
||||
return re.sub(r'/[0-9]+$', '', container['IPv4Address'])
|
||||
except:
|
||||
except Exception:
|
||||
display.error('Failed to process the following docker network inspect output:\n%s' %
|
||||
json.dumps(networks, indent=4, sort_keys=True))
|
||||
raise
|
||||
|
||||
@@ -6,9 +6,7 @@ from __future__ import absolute_import, print_function
|
||||
import os
|
||||
|
||||
from lib.util import (
|
||||
ApplicationError,
|
||||
display,
|
||||
is_shippable,
|
||||
)
|
||||
|
||||
from lib.cloud import (
|
||||
@@ -16,9 +14,6 @@ from lib.cloud import (
|
||||
CloudEnvironment,
|
||||
)
|
||||
|
||||
from lib.core_ci import (
|
||||
AnsibleCoreCI, )
|
||||
|
||||
|
||||
class GcpCloudProvider(CloudProvider):
|
||||
"""GCP cloud provider plugin. Sets up cloud resources before delegation."""
|
||||
|
||||
@@ -1,17 +1,12 @@
|
||||
"""OpenNebula plugin for integration tests."""
|
||||
|
||||
import os
|
||||
|
||||
from lib.cloud import (
|
||||
CloudProvider,
|
||||
CloudEnvironment
|
||||
)
|
||||
|
||||
from lib.util import (
|
||||
find_executable,
|
||||
ApplicationError,
|
||||
display,
|
||||
is_shippable,
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -4,20 +4,13 @@ from __future__ import absolute_import, print_function
|
||||
import os
|
||||
import time
|
||||
|
||||
try:
|
||||
# noinspection PyPep8Naming
|
||||
import ConfigParser as configparser
|
||||
except ImportError:
|
||||
# noinspection PyUnresolvedReferences
|
||||
import configparser
|
||||
|
||||
from lib.util import (
|
||||
display,
|
||||
ApplicationError,
|
||||
is_shippable,
|
||||
run_command,
|
||||
generate_password,
|
||||
SubprocessError,
|
||||
ConfigParser,
|
||||
)
|
||||
|
||||
from lib.cloud import (
|
||||
@@ -27,15 +20,6 @@ from lib.cloud import (
|
||||
|
||||
from lib.core_ci import (
|
||||
AnsibleCoreCI,
|
||||
InstanceConnection,
|
||||
)
|
||||
|
||||
from lib.manage_ci import (
|
||||
ManagePosixCI,
|
||||
)
|
||||
|
||||
from lib.http import (
|
||||
HttpClient,
|
||||
)
|
||||
|
||||
|
||||
@@ -219,7 +203,7 @@ class TowerConfig(object):
|
||||
:type path: str
|
||||
:rtype: TowerConfig
|
||||
"""
|
||||
parser = configparser.RawConfigParser()
|
||||
parser = ConfigParser()
|
||||
parser.read(path)
|
||||
|
||||
keys = (
|
||||
|
||||
@@ -21,13 +21,6 @@ from lib.docker_util import (
|
||||
get_docker_container_id,
|
||||
)
|
||||
|
||||
try:
|
||||
# noinspection PyPep8Naming
|
||||
import ConfigParser as configparser
|
||||
except ImportError:
|
||||
# noinspection PyUnresolvedReferences
|
||||
import configparser
|
||||
|
||||
|
||||
class VcenterProvider(CloudProvider):
|
||||
"""VMware vcenter/esx plugin. Sets up cloud resources for tests."""
|
||||
|
||||
Reference in New Issue
Block a user