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""" """OpenStack base command"""
from cliff.command import Command from cliff import command
class OpenStackCommand(Command): class OpenStackCommand(command.Command):
"""Base class for OpenStack commands.""" """Base class for OpenStack commands."""
api = None api = None

View File

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

View File

@@ -528,7 +528,7 @@ class RebuildServer(show.ShowOne):
_password = None _password = None
if parsed_args.rebuild_password is not False: if parsed_args.rebuild_password is not False:
_password = args.rebuild_password _password = parsed_args.rebuild_password
kwargs = {} kwargs = {}
server = server.rebuild(image, _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 # FIXME(dtroyer): This exception should eventually come from
# common client exceptions # common client exceptions
except identity_exc.NotFound: except identity_exc.NotFound:
msg = "No service with a type, name or ID of '%s' exists." % \ msg = "No service with exists."
name_or_id # 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) raise exceptions.CommandError(msg)
info = {} info = {}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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