idrac 0.7.9 → 0.7.10

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: e60a1c39738e830b95e2e0c29ad603ab9c57966535ca40374b31cc37315f4138
4
- data.tar.gz: 6b007a005002ff5eaf88561c3e6d717c1c6d51715aa6a994a4b72e86f1f6e2c8
3
+ metadata.gz: ada89d6fb4827e57600dda32ff7a93124b526ee3986335fb593c2a61ea767d29
4
+ data.tar.gz: 4237b089a51941b56524e3d4341835b5c60c36b365cfff9e74f90faa43bf0fad
5
5
  SHA512:
6
- metadata.gz: 2b3014bfeb1061b6506fb9025885283015d7cd6a87868c41c832de71fdd5428dd96d6f16eb18aa2ea20ede8cb4d58d87d4f2922c2fed10958ad33ebc533469c4
7
- data.tar.gz: f20ddd6b1be1f3105aead4387865e9b556cda333df23ba944915aa7805d83a28fef85a0acc7c33456b4d102d9f707dc0d4a70db470dd6726bfea08eaefd2ffd7
6
+ metadata.gz: 7a5367ff256299d380a8be3d9b1f284051e96ac415e377667e8118cb0511b138fa7a0c3644a1d48c69bba74e5d812cd0046add67a4a1b0d7913b482de9b03d87
7
+ data.tar.gz: ddc6e9496009474248636fe2037b6aa721bb9f50a333937835062f02aad4ed7fff46f098a824b0ef1eabe3c704e2584261d08e150f426e4c778886a56a7c164b
data/lib/idrac/boot.rb CHANGED
@@ -356,7 +356,7 @@ module IDRAC
356
356
  else
357
357
  response = authenticated_request(:get, "/redfish/v1/Systems/System.Embedded.1/Bios")
358
358
  json = JSON.parse(response.body)
359
- raise "Error reading HddPlaceholder setup" if json&.dig('SystemConfiguration').blank?
359
+ raise "Error reading HddPlaceholder setup" if json&.dig('Attributes','HddPlaceholder').blank?
360
360
  json["Attributes"]["HddPlaceholder"] == "Enabled"
361
361
  end
362
362
  end
@@ -371,7 +371,7 @@ module IDRAC
371
371
  else
372
372
  response = authenticated_request(:get, "/redfish/v1/Systems/System.Embedded.1/Bios")
373
373
  json = JSON.parse(response.body)
374
- raise "Error reading PowerControl setup" if json&.dig('SystemConfiguration').blank?
374
+ raise "Error reading PowerControl setup" if json&.dig('Attributes').blank?
375
375
  json["Attributes"]["ProcCStates"] == "Enabled" &&
376
376
  json["Attributes"]["SysProfile"] == "PerfPerWattOptimizedOs" &&
377
377
  json["Attributes"]["ProcPwrPerf"] == "OsDbpm"
data/lib/idrac/client.rb CHANGED
@@ -190,8 +190,7 @@ module IDRAC
190
190
  begin
191
191
  conn.options.timeout = timeout if timeout
192
192
  conn.options.open_timeout = open_timeout if open_timeout
193
-
194
- conn.run_request(method, path.sub(/^\//, ''), body, headers)
193
+ conn.run_request(method, path, body, headers)
195
194
  ensure
196
195
  conn.options.timeout = original_timeout
197
196
  conn.options.open_timeout = original_open_timeout
@@ -13,12 +13,13 @@ module IDRAC
13
13
  debug "Detected iDRAC version: #{idrac_version}", 1
14
14
 
15
15
  # Use version-specific methods
16
- if idrac_version > 9
16
+ if idrac_version >= 9
17
17
  debug "Using modern approach for iDRAC > 9", 1
18
18
  return get_lifecycle_status_modern_firmware
19
- elsif idrac_version == 9
20
- debug "Using registry approach for iDRAC 9", 1
21
- return get_lifecycle_status_from_registry
19
+ # This may have been one particularly odd oldish iDRAC 9
20
+ # elsif idrac_version == 9
21
+ # debug "Using registry approach for iDRAC 9", 1
22
+ # return get_lifecycle_status_from_registry
22
23
  else
23
24
  debug "Using SCP approach for older iDRAC (v#{idrac_version})", 1
24
25
  return get_lifecycle_status_from_scp
@@ -57,7 +58,7 @@ module IDRAC
57
58
  return false
58
59
  rescue => e
59
60
  debug "Error getting Lifecycle Controller status from SCP: #{e.message}", 1, :red
60
- debug e.backtrace.join("\n"), 3, :red
61
+ debug e.backtrace.join("\n"), 10, :red
61
62
  return false
62
63
  end
63
64
  end
@@ -75,9 +76,11 @@ module IDRAC
75
76
  # This is the attribute we want:
76
77
  target = attributes&.dig('RegistryEntries', 'Attributes')&.find {|q| q['AttributeName'] =~ /LCAttributes.1.LifecycleControllerState/ }
77
78
  # This is the FQDN of the attribute we want to get the value of:
78
- fqdn = target.dig('Id') # LifecycleController.Embedded.1#LCAttributes.1#LifecycleControllerState
79
+ fqdn = target.dig('Id') # LifecycleController.Embedded.1#LCAttributes.1#LifecycleControllerState
80
+ subpath = fqdn.gsub(/#.*$/,'') # Remove everything # and onwards
79
81
  # This is the Current Value:
80
- response = authenticated_request(:get, "/redfish/v1/Managers/iDRAC.Embedded.1/Oem/Dell/DellAttributes/#{fqdn}")
82
+ response = authenticated_request(:get, "/redfish/v1/Managers/iDRAC.Embedded.1/Oem/Dell/DellAttributes/#{subpath}")
83
+
81
84
  if response.status != 200
82
85
  debug "Failed to get Lifecycle Controller Attributes".red, 1
83
86
  return false
@@ -193,7 +193,36 @@ module IDRAC
193
193
  end
194
194
  end
195
195
 
196
-
196
+ # Merge multiple SCP configurations together
197
+ # Takes multiple arguments - each can be an SCP hash, array of components, or full SCP structure
198
+ def merge_scp(*scps)
199
+ merged_components = {}
200
+
201
+ scps.compact.each do |scp|
202
+ components = extract_components(scp)
203
+ components.each do |component|
204
+ fqdd = component["FQDD"]
205
+ if merged_components[fqdd]
206
+ # Merge attributes for the same FQDD
207
+ existing_attrs = merged_components[fqdd]["Attributes"] || []
208
+ new_attrs = component["Attributes"] || []
209
+
210
+ # Build hash of existing attributes by name for easy lookup
211
+ attr_hash = {}
212
+ existing_attrs.each { |attr| attr_hash[attr["Name"]] = attr }
213
+
214
+ # Add/overwrite with new attributes
215
+ new_attrs.each { |attr| attr_hash[attr["Name"]] = attr }
216
+
217
+ merged_components[fqdd]["Attributes"] = attr_hash.values
218
+ else
219
+ merged_components[fqdd] = component.dup
220
+ end
221
+ end
222
+ end
223
+
224
+ merged_components.values
225
+ end
197
226
 
198
227
  # Handle location header for IP change operations. Monitors old IP until it fails,
199
228
  # then aggressively monitors new IP with tight timeouts.
@@ -266,5 +295,26 @@ module IDRAC
266
295
  end
267
296
 
268
297
  private
298
+
299
+ # Extract components array from various SCP formats
300
+ def extract_components(scp)
301
+ case scp
302
+ when Hash
303
+ if scp["SystemConfiguration"] && scp["SystemConfiguration"]["Components"]
304
+ scp["SystemConfiguration"]["Components"]
305
+ elsif scp["Components"]
306
+ scp["Components"]
307
+ elsif scp["FQDD"]
308
+ [scp] # Single component
309
+ else
310
+ # Assume it's a hash of FQDD => attributes
311
+ hash_to_scp(scp)
312
+ end
313
+ when Array
314
+ scp # Already an array of components
315
+ else
316
+ []
317
+ end
318
+ end
269
319
  end
270
320
  end
data/lib/idrac/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module IDRAC
4
- VERSION = "0.7.9"
4
+ VERSION = "0.7.10"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: idrac
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.9
4
+ version: 0.7.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Siegel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-06-23 00:00:00.000000000 Z
11
+ date: 2025-06-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty