foreman_azure_rm 1.3.1 → 2.0.0.pre1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,24 +0,0 @@
1
- module FogExtensions
2
- module AzureRM
3
- module DataDisk
4
- extend ActiveSupport::Concern
5
-
6
- def self.prepended base
7
- base.instance_eval do
8
- def parse(disk)
9
- hash = {}
10
- hash['name'] = disk.name
11
- hash['disk_size_gb'] = disk.disk_size_gb
12
- hash['lun'] = disk.lun
13
- unless disk.vhd.nil?
14
- hash['vhd_uri'] = disk.vhd.uri
15
- end
16
- hash['caching'] = disk.caching unless disk.caching.nil?
17
- hash['create_option'] = disk.create_option
18
- hash
19
- end
20
- end
21
- end
22
- end
23
- end
24
- end
@@ -1,10 +0,0 @@
1
- module FogExtensions
2
- module AzureRM
3
- module ManagedDisk
4
- extend ActiveSupport::Concern
5
-
6
- attr_accessor :data_disk_caching
7
-
8
- end
9
- end
10
- end
@@ -1,15 +0,0 @@
1
- module FogExtensions
2
- module AzureRM
3
- module ManagedDisks
4
- extend ActiveSupport::Concern
5
-
6
- def new(attr = {})
7
- if resource_group
8
- super({:resource_group => resource_group}.merge(attr))
9
- else
10
- super
11
- end
12
- end
13
- end
14
- end
15
- end
@@ -1,19 +0,0 @@
1
- module FogExtensions
2
- module AzureRM
3
- module NetworkInterface
4
- extend ActiveSupport::Concern
5
-
6
- attr_accessor :network
7
- attr_accessor :bridge
8
-
9
- def new(attr = {})
10
- if resource_group
11
- super({:resource_group => resource_group}.merge(attr))
12
- else
13
- super
14
- end
15
- end
16
-
17
- end
18
- end
19
- end
@@ -1,16 +0,0 @@
1
- module FogExtensions
2
- module AzureRM
3
- module NetworkInterfaces
4
- extend ActiveSupport::Concern
5
-
6
- def new(attr = {})
7
- if resource_group
8
- super({:resource_group => resource_group}.merge(attr))
9
- else
10
- super
11
- end
12
- end
13
-
14
- end
15
- end
16
- end
@@ -1,131 +0,0 @@
1
- module FogExtensions
2
- module AzureRM
3
- module Server
4
- extend ActiveSupport::Concern
5
-
6
- attr_accessor :os_disk_size
7
- attr_accessor :premium_os_disk
8
- attr_accessor :data_disk_caching
9
- attr_accessor :os_disk_caching
10
- attr_accessor :image_id
11
- attr_accessor :puppet_master
12
- attr_accessor :script_command
13
- attr_accessor :script_uris
14
-
15
- def ready?
16
- vm_status == 'running'
17
- end
18
-
19
- def state
20
- vm_status
21
- end
22
-
23
- def self.prepended base
24
- base.instance_eval do
25
- def parse(vm)
26
- hash = {}
27
- hash['id'] = vm.id
28
- hash['name'] = vm.name
29
- hash['location'] = vm.location
30
- hash['resource_group'] = get_resource_group_from_id(vm.id)
31
- hash['vm_size'] = vm.hardware_profile.vm_size unless vm.hardware_profile.vm_size.nil?
32
- unless vm.storage_profile.nil?
33
- hash['os_disk_name'] = vm.storage_profile.os_disk.name
34
- hash['os_disk_caching'] = vm.storage_profile.os_disk.caching
35
- unless vm.storage_profile.os_disk.vhd.nil?
36
- hash['os_disk_vhd_uri'] = vm.storage_profile.os_disk.vhd.uri
37
- hash['storage_account_name'] = hash['os_disk_vhd_uri'].split('/')[2].split('.')[0]
38
- end
39
- unless vm.storage_profile.image_reference.nil?
40
- unless vm.storage_profile.image_reference.publisher.nil?
41
- hash['publisher'] = vm.storage_profile.image_reference.publisher
42
- hash['offer'] = vm.storage_profile.image_reference.offer
43
- hash['sku'] = vm.storage_profile.image_reference.sku
44
- hash['version'] = vm.storage_profile.image_reference.version
45
- end
46
- end
47
- end
48
-
49
- hash['disable_password_authentication'] = false
50
-
51
- unless vm.os_profile.nil?
52
- hash['username'] = vm.os_profile.admin_username
53
- hash['custom_data'] = vm.os_profile.custom_data
54
- hash['disable_password_authentication'] = vm.os_profile.linux_configuration.disable_password_authentication unless vm.os_profile.linux_configuration.nil?
55
- if vm.os_profile.windows_configuration
56
- hash['provision_vm_agent'] = vm.os_profile.windows_configuration.provision_vmagent
57
- hash['enable_automatic_updates'] = vm.os_profile.windows_configuration.enable_automatic_updates
58
- end
59
- end
60
-
61
- hash['data_disks'] = []
62
- unless vm.storage_profile.data_disks.nil?
63
- vm.storage_profile.data_disks.each do |disk|
64
- data_disk = Fog::Storage::AzureRM::DataDisk.new
65
- hash['data_disks'] << data_disk.merge_attributes(Fog::Storage::AzureRM::DataDisk.parse(disk))
66
- end
67
- end
68
-
69
- hash['network_interface_card_ids'] = vm.network_profile.network_interfaces.map(&:id)
70
- hash['availability_set_id'] = vm.availability_set.id unless vm.availability_set.nil?
71
-
72
- hash
73
- end
74
- end
75
- end
76
-
77
- def interfaces_attributes=(attrs)
78
- ;
79
- end
80
-
81
- def provisioning_ip_address
82
- interfaces.each do |nic|
83
- nic.ip_configurations.each do |configuration|
84
- next unless configuration.primary
85
- if configuration.public_ipaddress.present?
86
- ip_id = configuration.public_ipaddress.id
87
- ip_rg = ip_id.split('/')[4]
88
- ip_name = ip_id.split('/')[-1]
89
- public_ip = service.get_public_ip(ip_rg, ip_name)
90
- return public_ip.ip_address
91
- else
92
- return configuration.private_ipaddress
93
- end
94
- end
95
- end
96
- end
97
-
98
- def interfaces
99
- interfaces = []
100
- unless attributes[:network_interface_card_ids].nil?
101
- attributes[:network_interface_card_ids].each do |nic_id|
102
- nic_rg = nic_id.split('/')[4]
103
- nic_name = nic_id.split('/')[-1]
104
- interfaces << service.get_vm_nic(nic_rg, nic_name)
105
- end
106
- end
107
- interfaces
108
- end
109
-
110
- def volumes_attributes=(attrs)
111
- ;
112
- end
113
-
114
- def volumes
115
- volumes = []
116
- unless attributes[:data_disks].nil?
117
- attributes[:data_disks].each do |disk|
118
- volumes << disk
119
- end
120
- end
121
- volumes
122
- end
123
-
124
- def stop
125
- power_off
126
- deallocate
127
- end
128
-
129
- end
130
- end
131
- end
@@ -1,23 +0,0 @@
1
- module FogExtensions
2
- module AzureRM
3
- module Servers
4
- extend ActiveSupport::Concern
5
-
6
- included do
7
- alias_method_chain :all, :patched_arguments
8
- alias_method_chain :get, :patched_arguments
9
- end
10
-
11
- def all_with_patched_arguments(_options = {})
12
- all_without_patched_arguments
13
- end
14
-
15
- def get_with_patched_arguments(uuid)
16
- raw_vm = service.list_all_vms.find { |vm| vm.name == uuid }
17
- virtual_machine_fog = Fog::Compute::AzureRM::Server.new(service: service)
18
- vm_hash = Fog::Compute::AzureRM::Server.parse(raw_vm)
19
- virtual_machine_fog.merge_attributes(vm_hash)
20
- end
21
- end
22
- end
23
- end
@@ -1,22 +0,0 @@
1
- <%= number_f f, :disk_size_gb,
2
- {
3
- :class => "col-md-2",
4
- :label => _("Size (GB)"), :label_size => "col-md-2",
5
- :required => true
6
- }
7
- %>
8
-
9
- <%= checkbox_f f, :account_type, {
10
- :label => _("Premium Disk"), :label_size => "col-md-2"},
11
- 'true',
12
- 'false'
13
- %>
14
-
15
- <%= selectable_f f, :data_disk_caching, %w(None ReadOnly ReadWrite),
16
- { },
17
- {
18
- :label => _('Data Caching'),
19
- :required => true,
20
- :class => "col-md-2"
21
- }
22
- %>