ilo-sdk 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bfaec612bda5890adbb0515499c7c65088897886
4
- data.tar.gz: 2af3b506928f3ca07af45a93aee3cdbbd11d1c34
3
+ metadata.gz: f946ce92905f62313a97dad4c6e1b2af423e6b76
4
+ data.tar.gz: 759478851f155d9600c0758ebd01754f292d1f2c
5
5
  SHA512:
6
- metadata.gz: 915516df57b69d9779dd302616a7ea3be007c08069503ba9ae132e17816357804503e72191aef865eb462426e49c6c328df038c2a97152ce5ad89d96096990b4
7
- data.tar.gz: 65625f3d3233fae2a393ff7db1f305e10860cc50252e82c6273cb49f3f9b4f5ec8e0d04e3cb7ff3b123c34924a4c4a214115a1ade65c46d219a81b84ff1c6097
6
+ metadata.gz: 3fb34bebfd27fee718dcecc8fb53a2130b243aae7df2e349c8b5ce738b66f8832b588f072af15cd4d8b7d987c827d9951552e38f68246208f99ae0038321b312
7
+ data.tar.gz: 227ba06dbc423e26104c39b413e88c18aa5a183c237b133a1140d25521b56d81fb90c19a2800b59b42787215d298efa44f48835d7d437a12bc2886020194872b
data/README.md CHANGED
@@ -211,26 +211,32 @@ client.set_fw_upgrade('www.firmwareupgrade.com')
211
211
 
212
212
  #### HTTPS Certificate
213
213
  ```ruby
214
- # Generate a Certificate Signing Request:
215
- # Params: country_code, state, city, organization, organizational_unit, common_name
216
- client.generate_csr('US', 'Texas', 'Houston', 'myCompany', 'myUnit', 'example.com')
217
-
218
- # Wait for the CSR to be generated (will take about 10 minutes):
219
- csr = nil
220
- while(csr.nil?) do
221
- sleep(60) # 60 seconds
222
- csr = client.get_csr
214
+ # Get the current SSL Certificate and check to see if expires within 24 hours
215
+ expiration = client.get_certificate.not_after.to_datetime
216
+ tomorrow = DateTime.now + 1
217
+
218
+ if expiration < tomorrow
219
+ # Generate a Certificate Signing Request:
220
+ # Params: country_code, state, city, organization, organizational_unit, common_name
221
+ client.generate_csr('US', 'Texas', 'Houston', 'myCompany', 'myUnit', 'example.com')
222
+
223
+ # Wait for the CSR to be generated (will take about 10 minutes):
224
+ csr = nil
225
+ while(csr.nil?) do
226
+ sleep(60) # 60 seconds
227
+ csr = client.get_csr
228
+ end
229
+
230
+ # Here you'll need to have a step that submits the csr to a certificate authority
231
+ # (or self-signs it) and gets back the signed certificate. It will look something like:
232
+ # -----BEGIN CERTIFICATE-----
233
+ # lines_of_secret_text
234
+ # -----END CERTIFICATE-----
235
+ # For this example, we're assuming we've read in the content of the certificate to the
236
+ # "cert" variable (as a string).
237
+
238
+ client.import_certificate(cert)
223
239
  end
224
-
225
- # Here you'll need to have a step that submits the csr to a certificate authority
226
- # (or self-signs it) and gets back the signed certificate. It will look something like:
227
- # -----BEGIN CERTIFICATE-----
228
- # lines_of_secret_text
229
- # -----END CERTIFICATE-----
230
- # For this example, we're assuming we've read in the content of the certificate to the
231
- # "cert" variable (as a string).
232
-
233
- client.import_certificate(cert)
234
240
  ```
235
241
 
236
242
  #### Log Entry
@@ -14,14 +14,16 @@ module ILO_SDK
14
14
  module HttpsCertHelper
15
15
  # Get the SSL Certificate
16
16
  # @raise [RuntimeError] if the request failed
17
- # @return [String] x509_certificate
17
+ # @return [OpenSSL::X509::Certificate] x509_certificate
18
+ # rubocop:disable Style/SymbolProc
18
19
  def get_certificate
19
20
  uri = URI.parse(URI.escape(@host))
20
21
  options = { use_ssl: true, verify_mode: OpenSSL::SSL::VERIFY_NONE }
21
22
  Net::HTTP.start(uri.host, uri.port, options) do |http|
22
- http.peer_cert.to_pem
23
+ http.peer_cert
23
24
  end
24
25
  end
26
+ # rubocop:enable Style/SymbolProc
25
27
 
26
28
  # Import the x509 certificate
27
29
  # @param [String] certificate
@@ -11,5 +11,5 @@
11
11
 
12
12
  # Gem version defined here
13
13
  module ILO_SDK
14
- VERSION = '1.0.1'.freeze
14
+ VERSION = '1.0.2'.freeze
15
15
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ilo-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anirudh Gupta