kitchen-oci 1.28.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: 56fb93970dffa638ea0fe9d0f731618cdef737f6174edf7e138fda037217dcbb
4
- data.tar.gz: 66ee4bef763c835c93077ae53527bf83ddaa65ec4493098830bb92caa515ab29
3
+ metadata.gz: 9946d2409c6ed9c114777132492015f7875cfe6e13edb0714042b9201ee5ea17
4
+ data.tar.gz: 6783581acf13d597aee3ec3adcdb7110582107c84e8e755df6144cfcf81c7244
5
5
  SHA512:
6
- metadata.gz: d0c9ed658be5c469223f4d5a6a4aeba1fbc9a77f09f0972cc6d1b2c9394a7fc19da039b45799dbfbfaf2ddd8125e2766ceb89c66b3572a144a53c0fec2a66e91
7
- data.tar.gz: aac64963fb6ef43b1d2768e21d44cea2b84ac60d42c6ee260bdfeb31ebdc0b295f358d823a7c943109c562d906218cfa79552225edb48dbdb6289c08524edeb3
6
+ metadata.gz: 7fe83a9162360ab4e1896c0e8c4cb35d0d6af019fe386ab70562092b458f32b1cb0ab1700367d5fbfc7682045591c56bb08f904e928cc45cf51e8a1b51dfd909
7
+ data.tar.gz: abaed2993b82c06ada0255fedee6145157f3c6db32a870c6d281fb8386e0f86baed575b933f5a0cd7e05fc3e389a29fead4b2e35acdeab3d62e3f8d26e7b2cf3
@@ -81,13 +81,6 @@ module Kitchen
81
81
  )
82
82
  end
83
83
 
84
- # Adds the instance options property to the launch details.
85
- def instance_options
86
- return if config[:instance_options].empty?
87
-
88
- launch_details.instance_options = OCI::Core::Models::InstanceOptions.new(config[:instance_options])
89
- end
90
-
91
84
  # Adds the source_details property to the launch_details for an instance that is being created from a boot volume.
92
85
  def instance_source_via_boot_volume
93
86
  return unless config[:boot_volume_id]
@@ -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)
@@ -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.28.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.28.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-05-22 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