f5devcentral / f5-puppet

Puppet modules for F5 BIG-IP
Apache License 2.0
13 stars 27 forks source link

unexpected argument when trying to add a '|' as a string in a datagroup #25

Closed matthew-on-git closed 6 years ago

matthew-on-git commented 6 years ago

the error when running puppet device -v --user=root:

ERROR:/F5_datagroup[/Common/test2_bl_escape_characters]/ensure: change from absent to present failed: Could not set 'present' on ensure: REST failure: HTTP status code 400 detected. Body of failure is: {"code":400,"message":"unexpected argument \"|\"","errorStack":[],"apiError":26214401} at /global_datagroups.pp:111

The relevant code is: f5_datagroup { '/Common/test2_bl_escape_characters': ensure => 'present', type => 'string', records => [ { 'data' => '!', 'name' => '!' }, { 'data' => '$', 'name' => '$' }, { 'data' => ';', 'name' => ';' }, { 'data' => '<', 'name' => '<' }, { 'data' => '>', 'name' => '>' }, { 'data' => '\\', 'name' => '\\' }, { 'data' => '\|', 'name' => '\|' } ], }

From what it looks like, I need to escape the | with something. I've tried '|' and '\|' both. I got the code from exporting an existing datagroup with puppet resource , so it should "just work".

ericzji commented 6 years ago

@matthewmdn Your issue is about how to handle the data group special characters. Please allow me to reach out to F5 REST API team, and will get back to you.

ericzji commented 6 years ago

@matthewmdn The workaround is to add an extra space to the end of the value, in your case: { 'data' => '\ ', 'name' => '\ ' }, { 'data' => '| ', 'name' => '| ' },

thanks

matthew-on-git commented 6 years ago

Great! I'll give it a try

matthew-on-git commented 6 years ago

That did it

ericzji commented 6 years ago

Excellent