Merge "Make .ssh/config changes idempotent"
authorKuralamudhan Ramakrishnan <kuralamudhan.ramakrishnan@intel.com>
Mon, 7 Mar 2022 14:59:51 +0000 (14:59 +0000)
committerGerrit Code Review <gerrit@akraino.org>
Mon, 7 Mar 2022 14:59:51 +0000 (14:59 +0000)
Makefile
deploy/clusterctl/clusterctl.sh
deploy/kubectl/kubectl.sh
deploy/sops/sops.sh
deploy/yq/yq.sh
tools/vagrant/destroy.rb [new file with mode: 0755]

index 9e6115d..8472fd1 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -70,6 +70,7 @@ ironic_bridge:
        ./deploy/ironic/ironic.sh deploy-bridge
 
 ironic_bridge_clean:
+       source user_config.sh && \
        ./deploy/ironic/ironic.sh clean-bridge
 
 # Jump server components
@@ -93,9 +94,11 @@ baremetal_operator_clean:
        ./deploy/baremetal-operator/baremetal-operator.sh clean
 
 ironic:
+       source user_config.sh && \
        ./deploy/ironic/ironic.sh deploy
 
 ironic_clean:
+       source user_config.sh && \
        ./deploy/ironic/ironic.sh clean
 
 cert_manager:
index 21293e4..ed7a747 100755 (executable)
@@ -7,7 +7,7 @@ LIBDIR="$(dirname $(dirname ${SCRIPTDIR}))/env/lib"
 source $LIBDIR/common.sh
 
 function deploy {
-    curl -L https://github.com/kubernetes-sigs/cluster-api/releases/download/${CAPI_VERSION}/clusterctl-linux-amd64 -o clusterctl
+    curl -sL https://github.com/kubernetes-sigs/cluster-api/releases/download/${CAPI_VERSION}/clusterctl-linux-amd64 -o clusterctl
     sudo install -o root -g root -m 0755 clusterctl /usr/local/bin/clusterctl
     rm clusterctl
     clusterctl version
index 27fbe1a..4e35112 100755 (executable)
@@ -7,7 +7,7 @@ LIBDIR="$(dirname $(dirname ${SCRIPTDIR}))/env/lib"
 source $LIBDIR/common.sh
 
 function deploy {
-    curl -LO "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl" -o kubectl
+    curl -sL "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl" -o kubectl
     sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
     rm kubectl
     kubectl version --client
index bf99887..c3bd7c0 100755 (executable)
@@ -7,7 +7,7 @@ LIBDIR="$(dirname $(dirname ${SCRIPTDIR}))/env/lib"
 source $LIBDIR/common.sh
 
 function deploy {
-    curl -L https://github.com/mozilla/sops/releases/download/${SOPS_VERSION}/sops-${SOPS_VERSION}.linux -o sops
+    curl -sL https://github.com/mozilla/sops/releases/download/${SOPS_VERSION}/sops-${SOPS_VERSION}.linux -o sops
     sudo install -o root -g root -m 0755 sops /usr/local/bin/sops
     rm sops
     sops --version
index fa933fb..85f5b05 100755 (executable)
@@ -7,7 +7,7 @@ LIBDIR="$(dirname $(dirname ${SCRIPTDIR}))/env/lib"
 source $LIBDIR/common.sh
 
 function deploy {
-    curl -LO "https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/yq_linux_amd64" -o yq
+    curl -sL "https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/yq_linux_amd64" -o yq
     sudo install -o root -g root -m 0755 yq /usr/local/bin/yq
     rm yq
 }
diff --git a/tools/vagrant/destroy.rb b/tools/vagrant/destroy.rb
new file mode 100755 (executable)
index 0000000..672d362
--- /dev/null
@@ -0,0 +1,17 @@
+#!/usr/bin/env ruby
+require 'yaml'
+
+site = ENV['ICN_SITE'] || 'vm'
+
+Dir.chdir(File.join(__dir__, '../../'))
+system('vagrant destroy -f jump')
+
+Dir.glob("deploy/site/#{site}/*.yaml") do |file|
+  YAML.load_stream(File.read(file)) do |document|
+    values = document.fetch('spec', {}).fetch('values', {})
+    next if values['machineName'].nil? || values['bootMACAddress'].nil?
+    machine_name = values['machineName']
+    system("virsh -c qemu:///system destroy vm-#{machine_name}")
+    system("virsh -c qemu:///system undefine --nvram --remove-all-storage vm-#{machine_name}")
+  end
+end