From 30a1988f0aba4749ce03107f14f34b1602c64a35 Mon Sep 17 00:00:00 2001 From: Borne Mace Date: Fri, 10 Jul 2015 12:01:28 -0700 Subject: [PATCH] Fixed additional OpenStack pep8 issues The "hacking" package used in most OpenStack repos pulls in additional pep8 rules. This commit should fix all of them other than a hand full in the build.py file which will be fixed in a separate commit Change-Id: I40a0a30d338592ad64123e3da5523b9ad95a7a9c Partially-Implements: blueprint enable-flake8 --- .../binary/neutron/neutron-base/ip_wrapper.py | 4 ++-- docker/common/hautoproxy/start.py | 15 ++++++++++++++- tests/clients.py | 6 +++--- tests/test_images.py | 4 +++- tests/test_keystone.py | 2 +- tools/validate-json.py | 14 +++++++++++++- tools/validate-yaml.py | 16 ++++++++++++++-- 7 files changed, 50 insertions(+), 11 deletions(-) diff --git a/docker/centos/binary/neutron/neutron-base/ip_wrapper.py b/docker/centos/binary/neutron/neutron-base/ip_wrapper.py index 94d54d4e0f..591fca6f4b 100755 --- a/docker/centos/binary/neutron/neutron-base/ip_wrapper.py +++ b/docker/centos/binary/neutron/neutron-base/ip_wrapper.py @@ -21,9 +21,9 @@ # This is required for "thin" neutron containers to function properly -import sys -import subprocess import nsenter +import subprocess +import sys def host_mnt_exec(cmd): diff --git a/docker/common/hautoproxy/start.py b/docker/common/hautoproxy/start.py index bbdd876b51..914a2ffac9 100755 --- a/docker/common/hautoproxy/start.py +++ b/docker/common/hautoproxy/start.py @@ -1,12 +1,25 @@ #!/usr/bin/python +# 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. + '''This script configures and starts a local haproxy instances, bound to 127.0.0.1, that forwards connections all of the discovered docker/kubernetes environment variables.''' import argparse +from jinja2 import Environment +from jinja2 import FileSystemLoader import os -from jinja2 import Environment, FileSystemLoader import re import urlparse diff --git a/tests/clients.py b/tests/clients.py index 9544e239b7..6b2aef5281 100644 --- a/tests/clients.py +++ b/tests/clients.py @@ -11,8 +11,8 @@ # under the License. -import logging from keystoneclient.v2_0 import client as ksclient +import logging logging.basicConfig(level=logging.WARNING) LOG = logging.getLogger(__name__) @@ -48,7 +48,7 @@ class KeystoneClient(OpenStackClients): def __init__(self): super(KeystoneClient, self).__init__() - # TODO: this shouldn't be hard coded + # TODO(Jeff Peeler): this shouldn't be hard coded self.creds = {'auth_url': 'http://10.0.0.4:5000/v2.0', 'username': 'admin', 'password': 'steakfordinner', @@ -61,7 +61,7 @@ class KeystoneClient(OpenStackClients): if __name__ == '__main__': - # TODO: mox this + # TODO(Jeff Peeler): mox this client_mgr = OpenStackClients() ks = client_mgr.get_client('KeystoneClient') LOG.info(ks) diff --git a/tests/test_images.py b/tests/test_images.py index e8ee41bc01..b336930e98 100644 --- a/tests/test_images.py +++ b/tests/test_images.py @@ -14,7 +14,9 @@ from oslo_log import fixture as log_fixture from oslo_log import log as logging from oslotest import base -from subprocess import Popen, PIPE, STDOUT +from subprocess import PIPE +from subprocess import Popen +from subprocess import STDOUT LOG = logging.getLogger(__name__) diff --git a/tests/test_keystone.py b/tests/test_keystone.py index 6c23a203c4..a3a850314c 100644 --- a/tests/test_keystone.py +++ b/tests/test_keystone.py @@ -10,8 +10,8 @@ # License for the specific language governing permissions and limitations # under the License. -import testtools from clients import OpenStackClients +import testtools class KeystoneTest(testtools.TestCase): diff --git a/tools/validate-json.py b/tools/validate-json.py index 1b0506ba16..eee2276dbc 100755 --- a/tools/validate-json.py +++ b/tools/validate-json.py @@ -1,9 +1,21 @@ #!/usr/bin/python -import sys +# 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. + import argparse import json import logging +import sys def parse_args(): diff --git a/tools/validate-yaml.py b/tools/validate-yaml.py index 66611b85c8..c4e4326d96 100755 --- a/tools/validate-yaml.py +++ b/tools/validate-yaml.py @@ -1,9 +1,21 @@ #!/usr/bin/python -import sys +# 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. + import argparse -import yaml import logging +import sys +import yaml def parse_args():