kitchen-oci 2.1.0 → 3.1.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 +4 -4
- data/lib/kitchen/driver/oci/api.rb +14 -1
- data/lib/kitchen/driver/oci/config.rb +4 -2
- data/lib/kitchen/driver/oci/instance/compute.rb +15 -1
- data/lib/kitchen/driver/oci/mixin/actions.rb +4 -2
- data/lib/kitchen/driver/oci.rb +1 -0
- data/lib/kitchen/driver/oci_version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5bfc39bf616e0eefecc820abb06a06b61ed2b90e96e90434c73be1d6604c7372
|
|
4
|
+
data.tar.gz: df5a102d375fa58f09e7083957deb3e97ef6ded000d305b7eae03e868a968280
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6841666c45f23dce74e419dd4eb14bf28b9964988d37addb43db84b1a41483b01c16f5601c04d8b86ae83f15e0ebc3b8da62ffc642b17f1b986921a5d1325b37
|
|
7
|
+
data.tar.gz: 5d2269712aa89d1be30882cbd2087ab7fcca506bde7433c2fef949ef6d2867dc4bf17f214073a344ac1a652b6a8e0bba41caefd14964b1d631dc83223555861d
|
|
@@ -92,15 +92,28 @@ module Kitchen
|
|
|
92
92
|
|
|
93
93
|
# Determines the signing method if one is specified.
|
|
94
94
|
#
|
|
95
|
+
# Security token (session) authentication is used when <b>use_token_auth</b> is set explicitly or
|
|
96
|
+
# when the selected OCI profile contains a <b>security_token_file</b>. The latter allows sessions
|
|
97
|
+
# created by <tt>oci session authenticate</tt> (RPST) to be detected automatically.
|
|
98
|
+
#
|
|
95
99
|
# @return [OCI::Auth::Signers::InstancePrincipalsSecurityTokenSigner, OCI::Auth::Signers::SecurityTokenSigner] an instance of the specified token signer.
|
|
96
100
|
def signer
|
|
97
101
|
if config[:use_instance_principals]
|
|
98
102
|
OCI::Auth::Signers::InstancePrincipalsSecurityTokenSigner.new
|
|
99
|
-
elsif config[:use_token_auth]
|
|
103
|
+
elsif config[:use_token_auth] || security_token_file?
|
|
100
104
|
token_signer
|
|
101
105
|
end
|
|
102
106
|
end
|
|
103
107
|
|
|
108
|
+
# Whether the loaded OCI config contains a security_token_file pointing at an existing token.
|
|
109
|
+
#
|
|
110
|
+
# @return [Boolean]
|
|
111
|
+
def security_token_file?
|
|
112
|
+
oci_config.respond_to?(:security_token_file) &&
|
|
113
|
+
!oci_config.security_token_file.to_s.empty? &&
|
|
114
|
+
File.exist?(oci_config.security_token_file)
|
|
115
|
+
end
|
|
116
|
+
|
|
104
117
|
# Creates the token signer with a provided key.
|
|
105
118
|
#
|
|
106
119
|
# @return [OCI::Auth::Signers::SecurityTokenSigner]
|
|
@@ -40,8 +40,10 @@ module Kitchen
|
|
|
40
40
|
#
|
|
41
41
|
# @return [OCI::Config]
|
|
42
42
|
def oci_config
|
|
43
|
-
# OCI::Config is missing this
|
|
44
|
-
|
|
43
|
+
# OCI::Config is missing this attribute. It is always added so that a security_token_file
|
|
44
|
+
# present in the selected profile is loaded, which enables auto-detection of session
|
|
45
|
+
# (RPST) token authentication even when use_token_auth is not explicitly set.
|
|
46
|
+
OCI::Config.class_eval { attr_accessor :security_token_file } unless OCI::Config.instance_methods.include?(:security_token_file)
|
|
45
47
|
conf = config_loader(config_file_location: @driver_config[:oci_config_file], profile_name: @driver_config[:oci_profile_name])
|
|
46
48
|
@driver_config[:oci_config].each do |key, value|
|
|
47
49
|
conf.send("#{key}=", value) unless value.nil? || value.empty?
|
|
@@ -71,13 +71,16 @@ module Kitchen
|
|
|
71
71
|
end
|
|
72
72
|
|
|
73
73
|
# Adds the source_details property to the launch_details for an instance that is being created from an image.
|
|
74
|
+
# When <b>kms_key_id</b> is specified the boot volume is encrypted with the provided customer-managed key,
|
|
75
|
+
# which is required by compartments governed by a Security Zone that mandates customer-managed encryption.
|
|
74
76
|
def instance_source_via_image
|
|
75
77
|
return if config[:boot_volume_id]
|
|
76
78
|
|
|
77
79
|
launch_details.source_details = OCI::Core::Models::InstanceSourceViaImageDetails.new(
|
|
78
80
|
sourceType: "image",
|
|
79
81
|
imageId: image_id,
|
|
80
|
-
bootVolumeSizeInGBs: config[:boot_volume_size_in_gbs]
|
|
82
|
+
bootVolumeSizeInGBs: config[:boot_volume_size_in_gbs],
|
|
83
|
+
kmsKeyId: config[:kms_key_id]
|
|
81
84
|
)
|
|
82
85
|
end
|
|
83
86
|
|
|
@@ -95,6 +98,17 @@ module Kitchen
|
|
|
95
98
|
def instance_metadata
|
|
96
99
|
launch_details.metadata = metadata
|
|
97
100
|
end
|
|
101
|
+
|
|
102
|
+
# Adds the instance_options property to the launch_details to disable legacy IMDS endpoints at launch time.
|
|
103
|
+
# This ensures IMDSv2 is enabled from instance creation, which is required by OCI security policies
|
|
104
|
+
# that deny instance creation when areLegacyEndpointsDisabled='false'.
|
|
105
|
+
def launch_instance_options
|
|
106
|
+
opts = config[:instance_options].dup
|
|
107
|
+
return if opts.delete(:post_create)
|
|
108
|
+
|
|
109
|
+
opts[:are_legacy_imds_endpoints_disabled] = true unless opts.key?(:are_legacy_imds_endpoints_disabled)
|
|
110
|
+
launch_details.instance_options = OCI::Core::Models::InstanceOptions.new(opts)
|
|
111
|
+
end
|
|
98
112
|
end
|
|
99
113
|
end
|
|
100
114
|
end
|
|
@@ -97,10 +97,12 @@ module Kitchen
|
|
|
97
97
|
# Acts as a guard for setting instance options.
|
|
98
98
|
def instance_options?
|
|
99
99
|
return false unless config[:instance_type] == "compute"
|
|
100
|
+
return false unless config[:instance_options].delete(:post_create)
|
|
100
101
|
|
|
101
|
-
|
|
102
|
+
opts = config[:instance_options]
|
|
103
|
+
opts.merge!(are_legacy_imds_endpoints_disabled: true) unless opts.key?(:are_legacy_imds_endpoints_disabled)
|
|
102
104
|
# Basically tell me if there's more stuff in there than `are_legacy_imds_endpoints_disabled: false`. If so, then proceed to setting it.
|
|
103
|
-
|
|
105
|
+
opts.reject { |o, v| o == :are_legacy_imds_endpoints_disabled && !v }.any?
|
|
104
106
|
end
|
|
105
107
|
|
|
106
108
|
# Checks if legacy metadata is disabled.
|
data/lib/kitchen/driver/oci.rb
CHANGED
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:
|
|
4
|
+
version: 3.1.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:
|
|
12
|
+
date: 2026-06-25 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: oci
|