Increase inline provisioners configurability 44/100744/4
authorPawel Wieczorek <p.wieczorek2@samsung.com>
Thu, 23 Jan 2020 16:55:17 +0000 (17:55 +0100)
committerPawel Wieczorek <p.wieczorek2@samsung.com>
Wed, 29 Jan 2020 16:12:32 +0000 (17:12 +0100)
Scripts "get_oom" and "deploy_onap" are more useful if an additional
parameter is accepted: external repository and deployment override,
respectively.

These parameteres will make testing easier and allow improving this
setup quicker. Previous behaviour stays as it was using default
argument values.

Changes in their invocations were meant to make ad-hoc modifications
more explicit.

SSH configuration from host machine is synchronized in case additional
access rights are necessary.

Issue-ID: ONAPARC-551
Change-Id: I585586f721457388ab30b089f2c25c4ad88ad4d3
Signed-off-by: Pawel Wieczorek <p.wieczorek2@samsung.com>
bootstrap/vagrant-minimal-onap/Vagrantfile

index e12c035..5272dd6 100644 (file)
@@ -115,7 +115,8 @@ $rke_down = "rke remove --force"
 
 $get_oom = <<-SCRIPT
   BRANCH="${1:-5.0.1-ONAP}"
-  git clone -b "$BRANCH" https://git.onap.org/oom --recurse-submodules
+  REPO="${2:-https://git.onap.org/oom}"
+  git clone -b "$BRANCH" "$REPO" --recurse-submodules
 SCRIPT
 
 $get_helm_plugins = "mkdir -p ${HOME}/.helm && cp -R ${HOME}/oom/kubernetes/helm/plugins/ ${HOME}/.helm"
@@ -139,7 +140,9 @@ $setup_helm_repo = <<-SCRIPT
 SCRIPT
 
 $deploy_onap = <<-SCRIPT
-  ENV="$1"
+  OVERRIDE="${1:-${HOME}/oom/kubernetes/onap/resources/environments/minimal-onap.yaml}"
+
+  ENV="${2:-#{os_env}}"
   export $(cat "$ENV" | xargs)
 
   encrypt () {
@@ -153,7 +156,6 @@ $deploy_onap = <<-SCRIPT
 
   export KUBECONFIG="${HOME}/.kube/config.onap"
 
-  OVERRIDE="${HOME}/oom/kubernetes/onap/resources/environments/minimal-onap.yaml"
   helm deploy minimal local/onap --namespace onap -f "$OVERRIDE" --verbose --timeout 900
 SCRIPT
 
@@ -196,6 +198,7 @@ Vagrant.configure('2') do |config|
 
       if machine[:name] == 'operator'
         config.vm.synced_folder ".", synced_folder_main, type: "rsync", rsync__exclude: ["Vagrantfile", "operator"]
+        config.vm.synced_folder "~/.ssh", "/home/#{vagrant_user}/.ssh", type: "rsync", rsync__exclude: "authorized_keys"
         config.vm.synced_folder "./operator", "/home/#{vagrant_user}", type: "sshfs", reverse: true, sshfs_opts_append: "-o nonempty"
 
         config.vm.provision "setup_debconf", type: :shell, inline: $setup_debconf
@@ -245,7 +248,10 @@ Vagrant.configure('2') do |config|
           s.path = "tools/setup_kubectl.sh"
         end
         config.vm.provision "get_helm", type: :shell, path: "tools/get_helm.sh"
-        config.vm.provision "get_oom", type: :shell, privileged: false, inline: $get_oom
+        config.vm.provision "get_oom", type: :shell do |s|
+          s.privileged = false
+          s.inline = $get_oom
+        end
         config.vm.provision "get_helm_plugins", type: :shell, privileged: false, inline: $get_helm_plugins
         config.vm.provision "install_make", type: :shell, inline: $install_make
         config.vm.provision "setup_helm_cluster", type: :shell, run: "never", privileged: false, inline: $setup_helm_cluster
@@ -253,7 +259,6 @@ Vagrant.configure('2') do |config|
         config.vm.provision "deploy_onap", type: :shell, run: "never" do |s|
           s.privileged = false
           s.inline = $deploy_onap
-          s.args = os_env
         end
       end
     end