@@ -95,15 +95,15 @@ def catalog_tab_content(key_name, &block)
9595
9696 def catalog_basic_information ( record , sb_params , tenants_tree )
9797 prov_types = catalog_provision_types
98- prov_data = [ prov_types [ :template ] , prov_types [ :ovf ] ] . include? ( record . prov_type ) && catalog_provision? ( record , :playbook ) ? provisioning : nil
98+ prov_data = [ prov_types [ :template ] , prov_types [ :ovf ] ] . include? ( record . prov_type ) && ( catalog_provision? ( record , :playbook ) || catalog_provision? ( record , :terraform_template ) ) ? provisioning : nil
9999 data = { :title => _ ( 'Basic Information' ) , :mode => "miq_catalog_basic_information" }
100100 rows = [ ]
101101 rows . push ( row_data ( _ ( 'Name' ) , record . name ) )
102102 rows . push ( row_data ( _ ( 'Description' ) , record . description ) )
103103 rows . push ( row_data ( _ ( 'Display in Catalog' ) , { :input => "checkbox" , :name => "display" , :checked => record . display , :disabled => true , :label => '' } ) )
104104 rows . push ( row_data ( _ ( 'Catalog' ) , record . service_template_catalog ? record . service_template_catalog . name : _ ( 'Unassigned' ) ) )
105105 rows . push ( row_data ( _ ( 'Zone' ) , record . zone ? record . zone . name : '' ) ) unless record . composite?
106- rows . push ( row_data ( _ ( 'Dialog' ) , sb_params [ :dialog_label ] ) ) unless catalog_provision? ( record , :playbook )
106+ rows . push ( row_data ( _ ( 'Dialog' ) , sb_params [ :dialog_label ] ) ) unless catalog_provision? ( record , :playbook ) || catalog_provision? ( record , :terraform_template )
107107 rows . push ( row_data ( _ ( "Price / Month (in %{currency})" ) % { :currency => record . currency . code } , record . price ) ) if record . currency
108108 rows . push ( row_data ( _ ( 'Item Type' ) , _ ( ServiceTemplate . all_catalog_item_types [ record . prov_type ] ) ) ) if record . prov_type
109109 rows . push ( row_data ( _ ( 'Subtype' ) , _ ( ServiceTemplate ::GENERIC_ITEM_SUBTYPES [ record [ :generic_subtype ] ] ) || _ ( "Custom" ) ) ) if catalog_provision? ( record , :generic )
@@ -118,7 +118,7 @@ def catalog_basic_information(record, sb_params, tenants_tree)
118118 rows . push ( row_data ( _ ( 'Container Template' ) , provision_data ( prov_data , :template_name ) ) )
119119 end
120120
121- unless catalog_provision? ( record , :playbook )
121+ unless catalog_provision? ( record , :playbook ) || catalog_provision? ( record , :terraform_template )
122122 entry_points = [ [ _ ( "Provisioning" ) , :fqname ] ]
123123 unless record . prov_type . try ( :start_with? , "generic_" )
124124 entry_points . push ( [ _ ( "Reconfigure" ) , :reconfigure_fqname ] , [ _ ( "Retirement" ) , :retire_fqname ] )
@@ -184,21 +184,31 @@ def catalog_resources(record)
184184 miq_structured_list ( data )
185185 end
186186
187- def catalog_generic_ansible_playbook_info ( type , record , info )
187+ def catalog_generic_template_info ( type , record , info )
188188 list_type = type == :provision ? 'provisioning' : 'retirement'
189189 data = { :title => "#{ list_type . camelize } %s" % _ ( 'Info' ) , :mode => "miq_catalog_playbook_info" }
190190 rows = [ ]
191191 rows . push ( row_data ( _ ( 'Repository' ) , info [ :repository ] ) )
192- rows . push ( row_data ( _ ( 'Playbook' ) , info [ :playbook ] ) )
193- rows . push ( row_data ( _ ( 'Machine Credential' ) , info [ :machine_credential ] ) )
194- rows . push ( row_data ( _ ( 'Vault Credential' ) , info [ :vault_credential ] ) )
195- rows . push ( row_data ( _ ( 'Vault Credential' ) , info [ :vault_credential ] ) )
196- rows . push ( row_data ( _ ( 'Cloud Credential' ) , info [ :cloud_credential ] ) )
197- rows . push ( row_data ( _ ( 'Max TTL (mins)' ) , record . config_info [ type ] [ :execution_ttl ] ) )
198- rows . push ( row_data ( _ ( 'Hosts' ) , record . config_info [ type ] [ :hosts ] ) )
199- rows . push ( row_data ( _ ( 'Logging Output' ) , ViewHelper ::LOG_OUTPUT_LEVELS [ info [ :log_output ] ] ) )
200- rows . push ( row_data ( _ ( 'Escalate Privilege' ) , info [ :become_enabled ] ) )
201- rows . push ( row_data ( _ ( 'Verbosity' ) , _ ( ViewHelper ::VERBOSITY_LEVELS [ info [ :verbosity ] ] ) ) )
192+ if record . type == 'ServiceTemplateAnsiblePlaybook'
193+ rows . push ( row_data ( _ ( 'Playbook' ) , info [ :playbook ] ) )
194+ rows . push ( row_data ( _ ( 'Machine Credential' ) , info [ :machine_credential ] ) )
195+ rows . push ( row_data ( _ ( 'Vault Credential' ) , info [ :vault_credential ] ) )
196+ rows . push ( row_data ( _ ( 'Vault Credential' ) , info [ :vault_credential ] ) )
197+ rows . push ( row_data ( _ ( 'Cloud Credential' ) , info [ :cloud_credential ] ) )
198+ rows . push ( row_data ( _ ( 'Max TTL (mins)' ) , record . config_info [ type ] [ :execution_ttl ] ) )
199+ rows . push ( row_data ( _ ( 'Hosts' ) , record . config_info [ type ] [ :hosts ] ) )
200+ rows . push ( row_data ( _ ( 'Logging Output' ) , ViewHelper ::LOG_OUTPUT_LEVELS [ info [ :log_output ] ] ) )
201+ rows . push ( row_data ( _ ( 'Escalate Privilege' ) , info [ :become_enabled ] ) )
202+ rows . push ( row_data ( _ ( 'Verbosity' ) , _ ( ViewHelper ::VERBOSITY_LEVELS [ info [ :verbosity ] ] ) ) )
203+ else
204+ rows . push ( row_data ( _ ( 'Template' ) , info [ :template ] ) )
205+ rows . push ( row_data ( _ ( 'Credential' ) , info [ :credential ] ) )
206+ rows . push ( row_data ( _ ( 'Max TTL (mins)' ) , record . config_info [ type ] [ :execution_ttl ] ) )
207+ rows . push ( row_data ( _ ( 'Logging Output' ) , ViewHelper ::LOG_OUTPUT_LEVELS [ info [ :log_output ] ] ) )
208+ rows . push ( row_data ( _ ( 'Escalate Privilege' ) , info [ :become_enabled ] ) )
209+ rows . push ( row_data ( _ ( 'Verbosity' ) , _ ( ViewHelper ::VERBOSITY_LEVELS [ info [ :verbosity ] ] ) ) )
210+ data [ :rows ] = rows
211+ end
202212 data [ :rows ] = rows
203213 miq_structured_list ( data )
204214 end
@@ -238,12 +248,13 @@ def catalog_dialog(provisioning)
238248 end
239249
240250 def catalog_provision_types
241- { :generic => "generic" ,
242- :orchestration => "generic_orchestration" ,
243- :ovf => "generic_ovf_template" ,
244- :playbook => "generic_ansible_playbook" ,
245- :tower => "generic_ansible_tower" ,
246- :template => "generic_container_template" } . freeze
251+ { :generic => "generic" ,
252+ :orchestration => "generic_orchestration" ,
253+ :ovf => "generic_ovf_template" ,
254+ :playbook => "generic_ansible_playbook" ,
255+ :terraform_template => "generic_terraform_template" ,
256+ :tower => "generic_ansible_tower" ,
257+ :template => "generic_container_template" } . freeze
247258 end
248259
249260 private
@@ -257,8 +268,8 @@ def catalog_tab_conditions(record)
257268 :detail => record . display && !record . prov_type . try ( :start_with? , "generic_" ) ,
258269 :resource => record . composite? ,
259270 :request => !record . prov_type || ( record . prov_type && need_prov_dialogs? ( record . prov_type ) ) ,
260- :provision => record . prov_type == catalog_provision_types [ :playbook ] ,
261- :retirement => record . config_info . fetch_path ( :retirement )
271+ :provision => record . prov_type == catalog_provision_types [ :playbook ] || record . prov_type == catalog_provision_types [ :terraform_template ] ,
272+ :retirement => record . prov_type == catalog_provision_types [ :terraform_template ] ? nil : record . config_info . fetch_path ( :retirement )
262273 }
263274 end
264275
0 commit comments