From 1bf3aa8d5c5ca206c74c3795d94993d225789ac3 Mon Sep 17 00:00:00 2001 From: Ottavia Balducci Date: Fri, 9 Feb 2024 15:25:50 +0100 Subject: [PATCH] Ensure template_invocation is not nil --- app/services/foreman_ansible/inventory_creator.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/services/foreman_ansible/inventory_creator.rb b/app/services/foreman_ansible/inventory_creator.rb index 5e868687..4eca5c83 100644 --- a/app/services/foreman_ansible/inventory_creator.rb +++ b/app/services/foreman_ansible/inventory_creator.rb @@ -97,7 +97,7 @@ def ansible_extra_options(host) def remote_execution_options(host) params = { - 'ansible_user' => @template_invocation.job_invocation&.ssh_user || host_setting(host, 'remote_execution_ssh_user'), + 'ansible_user' => @template_invocation&.job_invocation&.ssh_user || host_setting(host, 'remote_execution_ssh_user'), 'ansible_become_method' => host_setting(host, 'remote_execution_effective_user_method'), 'ansible_ssh_private_key_file' => ansible_ssh_private_key(host), 'ansible_port' => host_setting(host, 'remote_execution_ssh_port'),