From 41c37d3666c4d46aaf3daa9bb4236e7cdcf3af57 Mon Sep 17 00:00:00 2001 From: Dan Prince Date: Thu, 15 Nov 2012 11:26:31 -0500 Subject: [PATCH] Various pep8/HACKING fixes for Cinder. Fix some ordering/pep8/hacking issues in preperation for re-enabling full pep8/HACKING checks in tox. Change-Id: I7151ac73d1ace5d98046580e6d1c6a1dcc6c4cef --- bin/cinder-clear-rabbit-queues | 2 +- bin/cinder-manage | 4 ++-- cinder/db/sqlalchemy/migration.py | 2 +- cinder/utils.py | 4 ++-- cinder/volume/san/san.py | 8 ++++---- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/bin/cinder-clear-rabbit-queues b/bin/cinder-clear-rabbit-queues index c39081458..e61da9a73 100755 --- a/bin/cinder-clear-rabbit-queues +++ b/bin/cinder-clear-rabbit-queues @@ -43,8 +43,8 @@ gettext.install('cinder', unicode=1) from cinder import context from cinder import exception from cinder import flags -from cinder.openstack.common import log as logging from cinder.openstack.common import cfg +from cinder.openstack.common import log as logging from cinder.openstack.common import rpc diff --git a/bin/cinder-manage b/bin/cinder-manage index 9d1321742..fb4b46a83 100755 --- a/bin/cinder-manage +++ b/bin/cinder-manage @@ -60,8 +60,8 @@ import os import sys from sqlalchemy import create_engine, MetaData, Table -from sqlalchemy.orm import sessionmaker from sqlalchemy.ext.declarative import declarative_base +from sqlalchemy.orm import sessionmaker # If ../cinder/__init__.py exists, add ../ to Python search path, so that @@ -79,8 +79,8 @@ from cinder import db from cinder.db import migration from cinder import exception from cinder import flags -from cinder.openstack.common import log as logging from cinder.openstack.common import cfg +from cinder.openstack.common import log as logging from cinder.openstack.common import rpc from cinder import utils from cinder import version diff --git a/cinder/db/sqlalchemy/migration.py b/cinder/db/sqlalchemy/migration.py index b694682e8..5365d9cdc 100644 --- a/cinder/db/sqlalchemy/migration.py +++ b/cinder/db/sqlalchemy/migration.py @@ -26,9 +26,9 @@ from cinder import flags from cinder.openstack.common import log as logging -import sqlalchemy import migrate from migrate.versioning import util as migrate_util +import sqlalchemy LOG = logging.getLogger(__name__) diff --git a/cinder/utils.py b/cinder/utils.py index df2894d5e..19f7354f1 100644 --- a/cinder/utils.py +++ b/cinder/utils.py @@ -317,8 +317,8 @@ class SSHPool(pools.Pool): transport.set_keepalive(self.conn_timeout) return ssh except Exception as e: - msg = "Error connecting via ssh: %s" % e - LOG.error(_(msg)) + msg = _("Error connecting via ssh: %s") % e + LOG.error(msg) raise paramiko.SSHException(msg) def get(self): diff --git a/cinder/volume/san/san.py b/cinder/volume/san/san.py index c38a98cef..dc2076ef7 100644 --- a/cinder/volume/san/san.py +++ b/cinder/volume/san/san.py @@ -122,11 +122,11 @@ class SanISCSIDriver(ISCSIDriver): except Exception as e: LOG.error(e) greenthread.sleep(random.randint(20, 500) / 100.0) - raise paramiko.SSHException(_("SSH Command failed after '%r' " - "attempts: '%s'" - % (total_attempts, command))) + raise paramiko.SSHException(_("SSH Command failed after " + "'%(total_attempts)r' attempts" + ": '%(command)s'"), locals()) except Exception as e: - LOG.error(_("Error running ssh command: %s" % command)) + LOG.error(_("Error running ssh command: %s") % command) raise e def ensure_export(self, context, volume): -- 2.45.2