-
Notifications
You must be signed in to change notification settings - Fork 118
/
list_driver_isos.rb
45 lines (42 loc) · 1.45 KB
/
list_driver_isos.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
module ManageIQ
module Automate
module Infrastructure
module VM
module Transform
module Import
class ListDriverIsos
def initialize(handle = $evm)
@handle = handle
end
def main
values_hash = {}
values_hash[nil] = '-- select provider first --'
provider_id = @handle.root['dialog_provider']
if provider_id.present? && provider_id != '!'
provider = @handle.vmdb(:ext_management_system, provider_id)
unless provider.nil?
values_hash[nil] = '-- select drivers ISO from list --'
provider.iso_datastore.iso_images.pluck(:name).grep(/toolsSetup/).each do |iso|
values_hash[iso] = iso
end
end
end
list_values = {
'sort_by' => :description,
'data_type' => :string,
'required' => true,
'values' => values_hash,
'visible' => @handle.root['dialog_install_drivers']
}
list_values.each { |key, value| @handle.object[key] = value }
end
end
end
end
end
end
end
end
if __FILE__ == $PROGRAM_NAME
ManageIQ::Automate::Infrastructure::VM::Transform::Import::ListDriverIsos.new.main
end