Skip to content

Commit 016a0b3

Browse files
committed
Fix flake8 errors in anticipation of flake8 patch.
Change-Id: Ifdc4322b699f2bd91a6900e55695acd3d736568e
1 parent d6c7602 commit 016a0b3

13 files changed

Lines changed: 28 additions & 22 deletions

File tree

‎openstackclient/common/command.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515

1616
"""OpenStack base command"""
1717

18-
from cliff.command import Command
18+
from cliff import command
1919

2020

21-
class OpenStackCommand(Command):
21+
class OpenStackCommand(command.Command):
2222
"""Base class for OpenStack commands."""
2323
api = None
2424

‎openstackclient/common/utils.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def find_resource(manager, name_or_id):
5555
except Exception as ex:
5656
try:
5757
return manager.find(display_name=name_or_id)
58-
except:
58+
except Exception:
5959
pass
6060

6161
if type(ex).__name__ == 'NotFound':

‎openstackclient/compute/v2/server.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ def take_action(self, parsed_args):
528528

529529
_password = None
530530
if parsed_args.rebuild_password is not False:
531-
_password = args.rebuild_password
531+
_password = parsed_args.rebuild_password
532532

533533
kwargs = {}
534534
server = server.rebuild(image, _password, **kwargs)

‎openstackclient/identity/v2_0/service.py‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,10 @@ def take_action(self, parsed_args):
141141
# FIXME(dtroyer): This exception should eventually come from
142142
# common client exceptions
143143
except identity_exc.NotFound:
144-
msg = "No service with a type, name or ID of '%s' exists." % \
145-
name_or_id
144+
msg = "No service with exists."
145+
# TODO(mordred): Where does name_or_id come from?
146+
# msg = ("No service with a type, name or ID of '%s' exists." %
147+
# name_or_id)
146148
raise exceptions.CommandError(msg)
147149

148150
info = {}

‎openstackclient/identity/v2_0/tenant.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"""Tenant action implementations"""
1717

1818
import logging
19+
import sys
1920

2021
from cliff import command
2122
from cliff import lister
@@ -167,7 +168,7 @@ def take_action(self, parsed_args):
167168
kwargs['enabled'] = parsed_args.enabled
168169

169170
if kwargs == {}:
170-
stdout.write("Tenant not updated, no arguments present")
171+
sys.stdout.write("Tenant not updated, no arguments present")
171172
return 0
172173
tenant.update(**kwargs)
173174
return

‎openstackclient/identity/v2_0/user.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"""Identity v2.0 User action implementations"""
1717

1818
import logging
19+
import sys
1920

2021
from cliff import command
2122
from cliff import lister
@@ -196,7 +197,7 @@ def take_action(self, parsed_args):
196197
kwargs['enabled'] = parsed_args.enabled
197198

198199
if not len(kwargs):
199-
stdout.write("User not updated, no arguments present")
200+
sys.stdout.write("User not updated, no arguments present")
200201
return
201202
identity_client.users.update(user.id, **kwargs)
202203
return

‎openstackclient/identity/v3/group.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"""Group action implementations"""
1717

1818
import logging
19+
import sys
1920

2021
from cliff import command
2122
from cliff import lister
@@ -157,7 +158,7 @@ def take_action(self, parsed_args):
157158
kwargs['domain'] = domain
158159

159160
if not len(kwargs):
160-
stdout.write("Group not updated, no arguments present")
161+
sys.stdout.write("Group not updated, no arguments present")
161162
return
162163
identity_client.groups.update(group.id, **kwargs)
163164
return

‎openstackclient/identity/v3/project.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"""Project action implementations"""
1717

1818
import logging
19+
import sys
1920

2021
from cliff import command
2122
from cliff import lister
@@ -189,7 +190,7 @@ def take_action(self, parsed_args):
189190
kwargs['enabled'] = parsed_args.enabled
190191

191192
if kwargs == {}:
192-
stdout.write("Project not updated, no arguments present")
193+
sys.stdout.write("Project not updated, no arguments present")
193194
return
194195
project.update(**kwargs)
195196
return

‎openstackclient/identity/v3/user.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"""Identity v3 User action implementations"""
1717

1818
import logging
19+
import sys
1920

2021
from cliff import command
2122
from cliff import lister
@@ -215,7 +216,7 @@ def take_action(self, parsed_args):
215216
kwargs['enabled'] = parsed_args.enabled
216217

217218
if not len(kwargs):
218-
stdout.write("User not updated, no arguments present")
219+
sys.stdout.write("User not updated, no arguments present")
219220
return
220221
identity_client.users.update(user.id, **kwargs)
221222
return

‎openstackclient/shell.py‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@
2020
import os
2121
import sys
2222

23-
from cliff.app import App
24-
from cliff.help import HelpAction
23+
from cliff import app
24+
from cliff import help
2525

2626
from openstackclient.common import clientmanager
27+
from openstackclient.common.commandmanager import CommandManager
2728
from openstackclient.common import exceptions as exc
2829
from openstackclient.common import openstackkeyring
2930
from openstackclient.common import utils
30-
from openstackclient.common.commandmanager import CommandManager
3131

3232

3333
VERSION = '0.1'
@@ -53,7 +53,7 @@ def env(*vars, **kwargs):
5353
return kwargs.get('default', '')
5454

5555

56-
class OpenStackShell(App):
56+
class OpenStackShell(app.App):
5757

5858
CONSOLE_MESSAGE_FORMAT = '%(levelname)s: %(name)s %(message)s'
5959

@@ -75,10 +75,10 @@ def __init__(self):
7575
# have been loaded. There doesn't seem to be a
7676
# way to edit/remove anything from an existing parser.
7777

78-
# Replace the cliff-added HelpAction to defer its execution
78+
# Replace the cliff-added help.HelpAction to defer its execution
7979
self.DeferredHelpAction = None
8080
for a in self.parser._actions:
81-
if type(a) == HelpAction:
81+
if type(a) == help.HelpAction:
8282
# Found it, save and replace it
8383
self.DeferredHelpAction = a
8484

@@ -359,7 +359,7 @@ def clean_up(self, cmd, result, err):
359359
def main(argv=sys.argv[1:]):
360360
try:
361361
return OpenStackShell().run(argv)
362-
except:
362+
except Exception:
363363
return 1
364364

365365

0 commit comments

Comments
 (0)