idrac 0.11.1 → 0.11.3

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: f24b2229f786a83cbdcaf74c4511953d92b4081194aec3885e825a83426a8ff7
4
- data.tar.gz: d5b0b13b8f51b43936e01601e031617b2704bd5d09b4fffcb8c99f35864fe130
3
+ metadata.gz: 18fbd46b70ae43b050ae003a24dac1955d9e9a523b7771c195d6f7922194ff50
4
+ data.tar.gz: ba4618273bf52b3ae1bd28f4abf5f4ddccb44ad4a68d9f88df7ef68340986f56
5
5
  SHA512:
6
- metadata.gz: 3d71bfb2ca893fed352c34c4726a9c76bee97c9978933f3d0928e48f8ba4a0a12fe5b3045fdc3f7a33c8ab107156e6b71d14275ca377fb93fb146a64f7be6525
7
- data.tar.gz: aca2e4227201a36da2f657bfacbe2109c95ae63ddccca6a85f3c1aee84f08180987cf1b50e9f623214466c6d46701920f56a2182a74ba2616e61bfa263614b04
6
+ metadata.gz: 7e2b9205ec2a1555b88f555146e6bf2b11aa9ed5c8ce40d4fc27bc7fc8e3ac29f0f2d99c5ff218ef92a038ca91caf70b04be4c467fbc11ca8d3eeacf9c8c9225
7
+ data.tar.gz: 911b93b92414f0957cee2f415f490b2182cae707ce0e069ee18fba85702d17711459a296f09819d19cac7a13b9da5a934c014add8d4fb347d1ca8209a2aacbc7
data/lib/idrac/client.rb CHANGED
@@ -81,6 +81,7 @@ module IDRAC
81
81
  faraday.response :logger, Logger.new(STDOUT), bodies: @verbosity >= 2 do |logger|
82
82
  logger.filter(/(Authorization: Basic )([^,\n]+)/, '\1[FILTERED]')
83
83
  logger.filter(/(Password"=>"?)([^,"]+)/, '\1[FILTERED]')
84
+ logger.filter(/(Password\\?"\s*[:,]\s*(?:\\?"Value\\?"\s*:\s*)?\\?")([^"\\]*)/, '\1[FILTERED]')
84
85
  end
85
86
  end
86
87
  end
@@ -190,7 +191,7 @@ module IDRAC
190
191
  headers['Accept'] ||= 'application/json'
191
192
  headers['Host'] = @host_header if @host_header
192
193
 
193
- debug "Request body: #{body}", 2 if body && @verbosity >= 2
194
+ debug "Request body: #{body.to_s.match?(/password/i) ? '[REDACTED: contains a password]' : body}", 2 if body && @verbosity >= 2
194
195
 
195
196
  if @direct_mode
196
197
  headers['Authorization'] = "Basic #{Base64.strict_encode64("#{username}:#{password}")}"
data/lib/idrac/session.rb CHANGED
@@ -43,6 +43,7 @@ module IDRAC
43
43
  faraday.response :logger, Logger.new(STDOUT), bodies: @verbosity >= 2 do |logger|
44
44
  logger.filter(/(Authorization: Basic )([^,\n]+)/, '\1[FILTERED]')
45
45
  logger.filter(/(Password"=>"?)([^,"]+)/, '\1[FILTERED]')
46
+ logger.filter(/(Password\\?"\s*[:,]\s*(?:\\?"Value\\?"\s*:\s*)?\\?")([^"\\]*)/, '\1[FILTERED]')
46
47
  end
47
48
  end
48
49
  end
@@ -84,6 +84,35 @@ module IDRAC
84
84
  end
85
85
  end
86
86
 
87
+ # Set iDRAC-only attributes without touching host power. Names are Redfish-style
88
+ # ("VNCServer.1.Enable" => "Enabled"). iDRAC9 takes a plain PATCH (no job). iDRAC8 has
89
+ # no Manager Attributes resource (404), so fall back to an SCP import that targets the
90
+ # iDRAC only, with NoReboot and HostPowerState pinned to the host's current state.
91
+ # Returns { status: :success } for the PATCH, or the import job's outcome.
92
+ def set_idrac_attributes(attributes, timeout: 600)
93
+ debug "Setting iDRAC attributes: #{attributes.to_h { |k, v| [k, k.to_s.match?(/password/i) ? "[REDACTED]" : v] }}", 1, :blue
94
+ response = authenticated_request(:patch, "/redfish/v1/Managers/iDRAC.Embedded.1/Attributes",
95
+ body: { "Attributes" => attributes }.to_json) { |r| r }
96
+ return { status: :success } if response.status.between?(200, 299)
97
+ handle_response(response) unless response.status == 404
98
+
99
+ scp = { "SystemConfiguration" => { "Components" => [make_scp(fqdd: "iDRAC.Embedded.1",
100
+ attributes: attributes.to_h { |k, v| [k.to_s.sub(/\A([^.]+\.\d+)\./, '\1#'), v] })] } }
101
+ response = authenticated_request(:post,
102
+ "/redfish/v1/Managers/iDRAC.Embedded.1/Actions/Oem/EID_674_Manager.ImportSystemConfiguration",
103
+ body: { "ImportBuffer" => JSON.generate(scp), "ShareParameters" => { "Target" => "IDRAC" },
104
+ "ShutdownType" => "NoReboot", "HostPowerState" => get_power_state }.to_json)
105
+ wait_for_scp_import(response.headers["location"], timeout: timeout)
106
+ end
107
+
108
+ def enable_vnc!(password:, port: 5901)
109
+ # Braces matter: a bare string-keyed hash binds to the keyword args on Ruby 3.
110
+ set_idrac_attributes({ "VNCServer.1.Enable" => "Enabled", "VNCServer.1.Port" => port,
111
+ "VNCServer.1.Password" => password,
112
+ "VNCServer.1.SSLEncryptionBitLength" => "Disabled",
113
+ "VNCServer.1.LowerEncryptionBitLength" => "Disabled" })
114
+ end
115
+
87
116
  # Apply a system configuration profile to the iDRAC.
88
117
  #
89
118
  # Waits for the import JOB to finish and returns the JOB's outcome:
@@ -117,6 +146,8 @@ module IDRAC
117
146
  "ImportBuffer" => JSON.generate(scp_to_apply),
118
147
  "ShareParameters" => {"Target" => target},
119
148
  "ShutdownType" => "Forced",
149
+ # Warning: reboot: false sends "Off", which POWERS THE HOST OFF after the import.
150
+ # For iDRAC-only attributes use set_idrac_attributes, which keeps the power state.
120
151
  "HostPowerState" => reboot ? "On" : "Off"
121
152
  }
122
153
 
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.11.1"
4
+ VERSION = "0.11.3"
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.11.1
4
+ version: 0.11.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Siegel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-10-04 00:00:00.000000000 Z
11
+ date: 2026-11-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -297,7 +297,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
297
297
  - !ruby/object:Gem::Version
298
298
  version: '0'
299
299
  requirements: []
300
- rubygems_version: 3.5.16
300
+ rubygems_version: 3.5.22
301
301
  signing_key:
302
302
  specification_version: 4
303
303
  summary: API Client for Dell iDRAC