cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2682
Views
5
Helpful
5
Replies

boot strapping with user-data can't handle quotes in command

isaacunifio
Level 1
Level 1

We currently have the Cisco CSR 1000V deployed in the AWS environment and utilize the user-data field for bootstrapping our automated deployments. So far we have had no issues with utilizing the user-data format outlined in the Documentation. We recently needed to make some customizations to the logging configuration specifically adding logging origin-id and wanted to use a custom string that included spaces. In order to include a custom string with spaces you are required to surround/delimit the string with quotes. 

A working example of this is shown below if entered on config t mode or in a running configuration of a CSR1000v 

hostname Router-Hostname
service timestamps debug datetime msec year
service timestamps log datetime msec year
logging trap debugging
logging facility syslog
logging origin-id string "host='Router-Hostname' random-other-string"

Which would translate to below when supplying as user-data for bootstrapping: 

ios-config-0001="hostname Router-Hostname"

ios-config-0002="service timestamps debug datetime msec year"
ios-config-0003="service timestamps log datetime msec year"
ios-config-0004="logging trap debugging"
ios-config-0005="logging facility syslog"
ios-config-0006="logging origin-id string "host='Router-Hostname' random-other-string""

The issue is that the above userdata causes the CSR1000V to fail first boot. There are no error messages or console information provided however the moment I remove the quotes the issue is no longer seen. I suspect that there are limitations to the characters allowed in the userdata format.

As mentioned if the commands are entered into a running CSR1000V no issues are seen and the behavior is as expected. 

Is there any way to debug the parsing of the user-data provided during first boot? Is there another means for me to boot strap the above command that will behave as expected, perhaps escaping the quotes or something? Every time I try to test an alternative I have to wait 15 minutes to find out that it will fail since the CSR takes often times more then 10 minutes to boot. 

Thanks, 

Daniel 

5 Replies 5

Fan Yang
Level 1
Level 1

Hi Daniel,

Have a try on this

ios-config-0006="logging origin-id string \"host='Router-Hostname' random-other-string\""

Thanks

Fan

Hi,

doesnt work for me either.

The " is needed for directly adding the csr_mgmt EEM restart template or the CSR HA EEM directly with CloudFormation.

Any new ideas here ?

Hi Daniel,

How about ios-config-0006="logging origin-id string \"host=\'Router-Hostname\' random-other-string\""

Thanks

Fan

Hi Daniel,

I know this is probably too late for you, but in case anyone come across this post. I have found the escape. You have to use XML escape if you want to pass special characters.

ampersand (&) is escaped to &
double quotes (") are escaped to "
single quotes (') are escaped to ' 
less than (<) is escaped to &lt; 
greater than (>) is escaped to &gt;

Please use &quot; for " and &apos; for '

In your case

ios-config-0006="logging origin-id string &quot;host=&apos;Router-Hostname&apos; random-other-string&quot;"

Thanks

Fan

Fan,

 

Thank you so much for this! I have spent several days looking for a solution to this problem. Your XML escape work perfectly!

 

Thanks,

 

Chris