foreman_wreckingball 0.1.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -1
- data/app/controllers/foreman_wreckingball/hosts_controller.rb +15 -4
- data/app/helpers/concerns/foreman_wreckingball/hosts_helper_extensions.rb +1 -1
- data/app/jobs/update_hosts_vmware_facets.rb +1 -2
- data/app/lib/actions/foreman_wreckingball/host/refresh_vmware_facet.rb +5 -5
- data/app/lib/actions/foreman_wreckingball/host/remediate_vmware_operatingsystem.rb +39 -38
- data/app/lib/actions/foreman_wreckingball/vmware/sync_compute_resource.rb +12 -14
- data/app/lib/vsphere_os_identifiers/data.yaml +121 -10
- data/app/lib/vsphere_os_identifiers/os.rb +3 -2
- data/app/lib/vsphere_os_identifiers.rb +3 -2
- data/app/models/concerns/foreman_wreckingball/compute_resource_extensions.rb +1 -1
- data/app/models/concerns/foreman_wreckingball/host_extensions.rb +16 -3
- data/app/models/concerns/foreman_wreckingball/vmware_facet_host_extensions.rb +10 -6
- data/app/models/concerns/foreman_wreckingball/vmware_hypervisor_facet_host_extensions.rb +0 -3
- data/app/models/foreman_wreckingball/cpu_hot_add_status.rb +1 -1
- data/app/models/foreman_wreckingball/operatingsystem_status.rb +3 -3
- data/app/models/foreman_wreckingball/tools_status.rb +1 -1
- data/app/models/foreman_wreckingball/vmware_cluster.rb +15 -6
- data/app/models/foreman_wreckingball/vmware_facet.rb +5 -4
- data/app/models/foreman_wreckingball/vmware_hypervisor_facet.rb +2 -2
- data/app/services/foreman_wreckingball/vmware_cluster_importer.rb +6 -6
- data/app/services/foreman_wreckingball/vmware_hypervisor_importer.rb +7 -3
- data/config/routes.rb +1 -1
- data/lib/foreman_wreckingball/engine.rb +11 -8
- data/lib/foreman_wreckingball/scheduled_jobs.rb +1 -1
- data/lib/foreman_wreckingball/version.rb +1 -1
- data/lib/tasks/foreman_vmware_checks_tasks.rake +2 -4
- data/test/actions/foreman_wreckingball/host/refresh_vmware_facet_test.rb +57 -0
- data/test/actions/foreman_wreckingball/host/remediate_vmware_operatingsystem_test.rb +74 -0
- data/test/actions/foreman_wreckingball/vmware/schedule_vmware_sync_test.rb +27 -0
- data/test/actions/foreman_wreckingball/vmware/sync_compute_resource_test.rb +48 -0
- data/test/controllers/foreman_wreckingball/hosts_controller_test.rb +67 -0
- data/test/factories/compute_resource.rb +13 -0
- data/test/factories/foreman_wreckingball_factories.rb +45 -0
- data/test/factories/host.rb +38 -0
- data/test/models/compute_resource_test.rb +5 -0
- data/test/models/compute_resources/vmware_test.rb +12 -0
- data/test/models/foreman_wreckingball/cpu_hot_add_status_test.rb +86 -0
- data/test/models/foreman_wreckingball/operatingsystem_status_test.rb +95 -0
- data/test/models/foreman_wreckingball/tools_status_test.rb +55 -0
- data/test/models/foreman_wreckingball/vmware_cluster_test.rb +12 -0
- data/test/models/foreman_wreckingball/vmware_facet_test.rb +9 -0
- data/test/models/foreman_wreckingball/vmware_hypervisor_facet_test.rb +13 -0
- data/test/models/host_test.rb +10 -0
- data/test/test_plugin_helper.rb +3 -2
- data/test/unit/foreman_wreckingball/vmware_cluster_importer_test.rb +42 -0
- data/test/unit/foreman_wreckingball/vmware_hypervisor_importer_test.rb +72 -0
- metadata +48 -12
- data/test/unit/foreman_wreckingball_test.rb +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed7b165c08c4f0621f0c1b550730e4754f2cc8208ecc94705648536f5c0583aa
|
4
|
+
data.tar.gz: 31fe06c727fa67c07336d615204ca286f2de9f4905fba85bd97dd460faab4d08
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6a9951b05899b8657331428cf5f8afe9bd0a806f6aed6fb3354a60782d34ffc6dc2b5a0dc076551a6208ab9273f11a0205f299a569105a4b840b8aecb73982fe
|
7
|
+
data.tar.gz: b5989a99b88494efa790f6ece0b07f53c7d083111b55bd7a8941039c621a73d87f908908f3c0e3f8e51cf64a4415ac7f2c4aa2192f4715a7e4a0b6dfa2d72789
|
data/README.md
CHANGED
@@ -14,7 +14,14 @@ module ForemanWreckingball
|
|
14
14
|
|
15
15
|
@data = statuses.map do |status|
|
16
16
|
host_association = status.host_association
|
17
|
-
hosts = Host.authorized(:view_hosts, Host)
|
17
|
+
hosts = Host.authorized(:view_hosts, Host)
|
18
|
+
.joins(host_association)
|
19
|
+
.includes(host_association)
|
20
|
+
.joins(:vmware_facet)
|
21
|
+
.includes(host_association => :host)
|
22
|
+
.includes(:environment)
|
23
|
+
.preload(:owner)
|
24
|
+
.order(:name)
|
18
25
|
{
|
19
26
|
name: status.status_name,
|
20
27
|
hosts: hosts,
|
@@ -27,14 +34,18 @@ module ForemanWreckingball
|
|
27
34
|
|
28
35
|
def refresh_status_dashboard
|
29
36
|
flash[:success] = _('Refresh Compute Resource data task was successfully scheduled.')
|
30
|
-
task =
|
37
|
+
task = User.as_anonymous_admin do
|
38
|
+
::ForemanTasks.async_task(::Actions::ForemanWreckingball::Vmware::ScheduleVmwareSync)
|
39
|
+
end
|
31
40
|
redirect_to(foreman_tasks_task_path(task.id))
|
32
41
|
end
|
33
42
|
|
34
43
|
def remediate
|
35
|
-
raise Foreman::Exception
|
44
|
+
raise Foreman::Exception, 'VMware Status can not be remediated.' unless @status.class.respond_to?(:supports_remediate?) && @status.class.supports_remediate?
|
36
45
|
flash[:success] = _('Remediate VM task for %s was successfully scheduled.') % @host
|
37
|
-
task =
|
46
|
+
task = User.as_anonymous_admin do
|
47
|
+
::ForemanTasks.async_task(@status.class.remediate_action, @host)
|
48
|
+
end
|
38
49
|
redirect_to(foreman_tasks_task_path(task.id))
|
39
50
|
end
|
40
51
|
|
@@ -2,17 +2,17 @@ module Actions
|
|
2
2
|
module ForemanWreckingball
|
3
3
|
module Host
|
4
4
|
class RefreshVmwareFacet < Actions::EntryAction
|
5
|
+
middleware.use Actions::Middleware::KeepCurrentUser
|
6
|
+
|
5
7
|
def plan(host)
|
6
8
|
action_subject(host)
|
7
9
|
plan_self
|
8
10
|
end
|
9
11
|
|
10
12
|
def run
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
output[:state] = state
|
15
|
-
end
|
13
|
+
host = ::Host.find(input[:host][:id])
|
14
|
+
state = host.refresh_vmware_facet!
|
15
|
+
output[:state] = state
|
16
16
|
end
|
17
17
|
|
18
18
|
def rescue_strategy
|
@@ -2,62 +2,63 @@ module Actions
|
|
2
2
|
module ForemanWreckingball
|
3
3
|
module Host
|
4
4
|
class RemediateVmwareOperatingsystem < Actions::EntryAction
|
5
|
+
middleware.use Actions::Middleware::KeepCurrentUser
|
6
|
+
|
5
7
|
def plan(host)
|
6
8
|
action_subject(host)
|
7
9
|
plan_self
|
8
10
|
end
|
9
11
|
|
10
12
|
def run
|
11
|
-
|
12
|
-
host = ::Host.find(input[:host][:id])
|
13
|
-
|
14
|
-
fail _('Foreman does not know the Architecture of this host.') unless host.architecture
|
15
|
-
fail _('Foreman does not know the Operatingsystem of this host.') unless host.operatingsystem
|
13
|
+
host = ::Host.find(input[:host][:id])
|
16
14
|
|
17
|
-
|
18
|
-
|
15
|
+
fail _('Foreman does not know the Architecture of this host.') unless host.architecture
|
16
|
+
fail _('Foreman does not know the Operatingsystem of this host.') unless host.operatingsystem
|
19
17
|
|
20
|
-
|
18
|
+
initially_powered_on = host.power.ready?
|
19
|
+
output[:initially_powered_on] = initially_powered_on
|
21
20
|
|
22
|
-
|
23
|
-
|
24
|
-
vm.wait_for { power_state == 'poweredOff' }
|
25
|
-
end
|
26
|
-
|
27
|
-
fail _('Could not shut down VM.') if vm.ready?
|
21
|
+
current_os_id = host.vmware_facet.guest_id
|
22
|
+
current_os = VsphereOsIdentifiers.lookup(current_os_id)
|
28
23
|
|
29
|
-
|
30
|
-
|
24
|
+
selectors = {
|
25
|
+
:architecture => host.architecture.name,
|
26
|
+
:osfamily => host.operatingsystem.family,
|
27
|
+
:name => host.operatingsystem.name,
|
28
|
+
:major => host.operatingsystem.major.to_i,
|
29
|
+
:release => host.facts['os::release::full']
|
30
|
+
}
|
31
31
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
32
|
+
desired_os = VsphereOsIdentifiers.find_by(selectors)
|
33
|
+
desired_os ||= VsphereOsIdentifiers.find_by(selectors.except(:major))
|
34
|
+
desired_os ||= VsphereOsIdentifiers.find_by(selectors.except(:release))
|
35
|
+
desired_os ||= VsphereOsIdentifiers.find_by(selectors.except(:major, :release))
|
36
|
+
desired_os ||= VsphereOsIdentifiers.find_by(selectors.except(:major, :name))
|
37
|
+
desired_os ||= VsphereOsIdentifiers.find_by(selectors.except(:major, :name, :release))
|
38
38
|
|
39
|
-
|
40
|
-
desired_os ||= VsphereOsIdentifiers.find_by(selectors.except(:major))
|
41
|
-
desired_os ||= VsphereOsIdentifiers.find_by(selectors.except(:major, :name))
|
39
|
+
fail _('Could not auto detect desired operatingsystem.') unless desired_os
|
42
40
|
|
43
|
-
|
41
|
+
fail _('VMs current and desired OS (%s) already match. No update necessary.') % current_os.description if current_os == desired_os
|
44
42
|
|
45
|
-
|
43
|
+
output[:old_operatingsystem] = current_os.description
|
44
|
+
output[:old_operatingsystem_id] = current_os.id
|
45
|
+
output[:new_operatingsytem] = desired_os.description
|
46
|
+
output[:new_operatingsytem_id] = desired_os.id
|
46
47
|
|
47
|
-
|
48
|
-
output[:old_operatingsystem_id] = current_os.id
|
49
|
-
output[:new_operatingsytem] = desired_os.description
|
50
|
-
output[:new_operatingsytem_id] = desired_os.id
|
48
|
+
vm = host.compute_object
|
51
49
|
|
52
|
-
|
50
|
+
if initially_powered_on
|
51
|
+
vm.stop
|
52
|
+
vm.wait_for { power_state == 'poweredOff' }
|
53
|
+
fail _('Could not shut down VM.') if vm.ready?
|
54
|
+
end
|
53
55
|
|
54
|
-
|
55
|
-
vm.start
|
56
|
-
end
|
56
|
+
vm.vm_reconfig_hardware('guestId' => desired_os.id)
|
57
57
|
|
58
|
-
|
59
|
-
|
60
|
-
|
58
|
+
state = host.refresh_vmware_facet!
|
59
|
+
output[:state] = state
|
60
|
+
ensure
|
61
|
+
vm.start if vm && initially_powered_on
|
61
62
|
end
|
62
63
|
|
63
64
|
def humanized_name
|
@@ -2,26 +2,24 @@ module Actions
|
|
2
2
|
module ForemanWreckingball
|
3
3
|
module Vmware
|
4
4
|
class SyncComputeResource < Actions::EntryAction
|
5
|
+
middleware.use Actions::Middleware::KeepCurrentUser
|
6
|
+
|
5
7
|
def plan(compute_resource)
|
6
8
|
action_subject(compute_resource)
|
7
9
|
plan_self
|
8
10
|
end
|
9
11
|
|
10
12
|
def run
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
compute_resource.hosts.each do |host|
|
22
|
-
host.refresh_vmware_facet!
|
23
|
-
end
|
24
|
-
end
|
13
|
+
compute_resource = ComputeResource.find(input[:compute_resource][:id])
|
14
|
+
::ForemanWreckingball::VmwareClusterImporter.new(
|
15
|
+
:compute_resource => compute_resource
|
16
|
+
).import!
|
17
|
+
|
18
|
+
::ForemanWreckingball::VmwareHypervisorImporter.new(
|
19
|
+
:compute_resource => compute_resource.reload
|
20
|
+
).import!
|
21
|
+
|
22
|
+
compute_resource.hosts.each(&:refresh_vmware_facet!)
|
25
23
|
end
|
26
24
|
|
27
25
|
def humanized_name
|
@@ -23,12 +23,18 @@ centos6_64Guest:
|
|
23
23
|
:description: CentOS 6 (64-bit)
|
24
24
|
:architecture: x86_64
|
25
25
|
:since: 6.5
|
26
|
+
:osfamily: Redhat
|
27
|
+
:name: CentOS
|
28
|
+
:major: 6
|
26
29
|
centos64Guest:
|
27
30
|
:description: CentOS 4/5 (64-bit)
|
28
31
|
:architecture: x86_64
|
29
32
|
:since: 6.1
|
30
33
|
:osfamily: Redhat
|
31
34
|
:name: CentOS
|
35
|
+
:major:
|
36
|
+
- 4
|
37
|
+
- 5
|
32
38
|
centos6Guest:
|
33
39
|
:description: CentOS 6 (32-bit)
|
34
40
|
:architecture: i386
|
@@ -56,6 +62,9 @@ centosGuest:
|
|
56
62
|
:since: 4.1
|
57
63
|
:osfamily: Redhat
|
58
64
|
:name: CentOS
|
65
|
+
:major:
|
66
|
+
- 4
|
67
|
+
- 5
|
59
68
|
coreos64Guest:
|
60
69
|
:description: CoreOS Linux (64-bit)
|
61
70
|
:architecture: x86_64
|
@@ -108,58 +117,100 @@ darwinGuest:
|
|
108
117
|
debian10Guest:
|
109
118
|
:description: Debian GNU/Linux 10 (32-bit)
|
110
119
|
:architecture: i386
|
120
|
+
:major: 10
|
121
|
+
:name: Debian
|
122
|
+
:osfamily: Debian
|
111
123
|
:since: 6.5
|
112
124
|
debian10_64Guest:
|
113
125
|
:description: Debian GNU/Linux 10 (64-bit)
|
114
126
|
:architecture: x86_64
|
127
|
+
:major: 10
|
128
|
+
:name: Debian
|
129
|
+
:osfamily: Debian
|
115
130
|
:since: 6.5
|
116
131
|
debian4Guest:
|
117
132
|
:description: Debian GNU/Linux 4 (32-bit)
|
118
133
|
:architecture: i386
|
134
|
+
:major: 4
|
135
|
+
:name: Debian
|
136
|
+
:osfamily: Debian
|
119
137
|
:since: 4.0
|
120
138
|
debian4_64Guest:
|
121
139
|
:description: Debian GNU/Linux 5 (64-bit)
|
122
140
|
:architecture: x86_64
|
141
|
+
:major: 4
|
142
|
+
:name: Debian
|
143
|
+
:osfamily: Debian
|
123
144
|
:since: 4.0
|
124
145
|
debian5Guest:
|
125
146
|
:description: Debian GNU/Linux 5 (32-bit)
|
126
147
|
:architecture: i386
|
148
|
+
:major: 5
|
149
|
+
:name: Debian
|
150
|
+
:osfamily: Debian
|
127
151
|
:since: 4.0
|
128
152
|
debian5_64Guest:
|
129
153
|
:description: Debian GNU/Linux 5 (64-bit)
|
130
154
|
:architecture: x86_64
|
155
|
+
:major: 5
|
156
|
+
:name: Debian
|
157
|
+
:osfamily: Debian
|
131
158
|
:since: 4.0
|
132
159
|
debian6Guest:
|
133
160
|
:description: Debian GNU/Linux 6 (32-bit)
|
134
161
|
:architecture: i386
|
162
|
+
:major: 6
|
163
|
+
:name: Debian
|
164
|
+
:osfamily: Debian
|
135
165
|
:since: 5.0
|
136
166
|
debian6_64Guest:
|
137
167
|
:description: Debian GNU/Linux 6 (64-bit)
|
138
168
|
:architecture: x86_64
|
169
|
+
:major: 6
|
170
|
+
:name: Debian
|
171
|
+
:osfamily: Debian
|
139
172
|
:since: 5.0
|
140
173
|
debian7Guest:
|
141
174
|
:description: Debian GNU/Linux 7 (32-bit)
|
142
175
|
:architecture: i386
|
176
|
+
:major: 7
|
177
|
+
:name: Debian
|
178
|
+
:osfamily: Debian
|
143
179
|
:since: 5.5
|
144
180
|
debian7_64Guest:
|
145
181
|
:description: Debian GNU/Linux 7 (64-bit)
|
146
182
|
:architecture: x86_64
|
183
|
+
:major: 7
|
184
|
+
:name: Debian
|
185
|
+
:osfamily: Debian
|
147
186
|
:since: 5.5
|
148
187
|
debian8Guest:
|
149
188
|
:description: Debian GNU/Linux 8 (32-bit)
|
150
189
|
:architecture: i386
|
190
|
+
:major: 8
|
191
|
+
:name: Debian
|
192
|
+
:osfamily: Debian
|
151
193
|
:since: 6.0
|
152
194
|
debian8_64Guest:
|
153
195
|
:description: Debian GNU/Linux 8 (64-bit)
|
154
196
|
:architecture: x86_64
|
197
|
+
:major: 8
|
198
|
+
:name: Debian
|
199
|
+
:osfamily: Debian
|
155
200
|
:since: 6.0
|
156
201
|
debian9Guest:
|
157
202
|
:description: Debian GNU/Linux 9 (32-bit)
|
158
203
|
:architecture: i386
|
204
|
+
:major: 9
|
205
|
+
:name: Debian
|
206
|
+
:osfamily: Debian
|
159
207
|
:since: 6.5
|
160
208
|
debian9_64Guest:
|
161
209
|
:description: Debian GNU/Linux 9 (64-bit)
|
162
210
|
:architecture: x86_64
|
211
|
+
:major: 9
|
212
|
+
:name: Debian
|
213
|
+
:osfamily: Debian
|
163
214
|
:since: 6.5
|
164
215
|
dosGuest:
|
165
216
|
:description: Microsoft MS-DOS
|
@@ -436,103 +487,163 @@ vmwarePhoton64Guest:
|
|
436
487
|
|
437
488
|
win2000AdvServGuest:
|
438
489
|
:description: Microsoft Windows 2000 Advanced Server
|
490
|
+
:name: windows
|
439
491
|
win2000ProGuest:
|
440
492
|
:description: Microsoft Windows 2000 Professional
|
493
|
+
:name: windows
|
441
494
|
win2000ServGuest:
|
442
495
|
:description: Microsoft Windows 2000 Server
|
496
|
+
:name: windows
|
443
497
|
win31Guest:
|
444
498
|
:description: Microsoft Windows 3.1
|
499
|
+
:name: windows
|
445
500
|
win95Guest:
|
446
501
|
:description: Microsoft Windows 95
|
502
|
+
:name: windows
|
447
503
|
win98Guest:
|
448
504
|
:description: Microsoft Windows 98
|
505
|
+
:name: windows
|
449
506
|
winLonghorn64Guest:
|
450
507
|
:description: Microsoft Windows Longhorn (64-bit)
|
451
508
|
:architecture: x86_64
|
452
509
|
:since: 2.5
|
510
|
+
:name: windows
|
453
511
|
winLonghornGuest:
|
454
512
|
:description: Microsoft Windows Longhorn (32-bit)
|
455
513
|
:architecture: i386
|
456
514
|
:since: 2.5
|
515
|
+
:name: windows
|
457
516
|
winMeGuest:
|
458
517
|
:description: Microsoft Windows Millenium Edition
|
518
|
+
:name: windows
|
459
519
|
winNTGuest:
|
460
520
|
:description: Microsoft Windows NT
|
521
|
+
:name: windows
|
461
522
|
winNetBusinessGuest:
|
462
523
|
:description: Microsoft Windows Small Business Server 2003
|
524
|
+
:name: windows
|
463
525
|
winNetDatacenter64Guest:
|
464
526
|
:description: Microsoft Windows Server 2003 Datacenter Edition (64-bit)
|
465
|
-
:architecture:
|
527
|
+
:architecture: x64
|
466
528
|
:since: 2.5
|
529
|
+
:name: windows
|
467
530
|
winNetDatacenterGuest:
|
468
531
|
:description: Microsoft Windows Server 2003 Datacenter Edition (32-bit)
|
469
532
|
:architecture: i386
|
470
533
|
:since: 2.5
|
534
|
+
:name: windows
|
471
535
|
winNetEnterprise64Guest:
|
472
536
|
:description: Microsoft Windows Server 2003 Enterprise Edition (64-bit)
|
473
537
|
:architecture: x86_64
|
538
|
+
:name: windows
|
474
539
|
winNetEnterpriseGuest:
|
475
540
|
:description: Microsoft Windows Server 2003 Enterprise Edition (32-bit)
|
476
541
|
:architecture: i386
|
542
|
+
:name: windows
|
477
543
|
winNetStandard64Guest:
|
478
544
|
:description: Microsoft Windows Server 2003 Standard Edition (64-bit)
|
479
545
|
:architecture: x86_64
|
546
|
+
:name: windows
|
480
547
|
winNetStandardGuest:
|
481
548
|
:description: Microsoft Windows Server 2003 Standard Edition (32-bit)
|
482
549
|
:architecture: i386
|
550
|
+
:name: windows
|
483
551
|
winNetWebGuest:
|
484
552
|
:description: Microsoft Windows Server 2003 Web Edition (32-bit)
|
485
553
|
:architecture: i386
|
554
|
+
:name: windows
|
486
555
|
winVista64Guest:
|
487
556
|
:description: Microsoft Windows Vista (64-bit)
|
488
557
|
:architecture: x86_64
|
558
|
+
:name: windows
|
489
559
|
winVistaGuest:
|
490
560
|
:description: Microsoft Windows Vista (32-bit)
|
491
561
|
:architecture: i386
|
562
|
+
:name: windows
|
492
563
|
winXPHomeGuest:
|
493
564
|
:description: Microsoft Windows XP Home Edition
|
565
|
+
:name: windows
|
494
566
|
winXPPro64Guest:
|
495
567
|
:description: Microsoft Windows XP Professional (64-bit)
|
496
568
|
:architecture: x86_64
|
569
|
+
:name: windows
|
497
570
|
winXPProGuest:
|
498
571
|
:description: Microsoft Windows XP Professional (32-bit)
|
499
572
|
:architecture: i386
|
573
|
+
:name: windows
|
500
574
|
windows7Guest:
|
501
575
|
:description: Microsoft Windows 7 (32-bit)
|
502
576
|
:architecture: i386
|
577
|
+
:major: 6
|
578
|
+
:name: windows
|
579
|
+
:osfamily: Windows
|
503
580
|
:since: 4.0
|
504
581
|
windows7Server64Guest:
|
505
|
-
:description: Microsoft Windows Server 2008 R2 (64-bit)
|
506
|
-
:architecture:
|
582
|
+
:description: Microsoft Windows Server 2008/2008 R2 (64-bit)
|
583
|
+
:architecture: x64
|
584
|
+
:major: 6
|
585
|
+
:name: windows
|
586
|
+
:osfamily: Windows
|
587
|
+
:release:
|
588
|
+
- '2008'
|
589
|
+
- 2008 R2
|
507
590
|
:since: 4.0
|
508
591
|
windows7_64Guest:
|
509
592
|
:description: Microsoft Windows 7 (64-bit)
|
510
|
-
:architecture:
|
593
|
+
:architecture: x64
|
594
|
+
:major: 6
|
595
|
+
:name: windows
|
596
|
+
:osfamily: Windows
|
511
597
|
:since: 4.0
|
512
598
|
windows8Guest:
|
513
599
|
:description: Microsoft Windows 8 (32-bit)
|
514
600
|
:architecture: i386
|
601
|
+
:major: 6
|
602
|
+
:name: windows
|
603
|
+
:osfamily: Windows
|
515
604
|
:since: 5.0
|
516
605
|
windows8Server64Guest:
|
517
|
-
:description: Microsoft Windows Server 2012 (64-bit)
|
518
|
-
:architecture:
|
606
|
+
:description: Microsoft Windows Server 2012/2012 R2 (64-bit)
|
607
|
+
:architecture: x64
|
608
|
+
:major: 6
|
609
|
+
:name: windows
|
610
|
+
:osfamily: Windows
|
611
|
+
:release:
|
612
|
+
- '2012'
|
613
|
+
- 2012 R2
|
519
614
|
:since: 5.0
|
520
615
|
windows8_64Guest:
|
521
616
|
:description: Microsoft Windows 8 (64-bit)
|
522
|
-
:architecture:
|
617
|
+
:architecture: x64
|
618
|
+
:major: 6
|
619
|
+
:name: windows
|
620
|
+
:osfamily: Windows
|
523
621
|
:since: 5.0
|
524
622
|
windows9Guest:
|
525
623
|
:description: Microsoft Windows 10 (32-bit)
|
526
624
|
:architecture: i386
|
625
|
+
:major: 10
|
626
|
+
:name: windows
|
627
|
+
:osfamily: Windows
|
527
628
|
:since: 6.0
|
528
629
|
windows9Server64Guest:
|
529
|
-
:description: Microsoft Windows
|
530
|
-
:architecture:
|
630
|
+
:description: Microsoft Windows Server 2016/2016 R2 (64 bit)
|
631
|
+
:architecture: x64
|
632
|
+
:major: 10
|
633
|
+
:name: windows
|
634
|
+
:osfamily: Windows
|
635
|
+
:release:
|
636
|
+
- '2016'
|
637
|
+
- 2016 R2
|
531
638
|
:since: 6.0
|
532
639
|
windows9_64Guest:
|
533
640
|
:description: Microsoft Windows 10 (64-bit)
|
534
|
-
:architecture:
|
641
|
+
:architecture: x64
|
642
|
+
:major: 10
|
643
|
+
:name: windows
|
644
|
+
:osfamily: Windows
|
535
645
|
:since: 6.0
|
536
646
|
windowsHyperVGuest:
|
537
647
|
:description: Microsoft Windows Hyper-V
|
648
|
+
:name: windows
|
538
649
|
:since: 5.5
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module VsphereOsIdentifiers
|
2
2
|
class Os
|
3
|
-
attr_reader :id, :description, :architecture, :since, :osfamily, :major, :name
|
3
|
+
attr_reader :id, :description, :architecture, :since, :osfamily, :major, :name, :release
|
4
4
|
|
5
5
|
def initialize(id, opts = {})
|
6
6
|
@id = id.to_s
|
@@ -10,10 +10,11 @@ module VsphereOsIdentifiers
|
|
10
10
|
@osfamily = opts.fetch(:osfamily, nil)
|
11
11
|
@name = opts.fetch(:name, nil)
|
12
12
|
@major = opts.fetch(:major, nil)
|
13
|
+
@release = opts.fetch(:release, nil)
|
13
14
|
end
|
14
15
|
|
15
16
|
def ==(other)
|
16
|
-
other.class == self.class && other.id ==
|
17
|
+
other.class == self.class && other.id == id
|
17
18
|
end
|
18
19
|
end
|
19
20
|
end
|
@@ -20,8 +20,9 @@ module VsphereOsIdentifiers
|
|
20
20
|
found = all
|
21
21
|
|
22
22
|
selectors.each do |selector, value|
|
23
|
-
next unless selectors.
|
24
|
-
|
23
|
+
next unless selectors.key?(selector) && !value.nil?
|
24
|
+
|
25
|
+
found.select! { |os| os.public_send(selector) && [os.public_send(selector)].flatten.include?(value) }
|
25
26
|
end
|
26
27
|
found
|
27
28
|
end
|
@@ -5,7 +5,7 @@ module ForemanWreckingball
|
|
5
5
|
|
6
6
|
included do
|
7
7
|
has_many :vmware_clusters, :class_name => 'ForemanWreckingball::VmwareCluster',
|
8
|
-
|
8
|
+
:inverse_of => :compute_resource, :dependent => :destroy
|
9
9
|
end
|
10
10
|
|
11
11
|
def action_input_key
|
@@ -1,11 +1,24 @@
|
|
1
1
|
module ForemanWreckingball
|
2
2
|
module HostExtensions
|
3
3
|
extend ActiveSupport::Concern
|
4
|
+
include ForemanTasks::Concerns::ActionSubject
|
4
5
|
|
5
6
|
included do
|
6
|
-
has_one :vmware_tools_status_object,
|
7
|
-
|
8
|
-
|
7
|
+
has_one :vmware_tools_status_object,
|
8
|
+
:class_name => 'ForemanWreckingball::ToolsStatus',
|
9
|
+
:foreign_key => 'host_id',
|
10
|
+
:inverse_of => :host,
|
11
|
+
:dependent => :destroy
|
12
|
+
has_one :vmware_operatingsystem_status_object,
|
13
|
+
:class_name => 'ForemanWreckingball::OperatingsystemStatus',
|
14
|
+
:foreign_key => 'host_id',
|
15
|
+
:inverse_of => :host,
|
16
|
+
:dependent => :destroy
|
17
|
+
has_one :vmware_cpu_hot_add_status_object,
|
18
|
+
:class_name => 'ForemanWreckingball::CpuHotAddStatus',
|
19
|
+
:foreign_key => 'host_id',
|
20
|
+
:inverse_of => :host,
|
21
|
+
:dependent => :destroy
|
9
22
|
end
|
10
23
|
|
11
24
|
def action_input_key
|
@@ -9,17 +9,21 @@ module ForemanWreckingball
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def refresh_vmware_facet!
|
12
|
-
facet =
|
12
|
+
facet = vmware_facet || build_vmware_facet
|
13
13
|
facet.refresh!
|
14
14
|
facet.persisted? && facet.refresh_statuses
|
15
15
|
end
|
16
16
|
|
17
17
|
def queue_vmware_facet_refresh
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
18
|
+
if managed? && compute? && provider == 'VMware'
|
19
|
+
User.as_anonymous_admin do
|
20
|
+
ForemanTasks.delay(
|
21
|
+
::Actions::ForemanWreckingball::Host::RefreshVmwareFacet,
|
22
|
+
{ :start_at => Time.now.utc + 5.minutes },
|
23
|
+
self
|
24
|
+
)
|
25
|
+
end
|
26
|
+
end
|
23
27
|
true
|
24
28
|
end
|
25
29
|
end
|
@@ -5,9 +5,6 @@ module ForemanWreckingball
|
|
5
5
|
included do
|
6
6
|
has_one :vmware_hypervisor_facet, :class_name => '::ForemanWreckingball::VmwareHypervisorFacet', :foreign_key => :host_id, :inverse_of => :host, :dependent => :destroy
|
7
7
|
has_one :vmware_cluster, :through => :vmware_hypervisor_facet
|
8
|
-
|
9
|
-
#scoped_search :on => :last_report, :relation => :omaha_facet, :complete_value => true, :only_explicit => true, :rename => :last_omaha_report
|
10
|
-
#scoped_search :on => :machineid, :relation => :omaha_facet, :rename => :omaha_machineid, :complete_value => true
|
11
8
|
end
|
12
9
|
end
|
13
10
|
end
|