Skip to content

Commit 3f4ba6d

Browse files
authored
Merge pull request #107922 from lanicolas/patch-15
Aligning with Bash style guide
2 parents ab28ad3 + 9fbb14e commit 3f4ba6d

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

articles/hdinsight/hdinsight-authorize-users-to-ambari.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -130,31 +130,31 @@ Write-Output $zookeeperHosts
130130
Edit the variables below by replacing `CLUSTERNAME`, `ADMINPASSWORD`, `NEWUSER`, and `USERPASSWORD` with the appropriate values. The script is designed to be executed with bash. Slight modifications would be needed for a Windows command prompt.
131131

132132
```bash
133-
export clusterName="CLUSTERNAME"
134-
export adminPassword='ADMINPASSWORD'
135-
export user="NEWUSER"
136-
export userPassword='USERPASSWORD'
133+
export CLUSTER_NAME="CLUSTERNAME"
134+
export ADMIN_PASSWORD='ADMINPASSWORD'
135+
export USER="NEWUSER"
136+
export USER_PASSWORD='USERPASSWORD'
137137

138138
# create user
139-
curl -k -u admin:$adminPassword -H "X-Requested-By: ambari" -X POST \
140-
-d "{\"Users/user_name\":\"$user\",\"Users/password\":\"$userPassword\",\"Users/active\":\"true\",\"Users/admin\":\"false\"}" \
141-
https://$clusterName.azurehdinsight.net/api/v1/users
139+
curl -k -u admin:$ADMIN_PASSWORD -H "X-Requested-By: ambari" -X POST \
140+
-d "{\"Users/user_name\":\"$USER\",\"Users/password\":\"$USER_PASSWORD\",\"Users/active\":\"true\",\"Users/admin\":\"false\"}" \
141+
https://$CLUSTER_NAME.azurehdinsight.net/api/v1/users
142142

143-
echo "user created: $user"
143+
echo "user created: $USER"
144144

145145
# grant permissions
146-
curl -k -u admin:$adminPassword -H "X-Requested-By: ambari" -X POST \
147-
-d '[{"PrivilegeInfo":{"permission_name":"CLUSTER.USER","principal_name":"'$user'","principal_type":"USER"}}]' \
148-
https://$clusterName.azurehdinsight.net/api/v1/clusters/$clusterName/privileges
146+
curl -k -u admin:$ADMIN_PASSWORD -H "X-Requested-By: ambari" -X POST \
147+
-d '[{"PrivilegeInfo":{"permission_name":"CLUSTER.USER","principal_name":"'$USER'","principal_type":"USER"}}]' \
148+
https://$CLUSTER_NAME.azurehdinsight.net/api/v1/clusters/$CLUSTER_NAME/privileges
149149

150150
echo "Privilege is granted"
151151

152152
echo "Pausing for 100 seconds"
153153
sleep 10s
154154

155155
# perform query using new user account
156-
curl -k -u $user:$userPassword -H "X-Requested-By: ambari" \
157-
-X GET "https://$clusterName.azurehdinsight.net/api/v1/clusters/$clusterName/services/ZOOKEEPER/components/ZOOKEEPER_SERVER"
156+
curl -k -u $USER:$USER_PASSWORD -H "X-Requested-By: ambari" \
157+
-X GET "https://$CLUSTER_NAME.azurehdinsight.net/api/v1/clusters/$CLUSTER_NAME/services/ZOOKEEPER/components/ZOOKEEPER_SERVER"
158158
```
159159

160160
## Grant permissions to Apache Hive views

0 commit comments

Comments
 (0)