Fixed all remaining pep8 failures in the codebase
Change-Id: I0de312a587ecd83158da4c7e05ca6495c7a981a8 Partially-Implements: blueprint enable-flake8
This commit is contained in:
parent
adc8bc11df
commit
5a758fc6d1
@ -14,9 +14,10 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
# This file exists because we want to create and delete any network namespaces from the
|
# This file exists because we want to create and delete any network
|
||||||
# host mount namespace. This allows the host to access all of the neutron network
|
# namespaces from the host mount namespace. This allows the host to
|
||||||
# namespaces as well as all containers that bind mount /run/netns from the host.
|
# access all of the neutron network namespaces as well as all
|
||||||
|
# containers that bind mount /run/netns from the host.
|
||||||
|
|
||||||
# This is required for "thin" neutron containers to function properly
|
# This is required for "thin" neutron containers to function properly
|
||||||
|
|
||||||
@ -24,24 +25,32 @@ import sys
|
|||||||
import subprocess
|
import subprocess
|
||||||
import nsenter
|
import nsenter
|
||||||
|
|
||||||
|
|
||||||
def host_mnt_exec(cmd):
|
def host_mnt_exec(cmd):
|
||||||
try:
|
try:
|
||||||
with nsenter.ExitStack() as stack:
|
with nsenter.ExitStack() as stack:
|
||||||
stack.enter_context(nsenter.Namespace('1', 'mnt', proc='/opt/kolla/host_proc/'))
|
stack.enter_context(
|
||||||
|
nsenter.Namespace(
|
||||||
|
'1',
|
||||||
|
'mnt',
|
||||||
|
proc='/opt/kolla/host_proc/'))
|
||||||
process_ = subprocess.Popen(cmd)
|
process_ = subprocess.Popen(cmd)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("An error has occured with a component that Kolla manages. Please file a bug")
|
print(
|
||||||
|
"An error has occured with a component that Kolla manages."
|
||||||
|
" Please file a bug")
|
||||||
print("Error: ", e)
|
print("Error: ", e)
|
||||||
|
|
||||||
return process_
|
return process_
|
||||||
|
|
||||||
|
|
||||||
if len(sys.argv) > 2:
|
if len(sys.argv) > 2:
|
||||||
# We catch all commands that ip will accept that refer to creating or deleteing a
|
# We catch all commands that ip will accept that refer
|
||||||
# Network namespace
|
# to creating or deleteing a Network namespace
|
||||||
if str(sys.argv[1]).startswith("net") and \
|
if str(sys.argv[1]).startswith("net") and (
|
||||||
(str(sys.argv[2]).startswith("a") or str(sys.argv[2]).startswith("d")):
|
str(sys.argv[2]).startswith("a") or
|
||||||
|
str(sys.argv[2]).startswith("d")):
|
||||||
# This cmd is executed in the host mount namespace
|
# This cmd is executed in the host mount namespace
|
||||||
cmd = ["/usr/bin/env", "ip"] + sys.argv[1:]
|
cmd = ["/usr/bin/env", "ip"] + sys.argv[1:]
|
||||||
sys.exit(host_mnt_exec(cmd).returncode)
|
sys.exit(host_mnt_exec(cmd).returncode)
|
||||||
|
@ -6,7 +6,6 @@ docker/kubernetes environment variables.'''
|
|||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import os
|
import os
|
||||||
import sys
|
|
||||||
from jinja2 import Environment, FileSystemLoader
|
from jinja2 import Environment, FileSystemLoader
|
||||||
import re
|
import re
|
||||||
import urlparse
|
import urlparse
|
||||||
@ -14,6 +13,7 @@ import urlparse
|
|||||||
re_url = re.compile(
|
re_url = re.compile(
|
||||||
'^(?P<name>.*)_PORT_(?P<port>\d+)_(?P<proto>(UDP|TCP))$')
|
'^(?P<name>.*)_PORT_(?P<port>\d+)_(?P<proto>(UDP|TCP))$')
|
||||||
|
|
||||||
|
|
||||||
def parse_args():
|
def parse_args():
|
||||||
p = argparse.ArgumentParser()
|
p = argparse.ArgumentParser()
|
||||||
p.add_argument('--output', '-o',
|
p.add_argument('--output', '-o',
|
||||||
@ -24,6 +24,7 @@ def parse_args():
|
|||||||
default='/etc/haproxy/templates')
|
default='/etc/haproxy/templates')
|
||||||
return p.parse_args()
|
return p.parse_args()
|
||||||
|
|
||||||
|
|
||||||
def discover_services():
|
def discover_services():
|
||||||
services = []
|
services = []
|
||||||
for k in os.environ:
|
for k in os.environ:
|
||||||
@ -31,7 +32,7 @@ def discover_services():
|
|||||||
|
|
||||||
if mo:
|
if mo:
|
||||||
parts = urlparse.urlparse(os.environ[k])
|
parts = urlparse.urlparse(os.environ[k])
|
||||||
remote_host,remote_port = parts.netloc.split(':')
|
remote_host, remote_port = parts.netloc.split(':')
|
||||||
service_name = '%(name)s-%(port)s' % mo.groupdict()
|
service_name = '%(name)s-%(port)s' % mo.groupdict()
|
||||||
|
|
||||||
services.append({
|
services.append({
|
||||||
@ -45,6 +46,7 @@ def discover_services():
|
|||||||
|
|
||||||
return services
|
return services
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
args = parse_args()
|
args = parse_args()
|
||||||
services = discover_services()
|
services = discover_services()
|
||||||
@ -62,4 +64,3 @@ def main():
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@ from keystoneclient.v2_0 import client as ksclient
|
|||||||
logging.basicConfig(level=logging.WARNING)
|
logging.basicConfig(level=logging.WARNING)
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class OpenStackClients(object):
|
class OpenStackClients(object):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
@ -18,11 +18,13 @@ from subprocess import Popen, PIPE, STDOUT
|
|||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class ImagesTest(base.BaseTestCase):
|
class ImagesTest(base.BaseTestCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(ImagesTest, self).setUp()
|
super(ImagesTest, self).setUp()
|
||||||
self.useFixture(log_fixture.SetLogLevel([__name__],
|
self.useFixture(log_fixture.SetLogLevel([__name__],
|
||||||
logging.logging.INFO))
|
logging.logging.INFO))
|
||||||
|
|
||||||
def test_builds(self):
|
def test_builds(self):
|
||||||
proc = Popen(['tools/build-all-docker-images',
|
proc = Popen(['tools/build-all-docker-images',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user