Fix flake8 errors in anticipation of flake8 patch.

Change-Id: Ifdc4322b699f2bd91a6900e55695acd3d736568e
This commit is contained in:
Monty Taylor 2013-05-14 08:28:48 -07:00
parent d6c760263b
commit 016a0b301e
13 changed files with 28 additions and 22 deletions

View File

@ -15,10 +15,10 @@
"""OpenStack base command"""
from cliff.command import Command
from cliff import command
class OpenStackCommand(Command):
class OpenStackCommand(command.Command):
"""Base class for OpenStack commands."""
api = None

View File

@ -55,7 +55,7 @@ def find_resource(manager, name_or_id):
except Exception as ex:
try:
return manager.find(display_name=name_or_id)
except:
except Exception:
pass
if type(ex).__name__ == 'NotFound':

View File

@ -528,7 +528,7 @@ class RebuildServer(show.ShowOne):
_password = None
if parsed_args.rebuild_password is not False:
_password = args.rebuild_password
_password = parsed_args.rebuild_password
kwargs = {}
server = server.rebuild(image, _password, **kwargs)

View File

@ -141,8 +141,10 @@ class ShowService(show.ShowOne):
# FIXME(dtroyer): This exception should eventually come from
# common client exceptions
except identity_exc.NotFound:
msg = "No service with a type, name or ID of '%s' exists." % \
name_or_id
msg = "No service with exists."
# TODO(mordred): Where does name_or_id come from?
# msg = ("No service with a type, name or ID of '%s' exists." %
# name_or_id)
raise exceptions.CommandError(msg)
info = {}

View File

@ -16,6 +16,7 @@
"""Tenant action implementations"""
import logging
import sys
from cliff import command
from cliff import lister
@ -167,7 +168,7 @@ class SetTenant(command.Command):
kwargs['enabled'] = parsed_args.enabled
if kwargs == {}:
stdout.write("Tenant not updated, no arguments present")
sys.stdout.write("Tenant not updated, no arguments present")
return 0
tenant.update(**kwargs)
return

View File

@ -16,6 +16,7 @@
"""Identity v2.0 User action implementations"""
import logging
import sys
from cliff import command
from cliff import lister
@ -196,7 +197,7 @@ class SetUser(command.Command):
kwargs['enabled'] = parsed_args.enabled
if not len(kwargs):
stdout.write("User not updated, no arguments present")
sys.stdout.write("User not updated, no arguments present")
return
identity_client.users.update(user.id, **kwargs)
return

View File

@ -16,6 +16,7 @@
"""Group action implementations"""
import logging
import sys
from cliff import command
from cliff import lister
@ -157,7 +158,7 @@ class SetGroup(command.Command):
kwargs['domain'] = domain
if not len(kwargs):
stdout.write("Group not updated, no arguments present")
sys.stdout.write("Group not updated, no arguments present")
return
identity_client.groups.update(group.id, **kwargs)
return

View File

@ -16,6 +16,7 @@
"""Project action implementations"""
import logging
import sys
from cliff import command
from cliff import lister
@ -189,7 +190,7 @@ class SetProject(command.Command):
kwargs['enabled'] = parsed_args.enabled
if kwargs == {}:
stdout.write("Project not updated, no arguments present")
sys.stdout.write("Project not updated, no arguments present")
return
project.update(**kwargs)
return

View File

@ -16,6 +16,7 @@
"""Identity v3 User action implementations"""
import logging
import sys
from cliff import command
from cliff import lister
@ -215,7 +216,7 @@ class SetUser(command.Command):
kwargs['enabled'] = parsed_args.enabled
if not len(kwargs):
stdout.write("User not updated, no arguments present")
sys.stdout.write("User not updated, no arguments present")
return
identity_client.users.update(user.id, **kwargs)
return

View File

@ -20,14 +20,14 @@ import logging
import os
import sys
from cliff.app import App
from cliff.help import HelpAction
from cliff import app
from cliff import help
from openstackclient.common import clientmanager
from openstackclient.common.commandmanager import CommandManager
from openstackclient.common import exceptions as exc
from openstackclient.common import openstackkeyring
from openstackclient.common import utils
from openstackclient.common.commandmanager import CommandManager
VERSION = '0.1'
@ -53,7 +53,7 @@ def env(*vars, **kwargs):
return kwargs.get('default', '')
class OpenStackShell(App):
class OpenStackShell(app.App):
CONSOLE_MESSAGE_FORMAT = '%(levelname)s: %(name)s %(message)s'
@ -75,10 +75,10 @@ class OpenStackShell(App):
# have been loaded. There doesn't seem to be a
# way to edit/remove anything from an existing parser.
# Replace the cliff-added HelpAction to defer its execution
# Replace the cliff-added help.HelpAction to defer its execution
self.DeferredHelpAction = None
for a in self.parser._actions:
if type(a) == HelpAction:
if type(a) == help.HelpAction:
# Found it, save and replace it
self.DeferredHelpAction = a
@ -359,7 +359,7 @@ class OpenStackShell(App):
def main(argv=sys.argv[1:]):
try:
return OpenStackShell().run(argv)
except:
except Exception:
return 1

View File

@ -16,6 +16,7 @@
"""Volume v1 Quota action implementations"""
import logging
import sys
from cliff import command
from cliff import show
@ -79,7 +80,7 @@ class SetQuota(command.Command):
kwargs['gigabytes'] = parsed_args.gigabytes
if kwargs == {}:
stdout.write("Quota not updated, no arguments present")
sys.stdout.write("Quota not updated, no arguments present")
return
volume_client = self.app.client_manager.volume

View File

@ -13,8 +13,6 @@
# under the License.
#
import mock
from openstackclient.common import clientmanager
from openstackclient.identity import client as identity_client
from tests import utils

View File

@ -13,8 +13,8 @@
# under the License.
#
import os
import mock
import os
from openstackclient import shell
from tests import utils