(its not a qustion of formatting script is working locally!)
hope someone can help here :-) i have created some action scripts to configure my HDinsight cluster but one of them keep failing for no apparent reason, have tried looking in the "/var/lib/ambari-agent/data" folder but no errors relating to this, so hope someone could help to explain why. script:
#!/bin/bash
#Headnode only run from one machine s
HEADNODE=hn0
while (( $#> 0));do
if [ $1 = "admin" ]
then
#set admin credentials for ambari
ambariadminuser=$1
ambariadminpass=$2
else
#create Ambari user
#only run on headnode
if hostname | grep $HEADNODE 2>&1 > /dev/null
then
echo "Adding user $1 to Ambari dashboard"
curl -iv -u admin:$ambariadminpass -H "X-Requested-By: ambari" -X POST -d '{"Users/user_name":"'$1'","Users/password":"'$2'","Users/active":"true","Users/admin":"true"}' http://hn0-test:8080/api/v1/users
else
echo "This is not the headnode"
fi
fi
shift 3
done
the script takes a string containing names and passwords for Ambari users, also it contains a cert which is not used in this case (shift 3). to run locally use ( ./test.sh 'admin' 'adminpass' 'empty' 'testuser' 'userpassword' 'empty') but it fails using:
Submit-AzureRmHDInsightScriptAction -ClusterName $clusterName `
-Name $scriptActionName `
-Uri $scriptActionUri `
-NodeTypes $nodeTypes `
-Parameters $Parameterstring `
-PersistOnSuccess