kitchen-oci 1.27.0 → 2.0.0

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: 287b9951ec283147d4c090e18ad45ee304e5cd88afaf2d1d4adc91de0c6c55e5
4
- data.tar.gz: 8f1c4c1018de62ca0c293dfa83b29182e999092fb561a36c77329643fd99e20b
3
+ metadata.gz: 9946d2409c6ed9c114777132492015f7875cfe6e13edb0714042b9201ee5ea17
4
+ data.tar.gz: 6783581acf13d597aee3ec3adcdb7110582107c84e8e755df6144cfcf81c7244
5
5
  SHA512:
6
- metadata.gz: 5eca7e04ff35aba43ab2993e73134a6961cf665cf44a7b39f8c650051faba78aadcf841894f1887f145093557fae2d00a0ff00d4283de7f77ba17c4175bf5236
7
- data.tar.gz: 435f87755bdcdcb3b5c79e9d04b66c86386d213d3ea3af5a80dea93d35d12aa00ea87ffa1889b5eff07cd21746f791302eaa5e1ecdd3294995838f82d5f815ce
6
+ metadata.gz: 7fe83a9162360ab4e1896c0e8c4cb35d0d6af019fe386ab70562092b458f32b1cb0ab1700367d5fbfc7682045591c56bb08f904e928cc45cf51e8a1b51dfd909
7
+ data.tar.gz: abaed2993b82c06ada0255fedee6145157f3c6db32a870c6d281fb8386e0f86baed575b933f5a0cd7e05fc3e389a29fead4b2e35acdeab3d62e3f8d26e7b2cf3
@@ -33,6 +33,8 @@ module Kitchen
33
33
  state_details = inst.launch
34
34
  state.merge!(state_details)
35
35
  instance.transport.connection(state).wait_until_ready
36
+ instance_options(state, inst)
37
+ are_legacy_imds_endpoints_disbled?(state, inst)
36
38
  end
37
39
 
38
40
  # Executes the post script on the instance.
@@ -68,6 +70,36 @@ module Kitchen
68
70
  end
69
71
  end
70
72
 
73
+ # Applies instance options.
74
+ #
75
+ # @param state [Hash] (see Kitchen::StateFile)
76
+ # @param inst [Class] the specific class of instance being rebooted.
77
+ def instance_options(state, inst)
78
+ return unless instance_options?
79
+
80
+ inst.logger.info("Applying the following instance options:")
81
+ config[:instance_options].each { |o, v| inst.logger.info("- #{o}: #{v}") }
82
+ inst.api.compute.update_instance(state[:server_id], OCI::Core::Models::UpdateInstanceDetails.new(instance_options: OCI::Core::Models::InstanceOptions.new(config[:instance_options])))
83
+ end
84
+
85
+ # Attempts to disable IMDSv1 even if not explicitly specified in the config. This is in line with current security guidance from OCI.
86
+ # Acts as a guard for setting instance options.
87
+ def instance_options?
88
+ return false unless config[:instance_type] == "compute"
89
+
90
+ config[:instance_options].merge!(are_legacy_imds_endpoints_disabled: true) unless config[:instance_options].key?(:are_legacy_imds_endpoints_disabled)
91
+ # Basically tell me if there's more stuff in there than `are_legacy_imds_endpoints_disabled: false`. If so, then proceed to setting it.
92
+ config[:instance_options].reject { |o, v| o == :are_legacy_imds_endpoints_disabled && !v }.any?
93
+ end
94
+
95
+ # Checks if legacy metadata is disabled.
96
+ def are_legacy_imds_endpoints_disbled?(state, inst)
97
+ return unless config[:instance_type] == "compute"
98
+
99
+ imds = inst.api.compute.get_instance(state[:server_id]).data.instance_options.are_legacy_imds_endpoints_disabled
100
+ inst.logger.warn("Legacy IMDSv1 endpoint is enabled.") unless imds
101
+ end
102
+
71
103
  # Reboots an instance.
72
104
  #
73
105
  # @param state [Hash] (see Kitchen::StateFile)
@@ -82,6 +82,7 @@ module Kitchen
82
82
  default_config :post_create_reboot, false
83
83
 
84
84
  # compute only configs
85
+ default_config :instance_options, {}
85
86
  default_config :capacity_reservation_id
86
87
  default_config :setup_winrm, false
87
88
  default_config :winrm_user, "opc"
@@ -22,6 +22,6 @@ module Kitchen
22
22
  # Version string for Oracle OCI Kitchen driver
23
23
  #
24
24
  # @author Stephen Pearson (<stephen.pearson@oracle.com>)
25
- OCI_VERSION = "1.27.0"
25
+ OCI_VERSION = "2.0.0"
26
26
  end
27
27
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitchen-oci
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.27.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen Pearson
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2025-02-14 00:00:00.000000000 Z
12
+ date: 2025-07-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: oci
@@ -176,7 +176,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
176
176
  - !ruby/object:Gem::Version
177
177
  version: '0'
178
178
  requirements: []
179
- rubygems_version: 3.3.7
179
+ rubygems_version: 3.3.27
180
180
  signing_key:
181
181
  specification_version: 4
182
182
  summary: A Test Kitchen Driver for Oracle Cloud Infrastructure