From 20bdaa81d0db55b113e86b5dd4a44c124c09315f Mon Sep 17 00:00:00 2001 From: "Frederick F. Kautz IV" Date: Wed, 24 May 2017 11:43:21 -0700 Subject: [PATCH] Add support for running kuryr with ocata devstack. The signature for run_process is different between older and newer versions of devstack. This patch works around those issues by calling sudo directly. However, sudo cannot be called in systemd so we use the new signature when IS_SYSTEMD is True and sudo in all other instances. Ocata: run_process service "command-line" [group] Master: run_process service "command-line" [group] [user] Change-Id: Ia2ca599fe1dc5df945425b27dc5ac70c93f47f8e Closes-Bug: 1693323 --- devstack/plugin.sh | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/devstack/plugin.sh b/devstack/plugin.sh index 49307efaf..96b6251e4 100644 --- a/devstack/plugin.sh +++ b/devstack/plugin.sh @@ -327,9 +327,21 @@ function prepare_docker { function run_docker { local dockerd_bin=$(which dockerd) - run_process docker \ - "$dockerd_bin --debug=true \ - -H unix://$KURYR_DOCKER_ENGINE_SOCKET_FILE" "" "root" + + if [[ "$USE_SYSTEMD" = "True" ]]; then + # If systemd is being used, proceed as normal + run_process docker \ + "$dockerd_bin --debug=true \ + -H unix://$KURYR_DOCKER_ENGINE_SOCKET_FILE" "root" "root" + else + # If screen is being used, there is a possibility that the devstack + # environment is on a stable branch. Older versions of run_process have + # a different signature. Sudo is used as a workaround that works in + # both older and newer versions of devstack. + run_process docker \ + "sudo $dockerd_bin --debug=true \ + -H unix://$KURYR_DOCKER_ENGINE_SOCKET_FILE" + fi # We put the stack user as owner of the socket so we do not need to # run the Docker commands with sudo when developing. @@ -537,7 +549,16 @@ function run_k8s_kubelet { --cert-dir=${KURYR_HYPERKUBE_DATA_DIR}/kubelet.cert \ --root-dir=${KURYR_HYPERKUBE_DATA_DIR}/kubelet" wait_for "Kubernetes API Server" "$KURYR_K8S_API_URL" - run_process kubelet "$command" "" "root" + if [[ "$USE_SYSTEMD" = "True" ]]; then + # If systemd is being used, proceed as normal + run_process kubelet "$command" root root + else + # If screen is being used, there is a possibility that the devstack + # environment is on a stable branch. Older versions of run_process have + # a different signature. Sudo is used as a workaround that works in + # both older and newer versions of devstack. + run_process kubelet "sudo $command" + fi } function run_kuryr_kubernetes {