From: Victor Rodionov Date: Tue, 27 Aug 2013 21:50:55 +0000 (+0400) Subject: Fix pep8 violation in backup X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=afd69a95bbebdb2cb5ff1e6df69c51cb90cc95f6;p=openstack-build%2Fcinder-build.git Fix pep8 violation in backup Change-Id: I0bbc7923c3bea9b918c243d2c7b59510fd26deb5 --- diff --git a/cinder/backup/api.py b/cinder/backup/api.py index 18dc57c2f..16c9c6dd4 100644 --- a/cinder/backup/api.py +++ b/cinder/backup/api.py @@ -37,12 +37,12 @@ LOG = logging.getLogger(__name__) def check_policy(context, action): - target = { - 'project_id': context.project_id, - 'user_id': context.user_id, - } - _action = 'backup:%s' % action - cinder.policy.enforce(context, _action, target) + target = { + 'project_id': context.project_id, + 'user_id': context.user_id, + } + _action = 'backup:%s' % action + cinder.policy.enforce(context, _action, target) class API(base.Base): @@ -59,9 +59,7 @@ class API(base.Base): return dict(rv.iteritems()) def delete(self, context, backup_id): - """ - Make the RPC call to delete a volume backup. - """ + """Make the RPC call to delete a volume backup.""" check_policy(context, 'delete') backup = self.get(context, backup_id) if backup['status'] not in ['available', 'error']: @@ -74,7 +72,9 @@ class API(base.Base): backup['id']) # TODO(moorehef): Add support for search_opts, discarded atm - def get_all(self, context, search_opts={}): + def get_all(self, context, search_opts=None): + if search_opts is None: + search_opts = {} check_policy(context, 'get_all') if context.is_admin: backups = self.db.backup_get_all(context) @@ -85,9 +85,7 @@ class API(base.Base): return backups def _check_backup_service(self, volume): - """ - Check if there is an backup service available - """ + """Check if there is an backup service available""" topic = CONF.backup_topic ctxt = context.get_admin_context() services = self.db.service_get_all_by_topic(ctxt, topic) @@ -100,9 +98,7 @@ class API(base.Base): def create(self, context, name, description, volume_id, container, availability_zone=None): - """ - Make the RPC call to create a volume backup. - """ + """Make the RPC call to create a volume backup.""" check_policy(context, 'create') volume = self.volume_api.get(context, volume_id) if volume['status'] != "available": @@ -137,9 +133,7 @@ class API(base.Base): return backup def restore(self, context, backup_id, volume_id=None): - """ - Make the RPC call to restore a volume backup. - """ + """Make the RPC call to restore a volume backup.""" check_policy(context, 'restore') backup = self.get(context, backup_id) if backup['status'] != 'available': diff --git a/cinder/backup/driver.py b/cinder/backup/driver.py index c158954d0..59525d07e 100644 --- a/cinder/backup/driver.py +++ b/cinder/backup/driver.py @@ -12,7 +12,7 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. -# + """Base class for all backup drivers.""" from cinder.db import base diff --git a/cinder/backup/manager.py b/cinder/backup/manager.py index b4eba2eac..5ff6c44b0 100644 --- a/cinder/backup/manager.py +++ b/cinder/backup/manager.py @@ -132,9 +132,7 @@ class BackupManager(manager.SchedulerDependentManager): self.delete_backup(ctxt, backup['id']) def create_backup(self, context, backup_id): - """ - Create volume backups using configured backup service. - """ + """Create volume backups using configured backup service.""" backup = self.db.backup_get(context, backup_id) volume_id = backup['volume_id'] volume = self.db.volume_get(context, volume_id) @@ -189,9 +187,7 @@ class BackupManager(manager.SchedulerDependentManager): LOG.info(_('create_backup finished. backup: %s'), backup_id) def restore_backup(self, context, backup_id, volume_id): - """ - Restore volume backups from configured backup service. - """ + """Restore volume backups from configured backup service.""" LOG.info(_('restore_backup started, restoring backup: %(backup_id)s' ' to volume: %(volume_id)s') % {'backup_id': backup_id, 'volume_id': volume_id}) @@ -261,9 +257,7 @@ class BackupManager(manager.SchedulerDependentManager): {'backup_id': backup_id, 'volume_id': volume_id}) def delete_backup(self, context, backup_id): - """ - Delete volume backup from configured backup service. - """ + """Delete volume backup from configured backup service.""" backup = self.db.backup_get(context, backup_id) LOG.info(_('delete_backup started, backup: %s'), backup_id) self.db.backup_update(context, backup_id, {'host': self.host}) diff --git a/cinder/backup/rpcapi.py b/cinder/backup/rpcapi.py index cc6c2493f..62a8ccb96 100644 --- a/cinder/backup/rpcapi.py +++ b/cinder/backup/rpcapi.py @@ -33,12 +33,12 @@ LOG = logging.getLogger(__name__) class BackupAPI(cinder.openstack.common.rpc.proxy.RpcProxy): - '''Client side of the volume rpc API. + """Client side of the volume rpc API. API version history: 1.0 - Initial version. - ''' + """ BASE_RPC_API_VERSION = '1.0'