Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

provision_new_vms_to_service: NoMethodError: undefined method `miq_request_tasks' for nil:NilClass #166

Open
sigbjornaib opened this issue Mar 28, 2020 · 4 comments

Comments

@sigbjornaib
Copy link
Contributor

I have added a button pointing at "/ Service / Operations / Methods / provision_new_vms_to_service". When I use the button on a Service, I receive the following error message in the automate.log:

NoMethodError: undefined method `miq_request_tasks' for nil:NilClass

This occurs in the "create_provision_request_from_service_template_provision_task" function, when it is looking for "origional_vm_task = task.miq_request_tasks.first.miq_request_tasks.first".

The task var is:
task = $evm.vmdb('service_template_provision_task').find_by_destination_id(service.id)

The task is found, but there are no miq_request_tasks association with the task.

The Service I am using does have a VM attached to it. The Service and VM was provisioned using the code from RedHatConsulting_Satellite6 and RedHatConsulting_Utilities.

@itewk
Copy link
Collaborator

itewk commented Mar 30, 2020

@A-Beck @curt-matthews can you engage here.

@A-Beck
Copy link
Collaborator

A-Beck commented Mar 30, 2020

@sigbjornaib What version of CloudForms are you working with?

I'm not familiar with this method, but I do have some suggestions I'd like you to try.

Could you update: origional_vm_task = task.miq_request_tasks.first.miq_request_tasks.first

to

origional_vm_task = task.miq_request.miq_request_tasks.first

Making that update, I was able to get a non-nil task returned and able to populate the source VM template and service options, which should help get to the next step.

Adding a dump_object on the original VM task and uploading the message here would also be helpful for debugging.

dump_object('origional_vm_task', origional_vm_task)

Thanks!

Andrew

@sigbjornaib
Copy link
Contributor Author

We are on CloudForms 4.7, CFME 5.10.15.

Changing that var brings be a bit further. The "origional_vm_task_options = origional_vm_task.options" seem to resolve successfully. However the "source_miq_provision_request_template_options = task.miq_request_tasks.first.service_resource.resource.options" fails.

I would prefer not to place the information you request on this public fora. May I send it to you via email?

NoMethodError: undefined method service_resource' for nil:NilClass <AEMethod provision_new_vms_to_service> /AIB_Dev/Service/Operations/Methods/provision_new_vms_to_service:71:in create_provision_request_from_service_template_provision_task'
Method STDERR: /AIB_Dev/Service/Operations/Methods/provision_new_vms_to_service:71:in create_provision_request_from_service_template_provision_task': undefined method service_resource' for nil:NilClass (NoMethodError)
Method STDERR: #011from /AIB_Dev/Service/Operations/Methods/provision_new_vms_to_service:200:in `

'

@A-Beck
Copy link
Collaborator

A-Beck commented Apr 6, 2020

@sigbjornaib Apologies for the delay. Yes, feel free to email me at anbecker at redhat dot com.

Testing in my environment, updating to task.miq_request_tasks.first.miq_request_tasks.first.service_resource is a valid method, but always returns nil.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants