foreman_nutanix 0.0.5 → 0.0.7

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f2fe33e8b9f7999fbd374d6dfa10f3c52005004299dfe6b7003c297d46e46d3a
4
- data.tar.gz: ca98e7a92c0a5867d1c637d41e825df7c840e515098f75246a6d2fe7cc57a5fd
3
+ metadata.gz: a292c029d7f973982d12a55659ec8c47e260d72cc21d6ca386cabd9a123c775d
4
+ data.tar.gz: 1353579dcfae3a08f561a7eac402f29d04b8ebc155481a56e21e9fccfc5d2602
5
5
  SHA512:
6
- metadata.gz: 48bd46610653b7629b1c28c1cd3fceb44bd65e3131d36964c1b6f9376db1810d116a935072f31aa074faaefbcf8d94cd6d27baaabf1dc4035719bc66b2a0686e
7
- data.tar.gz: 45a9ee8ce535a062ed664264533ecb17e28e24c5b8eec1956d27dfd9dbbfa82d288e0b0b1bfcb24d5d4458b84fa800d335eb47ecf47c9290f25b5997da18a2f0
6
+ metadata.gz: 2c6d4c8ddc93b7eb4f2e36f1a36faeec837a143bee49d82b1f38434c74a044b0283b4eb83b0c8254616160386bb8fb6276a4cb9482d8622a3db73b0deaca51b7
7
+ data.tar.gz: 57c2f460081bf7b5f0270df7a52b7c6f91307e08569cc338a4b79b403bc98177da3133411a06a80f891067488c1b9a46553c67f37a48b34cea2b2566bafb9d63
@@ -1,5 +1,7 @@
1
1
  module ForemanNutanix
2
2
  class NutanixAdapter
3
+ include Enumerable
4
+
3
5
  def initialize(cluster)
4
6
  Rails.logger.info "=== NUTANIX: NutanixAdapter::initialize cluster=#{cluster} ==="
5
7
  @cluster = cluster
@@ -57,6 +59,9 @@ module ForemanNutanix
57
59
  boot_method: data['boot_method'],
58
60
  secure_boot: data['secure_boot'],
59
61
  gpus: data['gpus'],
62
+ disk_size_gb: data['disk_size_bytes'].to_i / (1024**3),
63
+ network_id: data['network_id'],
64
+ storage_container: data['container_id'],
60
65
  })
61
66
  vm.instance_variable_set(:@persisted, true)
62
67
  vm
@@ -100,6 +105,7 @@ module ForemanNutanix
100
105
  mac_address: vm_data['mac_address'],
101
106
  ip_addresses: vm_data['ip_addresses'] || [],
102
107
  create_time: vm_data['create_time'],
108
+ disk_size_gb: vm_data['disk_size_bytes'].to_i / (1024**3),
103
109
  })
104
110
  vm.instance_variable_set(:@persisted, true)
105
111
  vm
@@ -425,7 +425,8 @@ module ForemanNutanix
425
425
  # Associate host with VM
426
426
  def associated_host(vm)
427
427
  Rails.logger.info "=== NUTANIX: ASSOCIATED_HOST CALLED for vm: #{vm.name} ==="
428
- associate_by('ip', [vm.vm_ip_address, vm.private_ip_address])
428
+ macs = vm.interfaces.map(&:mac)
429
+ associate_by('mac', macs)
429
430
  end
430
431
 
431
432
  # User data support
@@ -17,12 +17,17 @@ compute_resource.available_images,
17
17
  help_inline: _("Operating system image to use (optional)"),
18
18
  } %>
19
19
 
20
+ <%# NOTE: If we're on a Host Edit page - show the selected
21
+ # network by not having a 'include_blank'. Once
22
+ # editing is implemented, this might be able to go away. %>
23
+ <% include_blank =
24
+ f.object.class == "ForemanNutanix::NutanixCompute" ? nil : _("Select Network") %>
20
25
  <%= select_f f,
21
26
  :network_id,
22
27
  compute_resource.available_networks,
23
28
  :id,
24
29
  :name,
25
- { include_blank: _("Select Network") },
30
+ { include_blank: include_blank, selected: f.object.try(:network_id) },
26
31
  { label: _("Network"), help_inline: _("Network/subnet for the VM") } %>
27
32
 
28
33
  <%= select_f f,
@@ -30,7 +35,10 @@ compute_resource.available_networks,
30
35
  compute_resource.available_storage_containers,
31
36
  :id,
32
37
  :name,
33
- { include_blank: _("Select Storage Container") },
38
+ {
39
+ include_blank: _("Select Container"),
40
+ selected: f.object.try(:storage_container),
41
+ },
34
42
  {
35
43
  label: _("Storage Container"),
36
44
  help_inline: _("Storage container for VM disks"),
@@ -1,3 +1,3 @@
1
1
  module ForemanNutanix
2
- VERSION = '0.0.5'.freeze
2
+ VERSION = '0.0.7'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_nutanix
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miles Granger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-12-09 00:00:00.000000000 Z
11
+ date: 2025-12-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rdoc