k8s: Remove repetition from provisioning scripts
Issue-ID: SECCOM-235
Change-Id: If286ba074ee74c43705197a30c50322d5162e6fc
Signed-off-by: Pawel Wieczorek <p.wieczorek2@samsung.com>
diff --git a/test/security/k8s/vagrant/dublin/Vagrantfile b/test/security/k8s/vagrant/dublin/Vagrantfile
index d91a822..36f433f 100644
--- a/test/security/k8s/vagrant/dublin/Vagrantfile
+++ b/test/security/k8s/vagrant/dublin/Vagrantfile
@@ -18,6 +18,11 @@
all = cluster.dup << operation
+$add_to_docker_group = <<-SCRIPT
+ USER="$1"
+ usermod -aG docker "$USER"
+SCRIPT
+
$deploy_key = <<-SCRIPT
KEY="$1"
USER="$2"
@@ -59,12 +64,12 @@
if machine[:name] == 'control'
config.vm.provision :shell, path: "../../tools/dublin/imported/openstack-k8s-controlnode.sh"
- config.vm.provision :shell, inline: "usermod -aG docker vagrant" # script above adds "ubuntu" user only
+ config.vm.provision :shell, inline: $add_to_docker_group, args: vagrant_user
end
if machine[:name] == 'worker'
config.vm.provision :shell, path: "../../tools/dublin/imported/openstack-k8s-workernode.sh"
- config.vm.provision :shell, inline: "usermod -aG docker vagrant" # script above adds "ubuntu" user only
+ config.vm.provision :shell, inline: $add_to_docker_group, args: vagrant_user
end
if machine[:name] == 'operator'