summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandru Avadanii <Alexandru.Avadanii@enea.com>2017-07-18 01:45:17 +0200
committerAlexandru Avadanii <Alexandru.Avadanii@enea.com>2017-07-18 01:52:32 +0200
commit081dc460f888f9e2b7f9e2491f9c529c4dc48eed (patch)
treeeba4d7143fa3ed98444e80402a77664150a8357e
parent4f72e6be436badd2ded546424ec4a304cd6ce5d3 (diff)
p/fuel: deploy: Allow non-root deploys
Fuel@OPNFV's ci/deploy.sh script imposes a hard requirement on running as the root user, which can be refactored into a series of smaller requirements. Instead, relax the check to the ability to run sudo commands inside the script, and explicitly add sudo for the package installation commands. This also adds a requirement for the Jenkins user running the deploy to be part of the "kvm" and "libvirtd" groups, so libvirt/virsh can manage VMs on the jump server / Jenkins slave. See related change in OPNFV Releng repository [1]. [1] https://gerrit.opnfv.org/gerrit/#/c/37655 Change-Id: I29b90d285c99f85462493c2a3890264365fca9f0 Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
-rw-r--r--patches/opnfv-fuel/0007-deploy-Allow-non-root-deploys.patch37
1 files changed, 37 insertions, 0 deletions
diff --git a/patches/opnfv-fuel/0007-deploy-Allow-non-root-deploys.patch b/patches/opnfv-fuel/0007-deploy-Allow-non-root-deploys.patch
new file mode 100644
index 00000000..a7599e28
--- /dev/null
+++ b/patches/opnfv-fuel/0007-deploy-Allow-non-root-deploys.patch
@@ -0,0 +1,37 @@
+From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
+Date: Mon, 17 Jul 2017 23:10:25 +0000
+Subject: [PATCH] deploy: Allow non-root deploys
+
+Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
+---
+ ci/deploy.sh | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/ci/deploy.sh b/ci/deploy.sh
+index 92c7947..edf05be 100755
+--- a/ci/deploy.sh
++++ b/ci/deploy.sh
+@@ -212,8 +212,8 @@ do
+ esac
+ done
+
+-if [[ $EUID -ne 0 ]]; then
+- echo "This script must be run as root" 1>&2
++if [[ $(sudo whoami) != 'root' ]]; then
++ echo "This script requires sudo rights" 1>&2
+ exit 1
+ fi
+
+@@ -230,9 +230,9 @@ pushd ${DEPLOY_DIR} > /dev/null
+ # scenario, etc.
+
+ # Install required packages
+-[ -n "$(command -v apt-get)" ] && apt-get install -y mkisofs curl virtinst cpu-checker qemu-kvm vgabios && \
+- ln -sf /usr/share/vgabios/vgabios.bin /usr/share/qemu/vgabios-stdvga.bin
+-[ -n "$(command -v yum)" ] && yum install -y genisoimage curl virt-install qemu-kvm vgabios
++[ -n "$(command -v apt-get)" ] && sudo apt-get install -y mkisofs curl virtinst cpu-checker qemu-kvm vgabios && \
++ sudo ln -sf /usr/share/vgabios/vgabios.bin /usr/share/qemu/vgabios-stdvga.bin
++[ -n "$(command -v yum)" ] && sudo yum install -y genisoimage curl virt-install qemu-kvm vgabios
+
+ # Check scenario file existence
+ if [[ ! -f ../config/${DEPLOY_SCENARIO}.yaml ]]; then