From 4d098534002ad7891ab4c8564b9aca97f0f86eab Mon Sep 17 00:00:00 2001
From: Jackie Huang <jackie.huang@windriver.com>
Date: Sat, 25 Apr 2020 20:58:07 -0700
Subject: [PATCH] armada-app: fix build failure on centos

- use $! instead of pidof to get the last backgrounded helm service
- add a sleep after helm serve to ensure the servie is running

Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
Signed-off-by: Babak Sarashki <Babak.SarAshki@windriver.com>
---
 .../stx-monitor-armada-app/monitor-helm-elastic_1.0.bb      | 6 +++---
 meta-stx-flock/stx-monitor-armada-app/monitor-helm_1.0.bb   | 6 +++---
 .../stx-openstack-armada-app/openstack-helm-infra_1.0.bb    | 6 +++---
 .../stx-openstack-armada-app/openstack-helm_1.0.bb          | 6 +++---
 .../stx-openstack-armada-app/stx-openstack-helm_1.0.bb      | 6 +++---
 .../stx-platform-armada-app/stx-platform-helm_1.0.bb        | 6 +++---
 6 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/meta-stx-flock/stx-monitor-armada-app/monitor-helm-elastic_1.0.bb b/meta-stx-flock/stx-monitor-armada-app/monitor-helm-elastic_1.0.bb
index 22f7bc4..91c983d 100644
--- a/meta-stx-flock/stx-monitor-armada-app/monitor-helm-elastic_1.0.bb
+++ b/meta-stx-flock/stx-monitor-armada-app/monitor-helm-elastic_1.0.bb
@@ -65,6 +65,7 @@ do_compile () {
 
 	# Host a server for the charts
 	helm serve --repo-path . &
+	sleep 1
 	helm repo rm local
 	helm repo add local http://localhost:8879/charts
 
@@ -72,9 +73,8 @@ do_compile () {
 	rm elasticsearch/Makefile
 	make elasticsearch
 
-	# terminate helm server
-	pid=`/bin/pidof helm`
-	kill ${pid}
+	# terminate helm server (the last backgrounded task)
+	kill $!
 	rm -rf ${helm_home}
 }
 
diff --git a/meta-stx-flock/stx-monitor-armada-app/monitor-helm_1.0.bb b/meta-stx-flock/stx-monitor-armada-app/monitor-helm_1.0.bb
index eecc43e..59865f6 100644
--- a/meta-stx-flock/stx-monitor-armada-app/monitor-helm_1.0.bb
+++ b/meta-stx-flock/stx-monitor-armada-app/monitor-helm_1.0.bb
@@ -72,6 +72,7 @@ do_compile () {
 
 	# Host a server for the charts
 	helm serve --repo-path . &
+	sleep 1
 	helm repo rm local
 	helm repo add local http://localhost:8879/charts
 
@@ -85,9 +86,8 @@ do_compile () {
 	make logstash
 	make elasticsearch-curator
 
-	# terminate helm server
-	pid=`/bin/pidof helm`
-	kill ${pid}
+	# terminate helm server (the last backgrounded task)
+	kill $!
 	rm -rf ${helm_home}
 }
 
diff --git a/meta-stx-flock/stx-openstack-armada-app/openstack-helm-infra_1.0.bb b/meta-stx-flock/stx-openstack-armada-app/openstack-helm-infra_1.0.bb
index 2da2504..c1cacf2 100644
--- a/meta-stx-flock/stx-openstack-armada-app/openstack-helm-infra_1.0.bb
+++ b/meta-stx-flock/stx-openstack-armada-app/openstack-helm-infra_1.0.bb
@@ -62,6 +62,7 @@ do_compile () {
 	# Host a server for the charts
 	tmpdir=`mktemp -d ${B}/charts-XXXXXX`
 	helm serve ${tmpdir} --address localhost:8879 --url http://localhost:8879/charts &
+	sleep 1
 	helm repo rm local
 	helm repo add local http://localhost:8879/charts
 
@@ -76,9 +77,8 @@ do_compile () {
 	make rabbitmq
 	make ceph-rgw
 
-	# terminate helm server
-	pid=`/bin/pidof helm`
-	kill ${pid}
+	# terminate helm server (the last backgrounded task)
+	kill $!
 	rm -rf ${helm_home}
 }
 
diff --git a/meta-stx-flock/stx-openstack-armada-app/openstack-helm_1.0.bb b/meta-stx-flock/stx-openstack-armada-app/openstack-helm_1.0.bb
index 1912c94..1e6bf0a 100644
--- a/meta-stx-flock/stx-openstack-armada-app/openstack-helm_1.0.bb
+++ b/meta-stx-flock/stx-openstack-armada-app/openstack-helm_1.0.bb
@@ -69,6 +69,7 @@ do_compile () {
 
 	# Host a server for the charts
 	helm serve --repo-path . &
+	sleep 1
 	helm repo rm local
 	helm repo add local http://localhost:8879/charts
 
@@ -88,9 +89,8 @@ do_compile () {
 	make panko
 	make placement
 
-	# terminate helm server
-	pid=`/bin/pidof helm`
-	kill ${pid}
+	# terminate helm server (the last backgrounded task)
+	kill $!
 	rm -rf ${helm_home}
 
 	# Remove the helm-toolkit tarball
diff --git a/meta-stx-flock/stx-openstack-armada-app/stx-openstack-helm_1.0.bb b/meta-stx-flock/stx-openstack-armada-app/stx-openstack-helm_1.0.bb
index 0bdebd1..829ba8f 100644
--- a/meta-stx-flock/stx-openstack-armada-app/stx-openstack-helm_1.0.bb
+++ b/meta-stx-flock/stx-openstack-armada-app/stx-openstack-helm_1.0.bb
@@ -58,6 +58,7 @@ do_compile () {
 
 	# Host a server for the charts
 	helm serve --repo-path . &
+	sleep 1
 	helm repo rm local
 	helm repo add local http://localhost:8879/charts
 
@@ -71,9 +72,8 @@ do_compile () {
 	make dcdbsync
 	cd -
 
-	# terminate helm server
-	pid=`/bin/pidof helm`
-	kill ${pid}
+	# terminate helm server (the last backgrounded task)
+	kill $!
 	rm -rf ${helm_home}
 
 	# Remove the helm-toolkit tarball
diff --git a/meta-stx-flock/stx-platform-armada-app/stx-platform-helm_1.0.bb b/meta-stx-flock/stx-platform-armada-app/stx-platform-helm_1.0.bb
index 10e2697..4d49535 100644
--- a/meta-stx-flock/stx-platform-armada-app/stx-platform-helm_1.0.bb
+++ b/meta-stx-flock/stx-platform-armada-app/stx-platform-helm_1.0.bb
@@ -64,6 +64,7 @@ do_compile () {
 
 	# Host a server for the charts
 	helm serve --repo-path . &
+	sleep 1
 	helm repo rm local
 	helm repo add local http://localhost:8879/charts
 
@@ -76,9 +77,8 @@ do_compile () {
 	make node-feature-discovery
 	cd -
 
-	# Terminate helm server
-	pid=`/bin/pidof helm`
-	kill ${pid}
+	# Terminate helm server (the last backgrounded task)
+	kill $!
 	rm -rf ${helm_home}
 
 	# Create a chart tarball compliant with sysinv kube-app.py