foreman_azure_rm 2.2.5 → 2.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/concerns/foreman_azure_rm/vm_extensions/managed_vm.rb +8 -0
- data/app/models/foreman_azure_rm/azure_rm.rb +12 -1
- data/app/models/foreman_azure_rm/azure_rm_compute.rb +4 -1
- data/app/views/compute_resources_vms/form/azurerm/_base.html.erb +7 -0
- data/lib/foreman_azure_rm/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c5017c30e0067522ca79641d307a2aaef0073ee2c60eb2ec26bf7ca88c72047
|
4
|
+
data.tar.gz: e62b30ff6d8594136a724e0995ba7b5de4b14832cd015996d3186f0a1f4daaff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 944bbf2ce53335d33f7ed2f97ac4658408546458103be05ce6cd94bb7cc8f273d49d233adf2cbd7a137154437c0188749123e8ec73eff4d446b59a4d7f068677
|
7
|
+
data.tar.gz: 676ed07015b420ace8897695ba252f387577ab4b2b55d1bff62b97381ff3b53aac6ac57af99104351ec068af01af44f90770a54100a7aef1de148be039538278
|
@@ -176,6 +176,14 @@ module ForemanAzureRm
|
|
176
176
|
logger.debug msg
|
177
177
|
vm_create_params = ComputeModels::VirtualMachine.new.tap do |vm|
|
178
178
|
vm.location = vm_hash[:location]
|
179
|
+
vm.tags = {}
|
180
|
+
unless vm_hash[:tags].nil?
|
181
|
+
arr = vm_hash[:tags].split(',')
|
182
|
+
arr.each do |item|
|
183
|
+
kv = item.split('=')
|
184
|
+
vm.tags[kv[0].strip] = kv[1].strip
|
185
|
+
end
|
186
|
+
end
|
179
187
|
unless vm_hash[:availability_set_id].nil?
|
180
188
|
sub_resource = MsRestAzure::SubResource.new
|
181
189
|
sub_resource.id = vm_hash[:availability_set_id]
|
@@ -59,7 +59,7 @@ module ForemanAzureRm
|
|
59
59
|
end
|
60
60
|
|
61
61
|
def ensure_attributes_and_values
|
62
|
-
validate_region
|
62
|
+
validate_region if validate_cloud?
|
63
63
|
end
|
64
64
|
|
65
65
|
def validate_region
|
@@ -67,6 +67,15 @@ module ForemanAzureRm
|
|
67
67
|
errors.add(:region, "is not valid, must be lowercase eg. 'eastus'. No special characters allowed.") unless regions.collect(&:second).include?(region)
|
68
68
|
end
|
69
69
|
|
70
|
+
def validate_cloud?
|
71
|
+
valid_clouds = ['azure', 'azureusgovernment', 'azurechina', 'azuregermancloud']
|
72
|
+
unless valid_clouds.include?(cloud)
|
73
|
+
errors.add(:cloud, "is not valid. Valid choices are #{valid_clouds.join(", ")}.")
|
74
|
+
return false
|
75
|
+
end
|
76
|
+
true
|
77
|
+
end
|
78
|
+
|
70
79
|
def self.model_name
|
71
80
|
ComputeResource.model_name
|
72
81
|
end
|
@@ -321,6 +330,7 @@ module ForemanAzureRm
|
|
321
330
|
script_command: args[:script_command],
|
322
331
|
script_uris: args[:script_uris],
|
323
332
|
nvidia_gpu_extension: args[:nvidia_gpu_extension],
|
333
|
+
tags: args[:tags],
|
324
334
|
)
|
325
335
|
logger.debug "Virtual Machine #{args[:vm_name]} Created Successfully."
|
326
336
|
# request NVIDIA GPU driver and CUDA stack
|
@@ -339,6 +349,7 @@ module ForemanAzureRm
|
|
339
349
|
script_command: user_command,
|
340
350
|
script_uris: args[:script_uris],
|
341
351
|
nvidia_gpu_extension: Foreman::Cast.to_bool(args[:nvidia_gpu_extension]),
|
352
|
+
tags: args[:tags],
|
342
353
|
)
|
343
354
|
rescue RuntimeError => e
|
344
355
|
Foreman::Logging.exception('Unhandled AzureRm error', e)
|
@@ -7,6 +7,7 @@ module ForemanAzureRm
|
|
7
7
|
attr_accessor :script_command, :script_uris
|
8
8
|
attr_accessor :nvidia_gpu_extension
|
9
9
|
attr_accessor :volumes
|
10
|
+
attr_accessor :tags
|
10
11
|
|
11
12
|
delegate :name, to: :azure_vm, allow_nil: true
|
12
13
|
|
@@ -17,7 +18,8 @@ module ForemanAzureRm
|
|
17
18
|
volumes: [],
|
18
19
|
script_command: nil,
|
19
20
|
script_uris: nil,
|
20
|
-
nvidia_gpu_extension: false
|
21
|
+
nvidia_gpu_extension: false,
|
22
|
+
tags: [])
|
21
23
|
|
22
24
|
@azure_vm = azure_vm
|
23
25
|
@sdk = sdk
|
@@ -27,6 +29,7 @@ module ForemanAzureRm
|
|
27
29
|
@script_command ||= script_command
|
28
30
|
@script_uris ||= script_uris
|
29
31
|
@nvidia_gpu_extension ||= nvidia_gpu_extension
|
32
|
+
@tags ||= tags
|
30
33
|
@azure_vm.hardware_profile ||= ComputeModels::HardwareProfile.new
|
31
34
|
@azure_vm.os_profile ||= ComputeModels::OSProfile.new
|
32
35
|
@azure_vm.os_profile.linux_configuration ||= ComputeModels::LinuxConfiguration.new
|
@@ -185,6 +185,13 @@
|
|
185
185
|
}
|
186
186
|
%>
|
187
187
|
|
188
|
+
<%= text_f f, :tags,
|
189
|
+
{
|
190
|
+
:label => _('Azure Tags'),
|
191
|
+
:label_help => _('Comma seperated list of name=value pairs for tags on this VM in Azure')
|
192
|
+
}
|
193
|
+
%>
|
194
|
+
|
188
195
|
<%= checkbox_f f, :nvidia_gpu_extension,
|
189
196
|
{
|
190
197
|
:label => _('NVIDIA driver / CUDA'),
|
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman_azure_rm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aditi Puntambekar
|
8
8
|
- Shimon Shtein
|
9
9
|
- Tyler Gregory
|
10
|
-
autorequire:
|
10
|
+
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2021-
|
13
|
+
date: 2021-11-11 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: azure_mgmt_resources
|
@@ -201,7 +201,7 @@ homepage: https://github.com/theforeman/foreman_azure_rm
|
|
201
201
|
licenses:
|
202
202
|
- GPL-3.0
|
203
203
|
metadata: {}
|
204
|
-
post_install_message:
|
204
|
+
post_install_message:
|
205
205
|
rdoc_options: []
|
206
206
|
require_paths:
|
207
207
|
- lib
|
@@ -217,7 +217,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
217
217
|
version: '0'
|
218
218
|
requirements: []
|
219
219
|
rubygems_version: 3.1.6
|
220
|
-
signing_key:
|
220
|
+
signing_key:
|
221
221
|
specification_version: 4
|
222
222
|
summary: Azure Resource Manager as a compute resource for The Foreman
|
223
223
|
test_files: []
|