Hi,
I would like to share with you the problem we were facing when automating creation of groups via REST API. (ManageIQ hammer-4.20190329011451_d08635f )
The create request is done by shell script using curl command like this:
curl -s -k -H “Content-Type: application/json” -X POST --data “{“description” : “{NEW_GROUP_NAME}\", \"role\" : { \"id\" : \"{roleId}” }, “tenant” : { “href” : “{MIQ_BASE_URL}tenants/{tenantId}” }, “filters” : { “managed” : [ “/managed/visibility/ap_cld_tribe1_sqd1”, “/managed/visibility/all_groups”]}}” -u “{MIQ_USER}:{MIQ_PASSWORD}” “${MIQ_BASE_URL}groups”
The groups seemed to be created properly but in the ManageIQ console, you are unable to get their details when selecting one.
Checking DB, it shows that YAML is incorrectly formatted compared to the original groups created in the MIQ console:
new group:
original group:
In order to use the newly created groups properly, it is necessary to fix the DB afterwards by running DB update like this:
update entitlements set filters = REGEXP_REPLACE(filters,'managed:\n[^"]’,‘managed:’ || chr(10) || '- - ',‘g’) where filters ~ ‘managed:\n-’ and filters !~ ‘managed:\n- -’;*
update entitlements set filters = REGEXP_REPLACE(filters,’"\n-’,’"’ || chr(10)|| ’ - ',‘g’) where filters ~ ‘"\n- "’;
Anyone having same experience? Is there any other way to avoid this issue?
Thanks a lot!