The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/2287
This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) ===
From 3822c4e7f61d9ae17a8594a03344330b7bebb12f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgra...@ubuntu.com> Date: Tue, 16 Aug 2016 13:18:57 -0400 Subject: [PATCH 1/2] Fix for newer shellcheck MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Graber <stgra...@ubuntu.com> --- lxd-bridge/lxd-bridge | 3 ++- test/backends/btrfs.sh | 6 ++++++ test/backends/dir.sh | 6 ++++++ test/backends/lvm.sh | 6 ++++++ test/backends/zfs.sh | 6 ++++++ test/main.sh | 15 +++++++++++---- test/suites/basic.sh | 3 ++- test/suites/devlxd.sh | 2 ++ test/suites/remote.sh | 2 +- test/suites/static_analysis.sh | 2 +- 10 files changed, 43 insertions(+), 8 deletions(-) diff --git a/lxd-bridge/lxd-bridge b/lxd-bridge/lxd-bridge index 67a7829..15390a3 100755 --- a/lxd-bridge/lxd-bridge +++ b/lxd-bridge/lxd-bridge @@ -27,6 +27,7 @@ LXD_IPV6_NETWORK="" LXD_IPV6_NAT="false" LXD_IPV6_PROXY="true" +# shellcheck disable=SC1090 [ ! -f "${config}" ] || . "${config}" use_iptables_lock="-w" @@ -39,7 +40,7 @@ HAS_IPV6=false _netmask2cidr () { # Assumes there's no "255." after a non-255 byte in the mask - local x=${1##*255.} + x=${1##*255.} set -- "0^^^128^192^224^240^248^252^254^" "$(( (${#1} - ${#x})*2 ))" "${x%%.*}" x=${1%%${3}*} echo $(( ${2} + (${#x}/4) )) diff --git a/test/backends/btrfs.sh b/test/backends/btrfs.sh index 5639928..efbcc46 100644 --- a/test/backends/btrfs.sh +++ b/test/backends/btrfs.sh @@ -1,7 +1,9 @@ #!/bin/sh btrfs_setup() { + # shellcheck disable=2039 local LXD_DIR + LXD_DIR=$1 echo "==> Setting up btrfs backend in ${LXD_DIR}" @@ -17,14 +19,18 @@ btrfs_setup() { } btrfs_configure() { + # shellcheck disable=2039 local LXD_DIR + LXD_DIR=$1 echo "==> Configuring btrfs backend in ${LXD_DIR}" } btrfs_teardown() { + # shellcheck disable=2039 local LXD_DIR + LXD_DIR=$1 echo "==> Tearing down btrfs backend in ${LXD_DIR}" diff --git a/test/backends/dir.sh b/test/backends/dir.sh index beeaefc..7a14be5 100644 --- a/test/backends/dir.sh +++ b/test/backends/dir.sh @@ -5,7 +5,9 @@ # Any necessary backend-specific setup dir_setup() { + # shellcheck disable=2039 local LXD_DIR + LXD_DIR=$1 echo "==> Setting up directory backend in ${LXD_DIR}" @@ -13,14 +15,18 @@ dir_setup() { # Do the API voodoo necessary to configure LXD to use this backend dir_configure() { + # shellcheck disable=2039 local LXD_DIR + LXD_DIR=$1 echo "==> Configuring directory backend in ${LXD_DIR}" } dir_teardown() { + # shellcheck disable=2039 local LXD_DIR + LXD_DIR=$1 echo "==> Tearing down directory backend in ${LXD_DIR}" diff --git a/test/backends/lvm.sh b/test/backends/lvm.sh index 0996e0a..862e330 100644 --- a/test/backends/lvm.sh +++ b/test/backends/lvm.sh @@ -1,7 +1,9 @@ #!/bin/sh lvm_setup() { + # shellcheck disable=2039 local LXD_DIR + LXD_DIR=$1 echo "==> Setting up lvm backend in ${LXD_DIR}" @@ -23,7 +25,9 @@ lvm_setup() { } lvm_configure() { + # shellcheck disable=2039 local LXD_DIR + LXD_DIR=$1 echo "==> Configuring lvm backend in ${LXD_DIR}" @@ -33,7 +37,9 @@ lvm_configure() { } lvm_teardown() { + # shellcheck disable=2039 local LXD_DIR + LXD_DIR=$1 echo "==> Tearing down lvm backend in ${LXD_DIR}" diff --git a/test/backends/zfs.sh b/test/backends/zfs.sh index 0a7b515..41013fe 100644 --- a/test/backends/zfs.sh +++ b/test/backends/zfs.sh @@ -1,7 +1,9 @@ #!/bin/sh zfs_setup() { + # shellcheck disable=2039 local LXD_DIR + LXD_DIR=$1 echo "==> Setting up ZFS backend in ${LXD_DIR}" @@ -17,7 +19,9 @@ zfs_setup() { } zfs_configure() { + # shellcheck disable=2039 local LXD_DIR + LXD_DIR=$1 echo "==> Configuring ZFS backend in ${LXD_DIR}" @@ -26,7 +30,9 @@ zfs_configure() { } zfs_teardown() { + # shellcheck disable=2039 local LXD_DIR + LXD_DIR=$1 echo "==> Tearing down ZFS backend in ${LXD_DIR}" diff --git a/test/main.sh b/test/main.sh index 532e7d9..5b38682 100755 --- a/test/main.sh +++ b/test/main.sh @@ -39,6 +39,7 @@ local_tcp_port() { # import all the backends for backend in backends/*.sh; do + # shellcheck disable=SC1090 . "${backend}" done @@ -50,6 +51,8 @@ spawn_lxd() { set +x # LXD_DIR is local here because since $(lxc) is actually a function, it # overwrites the environment and we would lose LXD_DIR's value otherwise. + + # shellcheck disable=2039 local LXD_DIR lxddir=${1} @@ -192,7 +195,10 @@ check_empty_table() { kill_lxd() { # LXD_DIR is local here because since $(lxc) is actually a function, it # overwrites the environment and we would lose LXD_DIR's value otherwise. + + # shellcheck disable=2039 local LXD_DIR + daemon_dir=${1} LXD_DIR=${daemon_dir} daemon_pid=$(cat "${daemon_dir}/lxd.pid") @@ -279,13 +285,13 @@ cleanup() { echo "Tests Completed (${TEST_RESULT}): hit enter to continue" # shellcheck disable=SC2034 - read nothing + read -r nothing fi echo "==> Cleaning up" # Kill all the LXD instances - while read daemon_dir; do + while read -r daemon_dir; do kill_lxd "${daemon_dir}" done < "${TEST_DIR}/daemons" @@ -309,12 +315,12 @@ wipe() { fi # shellcheck disable=SC2009 - ps aux | grep lxc-monitord | grep "${1}" | awk '{print $2}' | while read pid; do + ps aux | grep lxc-monitord | grep "${1}" | awk '{print $2}' | while read -r pid; do kill -9 "${pid}" done if [ -f "${TEST_DIR}/loops" ]; then - while read line; do + while read -r line; do losetup -d "${line}" || true done < "${TEST_DIR}/loops" fi @@ -333,6 +339,7 @@ trap cleanup EXIT HUP INT TERM # Import all the testsuites for suite in suites/*.sh; do + # shellcheck disable=SC1090 . "${suite}" done diff --git a/test/suites/basic.sh b/test/suites/basic.sh index 9589fc3..e2696f7 100644 --- a/test/suites/basic.sh +++ b/test/suites/basic.sh @@ -8,7 +8,7 @@ test_basic_usage() { sum=$(lxc image info testimage | grep ^Fingerprint | cut -d' ' -f2) lxc image export testimage "${LXD_DIR}/" [ "${sum}" = "$(sha256sum "${LXD_DIR}/${sum}.tar.xz" | cut -d' ' -f1)" ] - + # Test an alias with slashes lxc image show "${sum}" lxc image alias create a/b/ "${sum}" @@ -202,6 +202,7 @@ test_basic_usage() { # Test "nonetype" container creation with an LXC config wait_for "${LXD_ADDR}" my_curl -X POST "https://${LXD_ADDR}/1.0/containers" \ -d "{\"name\":\"configtest\",\"config\":{\"raw.lxc\":\"lxc.hook.clone=/bin/true\"},\"source\":{\"type\":\"none\"}}" + # shellcheck disable=SC2102 [ "$(my_curl "https://${LXD_ADDR}/1.0/containers/configtest" | jq -r .metadata.config[\"raw.lxc\"])" = "lxc.hook.clone=/bin/true" ] lxc delete configtest diff --git a/test/suites/devlxd.sh b/test/suites/devlxd.sh index 4d57547..3e4f138 100644 --- a/test/suites/devlxd.sh +++ b/test/suites/devlxd.sh @@ -3,8 +3,10 @@ test_devlxd() { ensure_import_testimage + # shellcheck disable=SC2164 cd "${TEST_DIR}" go build -tags netgo -a -installsuffix devlxd ../deps/devlxd-client.go + # shellcheck disable=SC2164 cd - lxc launch testimage devlxd diff --git a/test/suites/remote.sh b/test/suites/remote.sh index cf0f1dd..b43e281 100644 --- a/test/suites/remote.sh +++ b/test/suites/remote.sh @@ -4,7 +4,7 @@ test_remote_url() { for url in "${LXD_ADDR}" "https://${LXD_ADDR}"; do lxc_remote remote add test "${url}" --accept-certificate --password foo lxc_remote finger test: - lxc_remote config trust list | grep @ | awk '{print $2}' | while read line ; do + lxc_remote config trust list | grep @ | awk '{print $2}' | while read -r line ; do lxc_remote config trust remove "\"${line}\"" done lxc_remote remote remove test diff --git a/test/suites/static_analysis.sh b/test/suites/static_analysis.sh index 301e3ef..174f5fd 100644 --- a/test/suites/static_analysis.sh +++ b/test/suites/static_analysis.sh @@ -1,7 +1,7 @@ #!/bin/sh safe_pot_hash() { - sed -e "/Project-Id-Version/,/Content-Transfer-Encoding/d" -e "/^#/d" "po/lxd.pot" | tee /tmp/foo | md5sum | cut -f1 -d" " + sed -e "/Project-Id-Version/,/Content-Transfer-Encoding/d" -e "/^#/d" "po/lxd.pot" | md5sum | cut -f1 -d" " } test_static_analysis() { From bf701939fb57003adbca3733aecc030c971386c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgra...@ubuntu.com> Date: Tue, 16 Aug 2016 13:34:20 -0400 Subject: [PATCH 2/2] lxd-bridge: Fail on dnsmasq failure MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Graber <stgra...@ubuntu.com> --- lxd-bridge/lxd-bridge | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lxd-bridge/lxd-bridge b/lxd-bridge/lxd-bridge index 15390a3..14d8f4d 100755 --- a/lxd-bridge/lxd-bridge +++ b/lxd-bridge/lxd-bridge @@ -165,7 +165,7 @@ start() { if [ -n "${LXD_IPV4_ADDR}" ] || [ -n "${LXD_IPV6_ADDR}" ]; then # shellcheck disable=SC2086 - dnsmasq ${LXD_CONFILE_ARG} ${LXD_DOMAIN_ARG} -u "${DNSMASQ_USER}" --strict-order --bind-interfaces --pid-file="${varrun}/dnsmasq.pid" --dhcp-no-override --except-interface=lo --interface="${LXD_BRIDGE}" --dhcp-leasefile="${varlib}/dnsmasq.${LXD_BRIDGE}.leases" --dhcp-authoritative ${LXD_IPV4_ARG} ${LXD_IPV6_ARG} || cleanup + dnsmasq ${LXD_CONFILE_ARG} ${LXD_DOMAIN_ARG} -u "${DNSMASQ_USER}" --strict-order --bind-interfaces --pid-file="${varrun}/dnsmasq.pid" --dhcp-no-override --except-interface=lo --interface="${LXD_BRIDGE}" --dhcp-leasefile="${varlib}/dnsmasq.${LXD_BRIDGE}.leases" --dhcp-authoritative ${LXD_IPV4_ARG} ${LXD_IPV6_ARG} fi if [ "${HAS_IPV6}" = "true" ] && [ "${LXD_IPV6_PROXY}" = "true" ]; then
_______________________________________________ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel