Skip to content

Commit 32bce10

Browse files
committed
Fixed issue with cookies and appdynamics saas
1 parent 3d87e04 commit 32bce10

File tree

4 files changed

+23
-3
lines changed

4 files changed

+23
-3
lines changed

adc.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22
ADC_VERSION="v0.3.0"
3-
ADC_LAST_COMMIT="a4e1a87c70f8289cfd228f076ff783563c960dea"
3+
ADC_LAST_COMMIT="3d87e045974500038f0d5dc50084d7872fd2c4bb"
44
USER_CONFIG="$HOME/.appdynamics/adc/config.sh"
55
GLOBAL_CONFIG="/etc/appdynamics/adc/config.sh"
66
CONFIG_CONTROLLER_COOKIE_LOCATION="/tmp/appdynamics-controller-cookie.txt"
@@ -338,7 +338,7 @@ function controller_login {
338338
COMMAND_RESULT="Controller Login Error! Please check hostname and credentials"
339339
CONTROLLER_LOGIN_STATUS=0
340340
fi
341-
XCSRFTOKEN=$(tail -1 $CONFIG_CONTROLLER_COOKIE_LOCATION | awk 'NF>1{print $NF}')
341+
XCSRFTOKEN=$(grep "X-CSRF-TOKEN" $CONFIG_CONTROLLER_COOKIE_LOCATION | awk 'NF>1{print $NF}')
342342
debug "XCSRFTOKEN: $XCSRFTOKEN"
343343
}
344344
register controller_login Login to your controller
@@ -589,6 +589,13 @@ register bt_list List all business transactions for a given application
589589
describe bt_list << EOF
590590
List all business transactions for a given application. Provide the application id as parameter.
591591
EOF
592+
function server_list {
593+
apiCall -X GET "/controller/sim/v2/user/machines" "$@"
594+
}
595+
register server_list List all servers
596+
describe server_list << EOF
597+
List all servers
598+
EOF
592599
function tier_list {
593600
apiCall -X GET "/controller/rest/applications/\${a}/tiers" "$@"
594601
}

commands/controller/login.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ function controller_login {
1313
COMMAND_RESULT="Controller Login Error! Please check hostname and credentials"
1414
CONTROLLER_LOGIN_STATUS=0
1515
fi
16-
XCSRFTOKEN=$(tail -1 $CONFIG_CONTROLLER_COOKIE_LOCATION | awk 'NF>1{print $NF}')
16+
XCSRFTOKEN=$(grep "X-CSRF-TOKEN" $CONFIG_CONTROLLER_COOKIE_LOCATION | awk 'NF>1{print $NF}')
1717
debug "XCSRFTOKEN: $XCSRFTOKEN"
1818
}
1919

commands/server/list.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
3+
function server_list {
4+
apiCall -X GET "/controller/sim/v2/user/machines" "$@"
5+
}
6+
7+
register server_list List all servers
8+
9+
describe server_list << EOF
10+
List all servers
11+
EOF

main.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ source ./commands/application/export.sh
7272

7373
source ./commands/bt/list.sh
7474

75+
source ./commands/server/list.sh
76+
7577
source ./commands/tier/list.sh
7678
source ./commands/tier/get.sh
7779
source ./commands/tier/nodes.sh

0 commit comments

Comments
 (0)