diff options
| author | Paul Bourke <paul.bourke@oracle.com> | 2015-07-16 15:20:42 +0000 |
|---|---|---|
| committer | Paul Bourke <paul.bourke@oracle.com> | 2015-07-16 15:20:42 +0000 |
| commit | 99730b62c80bb0b368e94eb557040faaf4a28ff5 (patch) | |
| tree | d1782c471ef6c8b582bdd88a1982be16d54a1dba /docker | |
| parent | 51b7915ae8094fe149ff1752be01d6ff29fed15e (diff) | |
| download | kolla-99730b62c80bb0b368e94eb557040faaf4a28ff5.tar.gz kolla-99730b62c80bb0b368e94eb557040faaf4a28ff5.zip | |
Add missing symlinks in neutron-base
Change-Id: I5fb6a35ade17ea89e306d3d00694b0f922a58e4a
Closes-Bug: #1475332
Diffstat (limited to 'docker')
| l---------[-rw-r--r--] | docker/centos/binary/neutron/neutron-base/config-sudoers.sh | 13 | ||||
| l---------[-rwxr-xr-x] | docker/centos/binary/neutron/neutron-base/ip_wrapper.py | 67 | ||||
| -rw-r--r-- | docker/common/neutron/neutron-base/config-sudoers.sh | 12 | ||||
| -rwxr-xr-x | docker/common/neutron/neutron-base/ip_wrapper.py | 66 |
4 files changed, 80 insertions, 78 deletions
diff --git a/docker/centos/binary/neutron/neutron-base/config-sudoers.sh b/docker/centos/binary/neutron/neutron-base/config-sudoers.sh index 0e02226db..08e65f4d7 100644..120000 --- a/docker/centos/binary/neutron/neutron-base/config-sudoers.sh +++ b/docker/centos/binary/neutron/neutron-base/config-sudoers.sh @@ -1,12 +1 @@ -#!/bin/bash - -# Neutron uses rootwrap which requires a tty for sudo. -# Since the container is running in daemon mode, a tty -# is not present and requiretty must be commented out. -if [ ! -f /var/run/sudo-modified ]; then - chmod 0640 /etc/sudoers - sed -i '/Defaults requiretty/s/^/#/' /etc/sudoers - chmod 0440 /etc/sudoers -fi - -touch /var/run/sudo-modified +../../../../common/neutron/neutron-base/config-sudoers.sh
\ No newline at end of file diff --git a/docker/centos/binary/neutron/neutron-base/ip_wrapper.py b/docker/centos/binary/neutron/neutron-base/ip_wrapper.py index 591fca6f4..10607150a 100755..120000 --- a/docker/centos/binary/neutron/neutron-base/ip_wrapper.py +++ b/docker/centos/binary/neutron/neutron-base/ip_wrapper.py @@ -1,66 +1 @@ -#!/usr/bin/env python - -# Copyright 2015 Sam Yaple -# -# 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 file exists because we want to create and delete any network -# namespaces from the host mount namespace. This allows the host to -# 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 - -import nsenter -import subprocess -import sys - - -def host_mnt_exec(cmd): - try: - with nsenter.ExitStack() as stack: - stack.enter_context( - nsenter.Namespace( - '1', - 'mnt', - proc='/opt/kolla/host_proc/')) - process_ = subprocess.Popen(cmd) - - except Exception as e: - print( - "An error has occured with a component that Kolla manages." - " Please file a bug") - print("Error: ", e) - - return process_ - - -if len(sys.argv) > 2: - # We catch all commands that ip will accept that refer - # to creating or deleteing a Network namespace - if str(sys.argv[1]).startswith("net") and ( - str(sys.argv[2]).startswith("a") or - str(sys.argv[2]).startswith("d")): - # This cmd is executed in the host mount namespace - cmd = ["/usr/bin/env", "ip"] + sys.argv[1:] - sys.exit(host_mnt_exec(cmd).returncode) - else: - cmd = ["/opt/kolla/ip"] + sys.argv[1:] -else: - cmd = ["/opt/kolla/ip"] - - if len(sys.argv) == 2: - cmd = cmd + sys.argv[1:] - -process_ = subprocess.Popen(cmd) -sys.exit(process_.returncode) +../../../../common/neutron/neutron-base/ip_wrapper.py
\ No newline at end of file diff --git a/docker/common/neutron/neutron-base/config-sudoers.sh b/docker/common/neutron/neutron-base/config-sudoers.sh new file mode 100644 index 000000000..0e02226db --- /dev/null +++ b/docker/common/neutron/neutron-base/config-sudoers.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +# Neutron uses rootwrap which requires a tty for sudo. +# Since the container is running in daemon mode, a tty +# is not present and requiretty must be commented out. +if [ ! -f /var/run/sudo-modified ]; then + chmod 0640 /etc/sudoers + sed -i '/Defaults requiretty/s/^/#/' /etc/sudoers + chmod 0440 /etc/sudoers +fi + +touch /var/run/sudo-modified diff --git a/docker/common/neutron/neutron-base/ip_wrapper.py b/docker/common/neutron/neutron-base/ip_wrapper.py new file mode 100755 index 000000000..591fca6f4 --- /dev/null +++ b/docker/common/neutron/neutron-base/ip_wrapper.py @@ -0,0 +1,66 @@ +#!/usr/bin/env python + +# Copyright 2015 Sam Yaple +# +# 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 file exists because we want to create and delete any network +# namespaces from the host mount namespace. This allows the host to +# 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 + +import nsenter +import subprocess +import sys + + +def host_mnt_exec(cmd): + try: + with nsenter.ExitStack() as stack: + stack.enter_context( + nsenter.Namespace( + '1', + 'mnt', + proc='/opt/kolla/host_proc/')) + process_ = subprocess.Popen(cmd) + + except Exception as e: + print( + "An error has occured with a component that Kolla manages." + " Please file a bug") + print("Error: ", e) + + return process_ + + +if len(sys.argv) > 2: + # We catch all commands that ip will accept that refer + # to creating or deleteing a Network namespace + if str(sys.argv[1]).startswith("net") and ( + str(sys.argv[2]).startswith("a") or + str(sys.argv[2]).startswith("d")): + # This cmd is executed in the host mount namespace + cmd = ["/usr/bin/env", "ip"] + sys.argv[1:] + sys.exit(host_mnt_exec(cmd).returncode) + else: + cmd = ["/opt/kolla/ip"] + sys.argv[1:] +else: + cmd = ["/opt/kolla/ip"] + + if len(sys.argv) == 2: + cmd = cmd + sys.argv[1:] + +process_ = subprocess.Popen(cmd) +sys.exit(process_.returncode) |
