update_alias_name.sh script not working
search cancel

update_alias_name.sh script not working

book

Article ID: 381220

calendar_today

Updated On:

Products

CA Performance Management

Issue/Introduction

At running update_alias_name.sh script to update components, the script does not raise any error but AlternateName column in the data base is not updated

After some troubleshooting the request to setComponentNameAlias endpoint raises a "415 Unsupported Media Type" error

The reason is the curl command misses the Content-Type header to specify the payload is in XML format

After adding the parameter -H "Content-Type: application/xml" to the curl command the request works fine and the entries in the data base are updated

I assume the same issue applies to other curl commands in the script

Environment

Dx NetOps Performance Management any version

Cause

The script does not use Content-Type

Resolution

Example update

Referring to line 272 in the update_alias_name.sh script 
Here is the original line:

curl -k -s -X put "$httpscheme://$HOST_NAME:$httpport/pc/center/webservice/devices/deviceItemId/$devId/setComponentNameAlias" -u $USER:$PASSWORD -T $dataFile >> /tmp/update.out


Here is the updated working line:
curl -k -s -H "Content-Type: application/xml" -X put "$httpscheme://$HOST_NAME:$httpport/pc/center/webservice/devices/deviceItemId/$devId/setComponentNameAlias" -u $USER:$PASSWORD -T $dataFile >> /tmp/update.out