+function check_osm_deployed_before_config() {
+ TIME_TO_WAIT=600
+ start_time="$(date -u +%s)"
+ total_active_services=13
+ [ -n "$INSTALL_PLA" ] && total_active_services=$((total_active_services + 1))
+ previous_count=0
+ while true
+ do
+ juju_status=$(juju status --format json -m $MODEL_NAME)
+ active_service_count=$(echo $juju_status | jq '.applications[]."application-status".current'| grep active | wc -l)
+ echo "$active_service_count / $total_active_services services active"
+ if [ $active_service_count -eq $total_active_services ]; then
+ mon_is_blocked=$(echo $juju_status | jq '.applications["mon"].units[]."workload-status".current' | grep blocked | wc -l)
+ nbi_is_blocked=$(echo $juju_status | jq '.applications["nbi"].units[]."workload-status".current' | grep blocked | wc -l)
+ if [ $mon_is_blocked -a $nbi_is_blocked ]; then
+ echo "MON and NBI are blocked"
+ break
+ fi
+ fi
+ if [ $active_service_count -ne $previous_count ]; then
+ previous_count=$active_service_count
+ start_time="$(date -u +%s)"
+ fi
+ now="$(date -u +%s)"
+ if [[ $(( now - start_time )) -gt $TIME_TO_WAIT ]];then
+ echo "Timed out waiting for OSM services to become ready"
+ FATAL_TRACK deploy_osm "Timed out waiting for services to become ready"
+ fi
+ sleep 10
+ done
+}
+
+function check_osm_deployed_after_config() {