Updates tox.ini to remove suppressed H401.

Updates the code files containing H401 bug.

Change-Id: Ib0511a9447aa676cef3af7cdfcd9fd92748283b7
Closes-Bug: #1257294
This commit is contained in:
Sushil Kumar 2013-12-03 13:52:24 +00:00
parent 5aaac4c6fa
commit 2daad86fa9
18 changed files with 45 additions and 45 deletions

View File

@ -33,7 +33,7 @@ commands = {posargs}
[flake8]
show-source = True
ignore = F403,F821,H301,H306,H401,H402,H403,H404,H702
ignore = F403,F821,H301,H306,H402,H403,H404,H702
builtins = _
exclude=.venv,.tox,dist,doc,openstack,*egg,rsdns,tools,etc,build
filename=*.py,trove-*

View File

@ -27,11 +27,11 @@ ENV = jinja2.Environment(loader=jinja2.ChoiceLoader([
class SingleInstanceConfigTemplate(object):
""" This class selects a single configuration file by database type for
"""This class selects a single configuration file by database type for
rendering on the guest """
def __init__(self, datastore_manager, flavor_dict, instance_id):
""" Constructor
"""Constructor
:param datastore_manager: The datastore manager.
:type name: str.
@ -47,7 +47,7 @@ class SingleInstanceConfigTemplate(object):
self.instance_id = instance_id
def render(self):
""" Renders the jinja template
"""Renders the jinja template
:returns: str -- The rendered configuration file

View File

@ -38,7 +38,7 @@ class RootController(wsgi.Controller):
"""Controller for instance functionality"""
def index(self, req, tenant_id, instance_id):
""" Returns True if root is enabled for the given instance;
"""Returns True if root is enabled for the given instance;
False otherwise. """
LOG.info(_("Getting root enabled for instance '%s'") % instance_id)
LOG.info(_("req : '%s'\n\n") % req)
@ -47,7 +47,7 @@ class RootController(wsgi.Controller):
return wsgi.Result(views.RootEnabledView(is_root_enabled).data(), 200)
def create(self, req, tenant_id, instance_id):
""" Enable the root user for the db instance """
"""Enable the root user for the db instance """
LOG.info(_("Enabling root for instance '%s'") % instance_id)
LOG.info(_("req : '%s'\n\n") % req)
context = req.environ[wsgi.CONTEXT_KEY]

View File

@ -145,7 +145,7 @@ class Manager(periodic_task.PeriodicTasks):
app.stop_db(do_not_start_on_reboot=do_not_start_on_reboot)
def get_filesystem_stats(self, context, fs_path):
""" Gets the filesystem stats for the path given """
"""Gets the filesystem stats for the path given """
return dbaas.get_filesystem_volume_stats(fs_path)
def create_backup(self, context, backup_info):

View File

@ -532,7 +532,7 @@ class MySqlApp(object):
TIME_OUT = 1000
def __init__(self, status):
""" By default login with root no password for initial setup. """
"""By default login with root no password for initial setup. """
self.state_change_wait_time = CONF.state_change_wait_time
self.status = status
@ -549,7 +549,7 @@ class MySqlApp(object):
@staticmethod
def _generate_root_password(client):
""" Generate and set a random root password and forget about it. """
"""Generate and set a random root password and forget about it. """
localhost = "localhost"
uu = sql_query.UpdateUser("root", host=localhost,
clear=generate_random_password())

View File

@ -45,7 +45,7 @@ class UnknownBackupType(Exception):
class BackupRunner(Strategy):
""" Base class for Backup Strategy implementations """
"""Base class for Backup Strategy implementations """
__strategy_type__ = 'backup_runner'
__strategy_ns__ = 'trove.guestagent.strategies.backup'

View File

@ -23,7 +23,7 @@ LOG = logging.getLogger(__name__)
class MySQLDump(base.BackupRunner):
""" Implementation of Backup Strategy for MySQLDump """
"""Implementation of Backup Strategy for MySQLDump """
__strategy_name__ = 'mysqldump'
@property
@ -42,7 +42,7 @@ class MySQLDump(base.BackupRunner):
class InnoBackupEx(base.BackupRunner):
""" Implementation of Backup Strategy for InnoBackupEx """
"""Implementation of Backup Strategy for InnoBackupEx """
__strategy_name__ = 'innobackupex'
@property

View File

@ -78,7 +78,7 @@ class RestoreError(Exception):
class RestoreRunner(Strategy):
""" Base class for Restore Strategy implementations """
"""Base class for Restore Strategy implementations """
"""Restore a database from a previous backup."""
__strategy_type__ = 'restore_runner'

View File

@ -23,7 +23,7 @@ LOG = logging.getLogger(__name__)
class MySQLDump(base.RestoreRunner):
""" Implementation of Restore Strategy for MySQLDump """
"""Implementation of Restore Strategy for MySQLDump """
__strategy_name__ = 'mysqldump'
base_restore_cmd = ('mysql '
'--password=%(password)s '
@ -37,7 +37,7 @@ class MySQLDump(base.RestoreRunner):
class InnoBackupEx(base.RestoreRunner):
""" Implementation of Restore Strategy for InnoBackupEx """
"""Implementation of Restore Strategy for InnoBackupEx """
__strategy_name__ = 'innobackupex'
base_restore_cmd = 'sudo xbstream -x -C %(restore_location)s'
base_prepare_cmd = ('sudo innobackupex --apply-log %(restore_location)s'

View File

@ -23,7 +23,7 @@ LOG = logging.getLogger(__name__)
class Storage(Strategy):
""" Base class for Storage Strategy implementation """
"""Base class for Storage Strategy implementation """
__strategy_type__ = 'storage'
__strategy_ns__ = 'trove.guestagent.strategies.storage'
@ -32,8 +32,8 @@ class Storage(Strategy):
@abc.abstractmethod
def save(self, save_location, stream):
""" Persist information from the stream """
"""Persist information from the stream """
@abc.abstractmethod
def load(self, context, location, is_zipped, backup_checksum):
""" Load a stream from a persisted storage location """
"""Load a stream from a persisted storage location """

View File

@ -36,7 +36,7 @@ class SwiftDownloadIntegrityError(Exception):
class SwiftStorage(base.Storage):
""" Implementation of Storage Strategy for Swift """
"""Implementation of Storage Strategy for Swift """
__strategy_name__ = 'swift'
def __init__(self, context):
@ -44,7 +44,7 @@ class SwiftStorage(base.Storage):
self.connection = create_swift_client(context)
def save(self, save_location, stream):
""" Persist information from the stream """
"""Persist information from the stream """
# Create the container (save_location) if it doesn't already exist
self.connection.put_container(save_location)
@ -113,7 +113,7 @@ class SwiftStorage(base.Storage):
return storage_url, container, filename
def load(self, context, location, is_zipped, backup_checksum):
""" Restore a backup from the input stream to the restore_location """
"""Restore a backup from the input stream to the restore_location """
storage_url, container, filename = self._explodeLocation(location)
@ -127,7 +127,7 @@ class SwiftStorage(base.Storage):
class SwiftDownloadStream(object):
""" Class to do the actual swift download using the swiftclient """
"""Class to do the actual swift download using the swiftclient """
cmd = ("swift --os-auth-token=%(auth_token)s "
"--os-storage-url=%(storage_url)s "

View File

@ -36,7 +36,7 @@ class VolumeDevice(object):
self.device_path = device_path
def migrate_data(self, mysql_base):
""" Synchronize the data from the mysql directory to the new volume """
"""Synchronize the data from the mysql directory to the new volume """
# Use sudo to have access to this spot.
utils.execute("sudo", "mkdir", "-p", TMP_MOUNT_POINT)
self._tmp_mount(TMP_MOUNT_POINT)

View File

@ -322,7 +322,7 @@ QUOTAS.register_resources(resources)
def run_with_quotas(tenant_id, deltas, f):
""" Quota wrapper """
"""Quota wrapper """
reservations = QUOTAS.reserve(tenant_id, **deltas)
result = None

View File

@ -834,7 +834,7 @@ class TestAfterInstanceCreatedGuestData(object):
@test(depends_on_classes=[WaitForGuestInstallationToFinish],
groups=[GROUP, GROUP_START, GROUP_START_SIMPLE, "dbaas.listing"])
class TestInstanceListing(object):
""" Test the listing of the instance information """
"""Test the listing of the instance information """
@before_class
def setUp(self):
@ -994,7 +994,7 @@ class TestCreateNotification(object):
@test(depends_on_groups=['dbaas.api.instances.actions'],
groups=[GROUP, tests.INSTANCES, "dbaas.diagnostics"])
class CheckDiagnosticsAfterTests(object):
""" Check the diagnostics after running api commands on an instance. """
"""Check the diagnostics after running api commands on an instance. """
@test
def test_check_diagnostics_on_instance_after_tests(self):
diagnostics = dbaas_admin.diagnostics.get(instance_info.id)
@ -1010,7 +1010,7 @@ class CheckDiagnosticsAfterTests(object):
runs_after_groups=[GROUP_START,
GROUP_START_SIMPLE, GROUP_TEST, tests.INSTANCES])
class DeleteInstance(object):
""" Delete the created instance """
"""Delete the created instance """
@time_out(3 * 60)
@test

View File

@ -581,7 +581,7 @@ def resize_should_not_delete_users():
groups=[GROUP, tests.INSTANCES],
enabled=VOLUME_SUPPORT)
class ResizeInstanceVolume(ActionTestBase):
""" Resize the volume of the instance """
"""Resize the volume of the instance """
@before_class
def setUp(self):

View File

@ -36,23 +36,23 @@ class TestAdminRequired(object):
@before_class
def setUp(self):
""" Create the user and client for use in the subsequent tests."""
"""Create the user and client for use in the subsequent tests."""
self.user = test_config.users.find_user(Requirements(is_admin=False))
self.dbaas = create_dbaas_client(self.user)
@test
def test_accounts_show(self):
""" A regular user may not view the details of any account. """
"""A regular user may not view the details of any account. """
assert_raises(Unauthorized, self.dbaas.accounts.show, 0)
@test
def test_hosts_index(self):
""" A regular user may not view the list of hosts. """
"""A regular user may not view the list of hosts. """
assert_raises(Unauthorized, self.dbaas.hosts.index)
@test
def test_hosts_get(self):
""" A regular user may not view the details of any host. """
"""A regular user may not view the details of any host. """
assert_raises(Unauthorized, self.dbaas.hosts.get, 0)
@test
@ -74,25 +74,25 @@ class TestAdminRequired(object):
@test
def test_mgmt_instance_reboot(self):
""" A regular user may not perform an instance reboot. """
"""A regular user may not perform an instance reboot. """
assert_raises(Unauthorized, self.dbaas.management.reboot, 0)
@test
def test_mgmt_instance_reset_task_status(self):
""" A regular user may not perform an instance task status reset. """
"""A regular user may not perform an instance task status reset. """
assert_raises(Unauthorized, self.dbaas.management.reset_task_status, 0)
@test
def test_storage_index(self):
""" A regular user may not view the list of storage available. """
"""A regular user may not view the list of storage available. """
assert_raises(Unauthorized, self.dbaas.storage.index)
@test
def test_diagnostics_get(self):
""" A regular user may not view the diagnostics. """
"""A regular user may not view the diagnostics. """
assert_raises(Unauthorized, self.dbaas.diagnostics.get, 0)
@test
def test_hwinfo_get(self):
""" A regular user may not view the hardware info. """
"""A regular user may not view the hardware info. """
assert_raises(Unauthorized, self.dbaas.hwinfo.get, 0)

View File

@ -39,7 +39,7 @@ GROUP = "dbaas.api.mgmt.instances"
@test(groups=[GROUP])
def mgmt_index_requires_admin_account():
""" Verify that an admin context is required to call this function. """
"""Verify that an admin context is required to call this function. """
client = create_client(is_admin=False)
assert_raises(exceptions.Unauthorized, client.management.index)
@ -71,7 +71,7 @@ def volume_check(volume):
@test(depends_on_groups=[GROUP_START], groups=[GROUP, GROUP_TEST])
def mgmt_instance_get():
""" Tests the mgmt instances index method. """
"""Tests the mgmt instances index method. """
reqs = Requirements(is_admin=True)
user = CONFIG.users.find_user(reqs)
client = create_dbaas_client(user)
@ -198,7 +198,7 @@ class WhenMgmtInstanceGetIsCalledButServerIsNotReady(object):
@test(depends_on_classes=[CreateInstance], groups=[GROUP])
class MgmtInstancesIndex(object):
""" Tests the mgmt instances index method. """
"""Tests the mgmt instances index method. """
@before_class
def setUp(self):

View File

@ -52,7 +52,7 @@ class UserAccessBase(object):
"databases": []} for name in usernames]
def _grant_access_singular(self, user, databases, expected_response=202):
""" Grant a single user access to the databases listed.
"""Grant a single user access to the databases listed.
Potentially, expect an exception in the process."""
try:
self.dbaas.users.grant(instance_info.id, user, databases)
@ -66,13 +66,13 @@ class UserAccessBase(object):
assert_equal(expected_response, self.dbaas.last_http_code)
def _grant_access_plural(self, users, databases, expected_response=202):
""" Grant each user in the list access to all the databases listed.
"""Grant each user in the list access to all the databases listed.
Potentially, expect an exception in the process."""
for user in users:
self._grant_access_singular(user, databases, expected_response)
def _revoke_access_singular(self, user, database, expected_response=202):
""" Revoke from a user access to the given database .
"""Revoke from a user access to the given database .
Potentially, expect an exception in the process."""
try:
self.dbaas.users.revoke(instance_info.id, user, database)
@ -83,7 +83,7 @@ class UserAccessBase(object):
assert_equal(404, self.dbaas.last_http_code)
def _revoke_access_plural(self, users, databases, expected_response=202):
""" Revoke from each user access to each database.
"""Revoke from each user access to each database.
Potentially, expect an exception in the process."""
for user in users:
for database in databases:
@ -92,7 +92,7 @@ class UserAccessBase(object):
expected_response)
def _test_access(self, users, databases, expected_response=200):
""" Verify that each user in the list has access to each database in
"""Verify that each user in the list has access to each database in
the list."""
for user in users:
access = self.dbaas.users.list_access(instance_info.id, user)