@@ -1031,12 +1031,11 @@ def method_form_fields
1031
1031
# ManageIQ::Providers::AnsibleTower::Provider.where('zone_id != ?', Zone.maintenance_zone.id)
1032
1032
list_of_managers = ManageIQ ::Providers ::ExternalAutomationManager
1033
1033
. where ( :enabled => true )
1034
- . pluck ( :id , :name )
1035
- . map { |r | { :id => r [ 0 ] , :name => r [ 1 ] } }
1034
+ . map { |provider | { :id => provider . id , :name => provider . name } }
1036
1035
1037
1036
if method &.options [ :ansible_template_id ]
1038
- manager_id = ManageIQ :: Providers :: ExternalAutomationManager :: ConfigurationScript
1039
- . find_by ( :id => method . options [ :ansible_template_id ] ) &.manager_id
1037
+ manager_class = get_template_class ( method . location )
1038
+ manager_id = manager_class . find_by ( :id => method . options [ :ansible_template_id ] ) &.manager_id
1040
1039
end
1041
1040
end
1042
1041
@@ -1844,6 +1843,14 @@ def ae_method_operations
1844
1843
1845
1844
private
1846
1845
1846
+ def get_template_class ( location )
1847
+ if location == "ansible_workflow_template"
1848
+ ManageIQ ::Providers ::ExternalAutomationManager ::ConfigurationWorkflow
1849
+ else
1850
+ ManageIQ ::Providers ::ExternalAutomationManager ::ConfigurationScript
1851
+ end
1852
+ end
1853
+
1847
1854
def feature_by_action
1848
1855
features_in_action = %w[
1849
1856
miq_ae_class_copy miq_ae_class_edit miq_ae_class_new
@@ -2819,13 +2826,15 @@ def get_method_node_info(node_id)
2819
2826
set_right_cell_text ( x_node , @record )
2820
2827
end
2821
2828
2822
- def fetch_manager_name ( ansible_template_id )
2829
+ def fetch_manager_name ( ansible_template_id , klass )
2823
2830
return nil if ansible_template_id . blank?
2824
2831
2825
- ManageIQ :: Providers :: ExternalAutomationManager :: ConfigurationScript . find_by ( :id => ansible_template_id ) &.manager &.name
2832
+ klass . find_by ( :id => ansible_template_id ) &.manager &.name
2826
2833
end
2827
2834
2828
2835
def fetch_playbook_details ( record )
2836
+ template_class = get_template_class ( record . location )
2837
+
2829
2838
options = record . options
2830
2839
details = {
2831
2840
:repository => fetch_name_from_object ( ManageIQ ::Providers ::EmbeddedAnsible ::AutomationManager ::ConfigurationScriptSource , options [ :repository_id ] ) ,
@@ -2837,12 +2846,12 @@ def fetch_playbook_details(record)
2837
2846
:hosts => options [ :hosts ] ,
2838
2847
:log_output => options [ :log_output ] ,
2839
2848
:ansible_template_id => options [ :ansible_template_id ] ,
2840
- :manager_name => fetch_manager_name ( options [ :ansible_template_id ] ) ,
2849
+ :manager_name => fetch_manager_name ( options [ :ansible_template_id ] , template_class ) ,
2841
2850
}
2842
2851
details [ :network_credential ] = fetch_name_from_object ( ManageIQ ::Providers ::EmbeddedAnsible ::AutomationManager ::NetworkCredential , options [ :network_credential_id ] ) if options [ :network_credential_id ]
2843
2852
details [ :cloud_credential ] = fetch_name_from_object ( ManageIQ ::Providers ::EmbeddedAnsible ::AutomationManager ::CloudCredential , options [ :cloud_credential_id ] ) if options [ :cloud_credential_id ]
2844
2853
details [ :vault_credential ] = fetch_name_from_object ( ManageIQ ::Providers ::EmbeddedAnsible ::AutomationManager ::VaultCredential , options [ :vault_credential_id ] ) if options [ :vault_credential_id ]
2845
- details [ :ansible_template ] = fetch_name_from_object ( ManageIQ :: Providers :: ExternalAutomationManager :: ConfigurationScript , options [ :ansible_template_id ] ) if options [ :ansible_template_id ]
2854
+ details [ :ansible_template ] = fetch_name_from_object ( template_class , options [ :ansible_template_id ] ) if options [ :ansible_template_id ]
2846
2855
details
2847
2856
end
2848
2857
0 commit comments