summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandru Avadanii <Alexandru.Avadanii@enea.com>2017-08-06 16:56:43 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-08-06 16:56:43 +0000
commit62ac6e35582b21f79e098b9ccf408dbb6e81eda0 (patch)
treec5023aa6c90a71ea3bf1c3ce6820030fd181bdd0
parent447ba637bd160ef709f4cf65e7e765914eda83ca (diff)
parentedcc8b696d9b249f2514c0322db90315465155c6 (diff)
Merge "ci/deploy.sh: Allow non-root deploys"
-rwxr-xr-xci/deploy.sh15
1 files changed, 10 insertions, 5 deletions
diff --git a/ci/deploy.sh b/ci/deploy.sh
index 5886a85ce..7b3bf54c4 100755
--- a/ci/deploy.sh
+++ b/ci/deploy.sh
@@ -87,7 +87,7 @@ $(notify "Disabled input parameters (not yet supported with MCP):" 3)
-i (disabled) .iso image to be deployed (needs to be provided in a URI
style, it can be a local resource: file:// or a remote resource http(s)://)
-$(notify "[NOTE] Root priviledges are needed for this script to run" 3)
+$(notify "[NOTE] sudo & virsh priviledges are needed for this script to run" 3)
Example:
@@ -244,8 +244,13 @@ do
esac
done
-if [[ $EUID -ne 0 ]]; then
- notify "[ERROR] This script must be run as root\n" 1>&2
+if [[ "$(sudo whoami)" != 'root' ]]; then
+ notify "This script requires sudo rights\n" 1>&2
+ exit 1
+fi
+
+if ! virsh list >/dev/null 2>&1; then
+ notify "This script requires hypervisor access\n" 1>&2
exit 1
fi
@@ -273,9 +278,9 @@ pushd "${DEPLOY_DIR}" > /dev/null
# scenario, etc.
# Install required packages
-[ -n "$(command -v apt-get)" ] && apt-get install -y \
+[ -n "$(command -v apt-get)" ] && sudo apt-get install -y \
git make rsync mkisofs curl virtinst cpu-checker qemu-kvm
-[ -n "$(command -v yum)" ] && yum install -y \
+[ -n "$(command -v yum)" ] && sudo yum install -y \
git make rsync genisoimage curl virt-install qemu-kvm
# Check scenario file existence