From f6014dd8c530e121ae96a53ae6664bc24eb85781 Mon Sep 17 00:00:00 2001 From: Josh Kearney Date: Mon, 2 Apr 2012 12:27:30 -0500 Subject: [PATCH] Miscellaneous code cleanup. Change-Id: I6028247466378327f03b71dc2063dd2777b9382a --- novaclient/base.py | 3 +-- novaclient/client.py | 4 ++-- novaclient/v1_1/__init__.py | 16 ++++++++++++++++ novaclient/v1_1/floating_ip_pools.py | 2 -- novaclient/v1_1/shell.py | 6 ++---- 5 files changed, 21 insertions(+), 10 deletions(-) diff --git a/novaclient/base.py b/novaclient/base.py index ec78aa6a0..9ff3b569e 100644 --- a/novaclient/base.py +++ b/novaclient/base.py @@ -20,7 +20,6 @@ Base utilities to build API operation managers and objects on top of. """ import contextlib -import errno import hashlib import os from novaclient import exceptions @@ -113,7 +112,7 @@ class Manager(utils.HookableMixin): try: os.makedirs(cache_dir, 0755) - except OSError as e: + except OSError: # NOTE(kiall): This is typicaly either permission denied while # attempting to create the directory, or the directory # already exists. Either way, don't fail. diff --git a/novaclient/client.py b/novaclient/client.py index f3e56f405..ea470e61d 100644 --- a/novaclient/client.py +++ b/novaclient/client.py @@ -98,7 +98,7 @@ class HTTPClient(httplib2.Http): if body: try: body = json.loads(body) - except ValueError, e: + except ValueError: pass else: body = None @@ -166,7 +166,7 @@ class HTTPClient(httplib2.Http): service_name=self.service_name) self.management_url = management_url.rstrip('/') return None - except exceptions.AmbiguousEndpoints, exc: + except exceptions.AmbiguousEndpoints: print "Found more than one valid endpoint. Use a more " \ "restrictive filter" raise diff --git a/novaclient/v1_1/__init__.py b/novaclient/v1_1/__init__.py index 145edc77e..c8538c1e2 100644 --- a/novaclient/v1_1/__init__.py +++ b/novaclient/v1_1/__init__.py @@ -1 +1,17 @@ +# Copyright (c) 2012 OpenStack, LLC. +# +# All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + from novaclient.v1_1.client import Client diff --git a/novaclient/v1_1/floating_ip_pools.py b/novaclient/v1_1/floating_ip_pools.py index c6b678a17..7666bd57f 100644 --- a/novaclient/v1_1/floating_ip_pools.py +++ b/novaclient/v1_1/floating_ip_pools.py @@ -14,8 +14,6 @@ # License for the specific language governing permissions and limitations # under the License. -import urllib - from novaclient import base diff --git a/novaclient/v1_1/shell.py b/novaclient/v1_1/shell.py index ee19e2b9a..3ed46bd60 100644 --- a/novaclient/v1_1/shell.py +++ b/novaclient/v1_1/shell.py @@ -1134,12 +1134,10 @@ def do_dns_list(cs, args): @utils.arg('ip', metavar='', help='ip address') @utils.arg('name', metavar='', help='DNS name') @utils.arg('domain', metavar='', help='DNS domain') -@utils.arg('--type', metavar='', help='dns type (e.g. "A")', - default='A') +@utils.arg('--type', metavar='', help='dns type (e.g. "A")', default='A') def do_dns_create(cs, args): """Create a DNS entry for domain, name and ip.""" - entries = cs.dns_entries.create(args.domain, args.name, - args.ip, args.type) + cs.dns_entries.create(args.domain, args.name, args.ip, args.type) @utils.arg('domain', metavar='', help='DNS domain')