I'm unable to convert array of string to integer. I'm getting the following error undefined method map for "[\"118\", \"119\"]":String
.
Any idea how to resolve this?
def job_template_by_id
job_template_id = var_search(@handle.object, 'job_template_id') ||
var_search(@handle.object, 'dialog_job_template_id')
job_template_id = job_template_id.map(&:to_i)
@handle.vmdb(SCRIPT_CLASS).where(:id => job_template_id) if job_template_id
end
Error:
[----] E, [2022-07-07T16:08:09.928258 #534:2afb827cdb68] ERROR -- automation: Q-task_id([r837_miq_provision_2172]) <AEMethod launch_ansible_job> The following error occurred during method evaluation:
[----] E, [2022-07-07T16:08:09.930286 #534:2afb827cdb68] ERROR -- automation: Q-task_id([r837_miq_provision_2172]) <AEMethod launch_ansible_job> NoMethodError: undefined method `map' for "[\"118\", \"119\"]":String
[----] E, [2022-07-07T16:08:09.931630 #534:2afb827cdb68] ERROR -- automation: Q-task_id([r837_miq_provision_2172]) <AEMethod launch_ansible_job> /ManageIQ_Custom/AutomationManagement/AnsibleTower/Operations/StateMachines/Job/launch_ansible_job:113:in `job_template_by_id'
Aucun commentaire:
Enregistrer un commentaire