Bug 1561604

Summary: Cannot create service template using the API
Product: Red Hat CloudForms Management Engine Reporter: Lucy Fu <lufu>
Component: AutomateAssignee: Lucy Fu <lufu>
Status: CLOSED CURRENTRELEASE QA Contact: Parthvi Vala <pvala>
Severity: high Docs Contact:
Priority: high    
Version: 5.9.0CC: cpelland, lufu, mkanoor, obarenbo, pvala, tfitzger
Target Milestone: GAKeywords: TestOnly, ZStream
Target Release: 5.10.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 5.10.0.0 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1562779 (view as bug list) Environment:
Last Closed: 2019-02-11 14:01:53 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1562779    

Description Lucy Fu 2018-03-28 15:11:05 UTC
Description of problem:

I am trying to create a service template via the API and getting the error":
`{"error":{"kind":"bad_request","message":"Could not create Service Template - wrong number of arguments (given 2, expected 1)","klass":"Api::BadRequestError"}}'


Version-Release number of selected component (if applicable):


How reproducible:

Detail can be found in GitHub issue: https://github.com/ManageIQ/manageiq/issues/17211

Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 4 Parthvi Vala 2018-10-30 14:07:39 UTC
Verified on 5.10.0.21.20181023151612_4c11b0d.

After adding the container provider to the appliance, I fired this query mentioned in the issue(https://github.com/ManageIQ/manageiq/issues/17211).

POST: https://<ip_address>/api/service_templates
Request: {
  "name":"Test4",
  "description":"Test",
  "type":"ServiceTemplateContainerTemplate",
  "service_template_id":null,
  "service_type":"atomic",
  "prov_type":"generic_container_template",
  "config_info": {
    "provision": {
      "container_template_id":"24",
      "dialog_id":"10000000002",
      "fqname":"/Service/Generic/StateMachines/GenericLifecycle/provision"
    }
  }
}

Response: {
	"results": [
		{
			"href": "https://<ip_address>/api/service_templates/6",
			"id": "6",
			"name": "Test4",
			"description": "Test",
			"guid": "f0275b62-0e89-4bcf-b9d6-78bc53e91261",
			"type": "ServiceTemplateContainerTemplate",
			"service_template_id": null,
			"options": {
				"config_info": {
					"provision": {
						"container_template_id": "24",
						"dialog_id": "10000000002",
						"fqname": "/Service/Generic/StateMachines/GenericLifecycle/provision"
					}
				}
			},
			"created_at": "2018-10-30T13:56:17Z",
			"updated_at": "2018-10-30T13:56:17Z",
			"display": null,
			"evm_owner_id": null,
			"miq_group_id": "2",
			"service_type": "atomic",
			"prov_type": "generic_container_template",
			"provision_cost": null,
			"service_template_catalog_id": null,
			"long_description": null,
			"tenant_id": "1",
			"generic_subtype": null,
			"deleted_on": null,
			"internal": false
		}
	]
}

After sending the request, I checked the UI and the service template was create without any error. But when I tried to edit the item, I was unable to do so. I'm not sure if that's the expected behavior for this query. Let me know if the behavior is fine or if I'm doing something wrong.

Comment 5 Lucy Fu 2018-10-30 14:25:18 UTC
Sounds like you were able to create the service template via API calls. So this issue has been fixed and verified.

You may open another BZ if there is an issue to edit the service template. Please provide the information to re-create the issue in the BZ.

Thanks.

Comment 6 Parthvi Vala 2018-10-30 14:58:53 UTC
I think using `container_template_id` in the query caused this issue.

Marking this BZ as verified.