MohanDV commented on a change in pull request #1566: METRON-2322 Add Ambari 
connection check to upgrade_helper script
URL: https://github.com/apache/metron/pull/1566#discussion_r348492922
 
 

 ##########
 File path: metron-platform/metron-common/src/main/scripts/upgrade_helper.sh
 ##########
 @@ -57,12 +57,18 @@ if [ "$mode" == "backup" ]; then
     fi
     if [ -f "/var/lib/ambari-server/resources/scripts/configs.py" ]; then
         echo Backing up Ambari config...
-        for config_type in $(curl -u $username:$password -H "X-Requested-By: 
ambari" -X GET  
http://$ambari_address/api/v1/clusters/$cluster_name?fields=Clusters/desired_configs
 | grep '" : {' | grep -v Clusters | grep -v desired_configs | cut -d'"' -f2 | 
grep metron); 
-        do 
-            echo Saving $config_type
-            /var/lib/ambari-server/resources/scripts/configs.py -u $username 
-p $password -a get -l ${ambari_address%:*} -n $cluster_name -c $config_type -f 
$AMBARI_CONFIG_DIR/${config_type}.json
-        done
-        echo Done backing up Ambari config...
+        echo Checking connection...
+        ret_status=$(curl -i -u "$username":"$password" -H "X-Requested-By: 
ambari" -X GET  http://$ambari_address/api/v1/clusters/$cluster_name | head -n 
1)
+        if [ "HTTP/1.1 200 OK" == "$ret_status" ]; then
 
 Review comment:
   This check fails for me as the ret_status has trailing white space, an extra 
line of code before this worked for me 
   `ret_status ="$(echo -e "${ret_status}" | sed -e 's/[[:space:]]*$//')"`
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to