Set service name when ordering a service?


#1

I saw in another post someone setting the service name when ordering a service. I attempted to do that but it is not having any impact? Is this possible and if so, what am I doing wrong? My service name always ends up the same as the service catalog item name. Any direction greatly appreciated!

{
“action” : “order”,
“resource” : {
“service_name” : “test-0001”,
“href” : “https://localhost/api/service_catalogs/100000000000001/service_templates/100000000000003”,
“param_fw_name” : “test.com”,
“param_instance_name” : “test-0001”,
“stack_name” : “test-0001”,
“stack_onfailure” : “ROLLBACK”,
“tenant_name” : “test”
}
}


#2

Hi tobmat

I’ve done this by adding the service name (and optionally description) as a dialog element to the service catalog item, and then specifying that as an optional parameter in the REST call.

If it helps there’s a generic ‘service_via_api.rb’ script here: https://github.com/pemcg/mastering-automation-in-cloudforms-and-manageiq/blob/4.1/darga/scripts/chapter42/scripts/service_via_api.rb that you can use or adapt. If you had dialog elements of ‘service_name’ and ‘service_description’, you could call it as follows:

~/service_via_api.rb -s miq01 --catalog ‘Generic Services’ --template ‘Generic RHEL VM’ -o service_name,“Intranet VM” -o service_description,‘Generic RHEL VM for intranet project’

Hope this helps,
pemcg


#3

Thank you pemcg!

This did help. I was using a heat template and the service dialog generated from it. In addition to adding the service_name as a dialog element I also had to change the default provisioning endpoint -
from
/Cloud/Orchestration/Provisioning/StateMachines/Provision/default
to
/Cloud/Orchestration/Provisioning/StateMachines/Provision/CatalogItemInitization

Thanks again, Toby