I’ve been trying to create a service template that deploys a discovered AWS EC2 AMI via the REST API. I’m having no luck and I’ve been trying for days. I’d really appreciate any help on this.
I’m using the following URL https://miq/api/service_templates (POST) and supplying it:
{
“name”: “My Atomic Service Template2”,
“service_type”: “atomic”,
“prov_type”: “amazon”,
“display”: false,
“config_info”: {
“service_template_request”: true,
“provision_type”: [“amazon”, “Amazon”],
“customize_enabled”: [“enabled”],
“miq_request_dialog_name”: “miq_provision_amazon_dialogs_template”,
“catalog_id”: “3”,
“st_prov_type”: “amazon”,
“service_type”: “atomic”,
“dialog_id”: “2”,
“placement_auto”: [true, 1],
“number_of_vms”: [1, “1”],
“src_vm_id”: [25842, “Windows 10 RS2 ENT en_us (x64)”],
“vm_name”: “test_rest_aRZlFIJa3ZAAA”,
“schedule_type”: [“immediately”, “Immediately on Approval”],
“src_ems_id”: [2, “AWS (Ireland)”],
“provision”: {
“fqname”: “/Service/Provisioning/StateMachines/ServiceProvision_Template/CatalogItemInitialization”,
“dialog_id”: “4”
},
“retirement”: {
“fqname”: “/Service/Retirement/StateMachines/ServiceRetirement/Default”,
“dialog_id”: “4”
}
}
}
I get the following error though:
“error”: {
“kind”: “bad_request”,
“message”: “Could not create Service Template - undefined method ``base_class’ for FalseClass:Class”,
“klass”: “Api::BadRequestError”
}
}
I’ve read and tired various examples:
- http://manageiq.org/docs/reference/latest/api/reference/services#service-add-provider-vms
- https://bugzilla.redhat.com/show_bug.cgi?id=1226456#c6
Nothing seems to work. The interesting thing is that if I omit the “src_vm_id” I get a created service template in the UI, but the “Request” tabs are not visible and the UI will not allow me to edit the service template.
Thanks
James.