kitchen-oci 1.26.0 → 1.27.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.
@@ -22,7 +22,9 @@ module Kitchen
22
22
  module Driver
23
23
  class Oci
24
24
  module Models
25
- # Compute instance model
25
+ # Compute instance model.
26
+ #
27
+ # @author Justin Steele <justin.steele@oracle.com>
26
28
  class Compute < Instance # rubocop:disable Metrics/ClassLength
27
29
  include ComputeLaunchDetails
28
30
 
@@ -31,13 +33,14 @@ module Kitchen
31
33
  @launch_details = OCI::Core::Models::LaunchInstanceDetails.new
32
34
  end
33
35
 
34
- #
35
- # The details model that describes a compute instance
36
+ # The details model that describes a compute instance.
36
37
  #
37
38
  # @return [OCI::Core::Models::LaunchInstanceDetails]
38
- #
39
39
  attr_accessor :launch_details
40
40
 
41
+ # Launches a compute instance.
42
+ #
43
+ # @return [Hash] the finalized state after the instance has been launched and is running.
41
44
  def launch
42
45
  process_windows_options
43
46
  response = api.compute.launch_instance(launch_instance_details)
@@ -46,11 +49,13 @@ module Kitchen
46
49
  final_state(state, instance_id)
47
50
  end
48
51
 
52
+ # Terminates a compute instance.
49
53
  def terminate
50
54
  api.compute.terminate_instance(state[:server_id])
51
55
  api.compute.get_instance(state[:server_id]).wait_until(:lifecycle_state, OCI::Core::Models::Instance::LIFECYCLE_STATE_TERMINATING)
52
56
  end
53
57
 
58
+ # Reboots a compute instance.
54
59
  def reboot
55
60
  api.compute.instance_action(state[:server_id], "SOFTRESET")
56
61
  api.compute.get_instance(state[:server_id]).wait_until(:lifecycle_state, OCI::Core::Models::Instance::LIFECYCLE_STATE_RUNNING)
@@ -58,6 +63,10 @@ module Kitchen
58
63
 
59
64
  private
60
65
 
66
+ # The ocid of the image to be used when creating the instance.
67
+ # * If <b>image_id</b> is specified in the kitchen.yml, that will be returned.
68
+ # * If <b>image_name</b> is specified in the kitchen.yml, lookup with the Compute API to find the ocid of the image by name.
69
+ # @raise [StandardError] if neither <b>image_id</b> nor <b>image_name</b> are specified OR the image lookup by name fails to find a match.
61
70
  def image_id
62
71
  return config[:image_id] if config[:image_id]
63
72
 
@@ -66,6 +75,9 @@ module Kitchen
66
75
  image_id_by_name
67
76
  end
68
77
 
78
+ # Looks up the image ocid by name by recursively querying the list of images with the Compute API.
79
+ #
80
+ # @return [String] the ocid of the image.
69
81
  def image_id_by_name
70
82
  image_name = image_name_conversion
71
83
  image_list = images.select { |i| i.display_name.match(/#{image_name}/) }
@@ -77,22 +89,35 @@ module Kitchen
77
89
  latest_image_id(image_list)
78
90
  end
79
91
 
92
+ # Automatically append aarch64 to a specified image name if an ARM shape is specified.
93
+ #
94
+ # @return [String] the modified image name.
80
95
  def image_name_conversion
81
96
  image_name = config[:image_name].gsub(" ", "-")
82
- if config[:shape] =~ /^VM\.Standard\.A\d+\.Flex$/ && !config[:image_name].include?("aarch64")
83
- image_name = "#{image_name}-aarch64"
84
- end
97
+ image_name = "#{image_name}-aarch64" if config[:shape] =~ /^VM\.Standard\.A\d+\.Flex$/ && !config[:image_name].include?("aarch64")
85
98
  image_name
86
99
  end
87
100
 
101
+ # Filter images by name.
102
+ #
103
+ # @param image_list [Array] a list of the display names of all available images.
104
+ # @param image_name [String] the image name or regular expression provided in the config.
105
+ # @return [Array] all display names that match the image_name.
88
106
  def filter_image_list(image_list, image_name)
89
107
  image_list.select { |i| i.display_name.match(/#{image_name}-[0-9]{4}\.[0-9]{2}\.[0-9]{2}/) }
90
108
  end
91
109
 
110
+ # Finds the ocid of the most recent image by time created.
111
+ #
112
+ # @param image_list [Array] a list of all of the display names that matched the search string.
113
+ # @return [String] the ocid of the latest matching image.
92
114
  def latest_image_id(image_list)
93
115
  image_list.sort_by! { |o| ((DateTime.parse(Time.now.utc.to_s) - o.time_created) * 24 * 60 * 60).to_i }.first.id
94
116
  end
95
117
 
118
+ # Pages through all of the images in the compartment. This has to be a recursive process because the list_images API only returns 99 entries at a time.
119
+ #
120
+ # @return [Array] An array of OCI::Core::Models::Image.
96
121
  def images(image_list = [], page = nil)
97
122
  current_images = api.compute.list_images(oci.compartment, page: page)
98
123
  next_page = current_images.next_page
@@ -101,6 +126,9 @@ module Kitchen
101
126
  image_list.flatten
102
127
  end
103
128
 
129
+ # Clone the specified boot volume and return the new ocid.
130
+ #
131
+ # @return [String]
104
132
  def clone_boot_volume
105
133
  logger.info("Cloning boot volume...")
106
134
  cbv = api.blockstorage.create_boot_volume(clone_boot_volume_details)
@@ -109,6 +137,9 @@ module Kitchen
109
137
  cbv.data.id
110
138
  end
111
139
 
140
+ # Create a new instance of OCI::Core::Models::CreateBootVolumeDetails.
141
+ #
142
+ # @return [OCI::Core::Models::CreateBootVolumeDetails]
112
143
  def clone_boot_volume_details
113
144
  OCI::Core::Models::CreateBootVolumeDetails.new(
114
145
  source_details: OCI::Core::Models::BootVolumeSourceFromBootVolumeDetails.new(
@@ -120,10 +151,17 @@ module Kitchen
120
151
  )
121
152
  end
122
153
 
154
+ # Create the display name of the cloned boot volume.
155
+ #
156
+ # @return [String]
123
157
  def boot_volume_display_name
124
158
  "#{api.blockstorage.get_boot_volume(config[:boot_volume_id]).data.display_name} (Clone)"
125
159
  end
126
160
 
161
+ # Get the IP address of the instance from the vnic.
162
+ #
163
+ # @param instance_id [String] the ocid of the instance.
164
+ # @return [String]
127
165
  def instance_ip(instance_id)
128
166
  vnic = vnics(instance_id).select(&:is_primary).first
129
167
  if public_ip_allowed?
@@ -133,10 +171,18 @@ module Kitchen
133
171
  end
134
172
  end
135
173
 
174
+ # Get a list of all vnics attached to the instance.
175
+ #
176
+ # @param instance_id [String] the ocid of the instance.
177
+ # @return [Array] a list of OCI::Core::Models::Vnic.
136
178
  def vnics(instance_id)
137
179
  vnic_attachments(instance_id).map { |att| api.network.get_vnic(att.vnic_id).data }
138
180
  end
139
181
 
182
+ # Get a list of all vnic attachments associated with the instance.
183
+ #
184
+ # @param instance_id [String] the ocid of the instance.
185
+ # @return [Array] a list of OCI::Core::Models::VnicAttachment.
140
186
  def vnic_attachments(instance_id)
141
187
  att = api.compute.list_vnic_attachments(oci.compartment, instance_id: instance_id).data
142
188
  raise "Could not find any VNIC attachments" unless att.any?
@@ -144,10 +190,16 @@ module Kitchen
144
190
  att
145
191
  end
146
192
 
193
+ # Generate a hostname that includes some randomness.
194
+ #
195
+ # @return [String]
147
196
  def hostname
148
197
  %W{#{config[:hostname_prefix]} #{config[:instance_name]} #{random_string(6)}}.uniq.compact.join("-")
149
198
  end
150
199
 
200
+ # Create the details of the vnic that will be created.
201
+ #
202
+ # @param name [String] the display name of the instance being created.
151
203
  def create_vnic_details(name)
152
204
  OCI::Core::Models::CreateVnicDetails.new(
153
205
  assign_public_ip: public_ip_allowed?,
@@ -158,6 +210,9 @@ module Kitchen
158
210
  )
159
211
  end
160
212
 
213
+ # Read in the public ssh key.
214
+ #
215
+ # @return [String]
161
216
  def pubkey
162
217
  if config[:ssh_keygen]
163
218
  logger.info("Generating public/private rsa key pair")
@@ -166,6 +221,7 @@ module Kitchen
166
221
  File.readlines(public_key_file).first.chomp
167
222
  end
168
223
 
224
+ # Add our special sauce to the instance metadata to be executed by cloud-init.
169
225
  def metadata
170
226
  md = {}
171
227
  inject_powershell
@@ -175,6 +231,7 @@ module Kitchen
175
231
  md
176
232
  end
177
233
 
234
+ # Piece together options that a required for Windows instances.
178
235
  def process_windows_options
179
236
  return unless windows_state?
180
237
 
@@ -182,20 +239,32 @@ module Kitchen
182
239
  state.store(:password, config[:winrm_password] || random_password(%w{@ - ( ) .}))
183
240
  end
184
241
 
242
+ # Do the windows-y things exist in the kitchen config or the state?
243
+ #
244
+ # @return [Boolean]
185
245
  def windows_state?
186
246
  config[:setup_winrm] && config[:password].nil? && state[:password].nil?
187
247
  end
188
248
 
249
+ # Has custom user_data been provided in the config?
250
+ #
251
+ # @return [Boolean]
189
252
  def user_data?
190
253
  config[:user_data] && !config[:user_data].empty?
191
254
  end
192
255
 
256
+ # Read in and bind our winrm setup script.
257
+ #
258
+ # @return [String]
193
259
  def winrm_ps1
194
260
  filename = File.join(__dir__, %w{.. .. .. .. .. tpl setup_winrm.ps1.erb})
195
261
  tpl = ERB.new(File.read(filename))
196
262
  tpl.result(binding)
197
263
  end
198
264
 
265
+ # Inject all of the winrm setup stuff into cloud-init.
266
+ #
267
+ # @return [Hash] the user_data config hash with the winrm stuff injected.
199
268
  def inject_powershell
200
269
  return unless config[:setup_winrm]
201
270
 
@@ -22,8 +22,10 @@ module Kitchen
22
22
  module Driver
23
23
  class Oci
24
24
  module Models
25
- # dbaas model
26
- class Dbaas < Instance # rubocop:disable Metrics/ClassLength
25
+ # Database system model.
26
+ #
27
+ # @author Justin Steele <justin.steele@oracle.com>
28
+ class Dbaas < Instance
27
29
  include DbaasLaunchDetails
28
30
 
29
31
  def initialize(opts = {})
@@ -33,27 +35,24 @@ module Kitchen
33
35
  @db_home_details = OCI::Database::Models::CreateDbHomeDetails.new
34
36
  end
35
37
 
36
- #
37
- # The details model that describes the db system
38
+ # The details model that describes the db system.
38
39
  #
39
40
  # @return [OCI::Database::Models::LaunchDbSystemDetails]
40
- #
41
41
  attr_accessor :launch_details
42
42
 
43
- #
44
- # The details model that describes the database
43
+ # The details model that describes the database.
45
44
  #
46
45
  # @return [OCI::Database::Models::CreateDatabaseDetails]
47
- #
48
46
  attr_accessor :database_details
49
47
 
50
- #
51
- # The details model that describes the database home
48
+ # The details model that describes the database home.
52
49
  #
53
50
  # @return [OCI::Database::Models::CreateDbHomeDetails]
54
- #
55
51
  attr_accessor :db_home_details
56
52
 
53
+ # Launches a database system.
54
+ #
55
+ # @return [Hash] the finalized state after the instance has been launched and is running.
57
56
  def launch
58
57
  response = api.dbaas.launch_db_system(launch_instance_details)
59
58
  instance_id = response.data.id
@@ -63,12 +62,14 @@ module Kitchen
63
62
  final_state(state, instance_id)
64
63
  end
65
64
 
65
+ # Terminates a DBaaS system.
66
66
  def terminate
67
67
  api.dbaas.terminate_db_system(state[:server_id])
68
68
  api.dbaas.get_db_system(state[:server_id]).wait_until(:lifecycle_state, OCI::Database::Models::DbSystem::LIFECYCLE_STATE_TERMINATING,
69
69
  max_interval_seconds: 900, max_wait_seconds: 21_600)
70
70
  end
71
71
 
72
+ # Reboots a DBaaS node.
72
73
  def reboot
73
74
  db_node_id = dbaas_node(state[:server_id]).first.id
74
75
  api.dbaas.db_node_action(db_node_id, "SOFTRESET")
@@ -77,6 +78,10 @@ module Kitchen
77
78
 
78
79
  private
79
80
 
81
+ # Get the IP address of the instance from the vnic.
82
+ #
83
+ # @param instance_id [String] the ocid of the instance.
84
+ # @return [String]
80
85
  def instance_ip(instance_id)
81
86
  vnic = dbaas_node(instance_id).select(&:vnic_id).first.vnic_id
82
87
  if public_ip_allowed?
@@ -86,18 +91,30 @@ module Kitchen
86
91
  end
87
92
  end
88
93
 
94
+ # Get the ocid of the database node associated with the database system.
95
+ #
96
+ # @param instance_id [String] the ocid of the database system.
89
97
  def dbaas_node(instance_id)
90
98
  api.dbaas.list_db_nodes(oci.compartment, db_system_id: instance_id).data
91
99
  end
92
100
 
101
+ # Sets the hostname_prefix as defined in the kitchen config.
102
+ #
103
+ # @return [String]
93
104
  def hostname_prefix
94
105
  config[:hostname_prefix]
95
106
  end
96
107
 
108
+ # Generates a random suffix to the hostname prefix.
109
+ #
110
+ # @return [String]
97
111
  def long_hostname_suffix
98
112
  [random_string(25 - hostname_prefix.length), random_string(3)].compact.join("-")
99
113
  end
100
114
 
115
+ # Read in the public ssh key.
116
+ #
117
+ # @return [String]
101
118
  def read_public_key
102
119
  if config[:ssh_keygen]
103
120
  logger.info("Generating public/private rsa key pair")
@@ -21,20 +21,26 @@ module Kitchen
21
21
  module Driver
22
22
  class Oci
23
23
  module Models
24
- # iscsi volume attachment model
24
+ # iSCSI volume model.
25
+ #
26
+ # @author Justin Steele <justin.steele@oracle.com>
25
27
  class Iscsi < Blockstorage
26
28
  def initialize(opts = {})
27
29
  super
28
30
  @attachment_type = "iscsi"
29
31
  end
30
32
 
31
- #
32
- # The type of attachment being created
33
+ # The type of attachment being created.
33
34
  #
34
35
  # @return [String]
35
- #
36
36
  attr_reader :attachment_type
37
37
 
38
+ # Creates the attachment details for an iSCSI volume.
39
+ #
40
+ # @param volume_details [OCI::Core::Models::Volume]
41
+ # @param server_id [String] the ocid of the compute instance to which the volume will be attached.
42
+ # @param volume_config [Hash] the state of the current volume being processed as specified in the kitchen.yml.
43
+ # @return [OCI::Core::Models::AttachIScsiVolumeDetails]
38
44
  def attachment_details(volume_details, server_id, volume_config)
39
45
  device = volume_config[:device] unless server_os(server_id).downcase =~ /windows/
40
46
  OCI::Core::Models::AttachIScsiVolumeDetails.new(
@@ -45,6 +51,10 @@ module Kitchen
45
51
  )
46
52
  end
47
53
 
54
+ # Adds the volume attachment info into the state.
55
+ #
56
+ # @param response [OCI::Core::Models::VolumeAttachment]
57
+ # @return [Hash]
48
58
  def final_volume_attachment_state(response)
49
59
  volume_attachment_state.store(:id, response.id)
50
60
  volume_attachment_state.store(:display_name, response.display_name)
@@ -21,20 +21,26 @@ module Kitchen
21
21
  module Driver
22
22
  class Oci
23
23
  module Models
24
- # paravirtual attachment model
24
+ # Paravirtual volume model.
25
+ #
26
+ # @author Justin Steele <justin.steele@oracle.com>
25
27
  class Paravirtual < Blockstorage
26
28
  def initialize(opts = {})
27
29
  super
28
30
  @attachment_type = "paravirtual"
29
31
  end
30
32
 
31
- #
32
- # The type of attachment being created
33
+ # The type of attachment being created.
33
34
  #
34
35
  # @return [String]
35
- #
36
36
  attr_reader :attachment_type
37
37
 
38
+ # Creates the attachment details for a Paravirtual volume.
39
+ #
40
+ # @param volume_details [OCI::Core::Models::Volume]
41
+ # @param server_id [String] the ocid of the compute instance to which the volume will be attached.
42
+ # @param volume_config [Hash] the state of the current volume being processed as specified in the kitchen.yml.
43
+ # @return [OCI::Core::Models::AttachParavirtualizedVolumeDetails]
38
44
  def attachment_details(volume_details, server_id, volume_config)
39
45
  device = volume_config[:device] unless server_os(server_id).downcase =~ /windows/
40
46
  OCI::Core::Models::AttachParavirtualizedVolumeDetails.new(
@@ -45,6 +51,10 @@ module Kitchen
45
51
  )
46
52
  end
47
53
 
54
+ # Adds the volume attachment info into the state.
55
+ #
56
+ # @param response [OCI::Core::Models::VolumeAttachment]
57
+ # @return [Hash]
48
58
  def final_volume_attachment_state(response)
49
59
  volume_attachment_state.store(:id, response.id)
50
60
  volume_attachment_state.store(:display_name, response.display_name)
@@ -32,10 +32,11 @@ module Kitchen
32
32
  # Oracle OCI driver for Kitchen.
33
33
  #
34
34
  # @author Stephen Pearson <stephen.pearson@oracle.com>
35
- class Oci < Kitchen::Driver::Base # rubocop:disable Metrics/ClassLength
35
+ class Oci < Kitchen::Driver::Base
36
36
  require_relative "oci_version"
37
- require_relative "oci/models"
38
- require_relative "oci/volumes"
37
+ require_relative "oci/mixin/actions"
38
+ require_relative "oci/mixin/models"
39
+ require_relative "oci/mixin/volumes"
39
40
 
40
41
  plugin_version Kitchen::Driver::OCI_VERSION
41
42
  kitchen_driver_api_version 2
@@ -115,9 +116,10 @@ module Kitchen
115
116
  raise UserError, "#{driver.class}<#{driver.instance.name}>#config#{message}"
116
117
  end
117
118
 
118
- include Kitchen::Driver::Oci::Models
119
- include Kitchen::Driver::Oci::Volumes
120
-
119
+ # Creates an instance.
120
+ # (see Kitchen::Driver::Base#create)
121
+ #
122
+ # @param state [Hash] (see Kitchen::StateFile)
121
123
  def create(state)
122
124
  return if state[:server_id]
123
125
 
@@ -126,10 +128,14 @@ module Kitchen
126
128
  inst = instance_class(config, state, oci, api, __method__)
127
129
  launch(state, inst)
128
130
  create_and_attach_volumes(config, state, oci, api)
129
- process_post_script(state)
131
+ execute_post_create_script(state)
130
132
  reboot(state, inst)
131
133
  end
132
134
 
135
+ # Destorys an instance.
136
+ # (see Kitchen::Driver::Base#destroy)
137
+ #
138
+ # @param state [Hash] (see Kitchen::StateFile)
133
139
  def destroy(state)
134
140
  return unless state[:server_id]
135
141
 
@@ -141,51 +147,20 @@ module Kitchen
141
147
 
142
148
  private
143
149
 
150
+ include Kitchen::Driver::Oci::Mixin::Actions
151
+ include Kitchen::Driver::Oci::Mixin::Models
152
+ include Kitchen::Driver::Oci::Mixin::Volumes
153
+
154
+ # Creates the OCI config and API clients.
155
+ #
156
+ # @param action [Symbol] the name of the method that called this method.
157
+ # @return [Oci::Config, Oci::Api]
144
158
  def auth(action)
145
159
  oci = Oci::Config.new(config)
146
160
  api = Oci::Api.new(oci.config, config)
147
161
  oci.compartment if action == :create
148
162
  [oci, api]
149
163
  end
150
-
151
- def launch(state, inst)
152
- state_details = inst.launch
153
- state.merge!(state_details)
154
- instance.transport.connection(state).wait_until_ready
155
- end
156
-
157
- def process_post_script(state)
158
- return if config[:post_create_script].nil?
159
-
160
- info("Running post create script")
161
- script = config[:post_create_script]
162
- instance.transport.connection(state).execute(script)
163
- end
164
-
165
- def reboot(state, inst)
166
- return unless config[:post_create_reboot]
167
-
168
- instance.transport.connection(state).close
169
- inst.reboot
170
- instance.transport.connection(state).wait_until_ready
171
- end
172
-
173
- def detatch_and_delete_volumes(state, oci, api)
174
- return unless state[:volumes]
175
-
176
- bls = Blockstorage.new(config: config, state: state, oci: oci, api: api, action: :destroy, logger: instance.logger)
177
- state[:volume_attachments].each { |att| bls.detatch_volume(att) }
178
- state[:volumes].each { |vol| bls.delete_volume(vol) }
179
- end
180
-
181
- def terminate(state, inst)
182
- instance.transport.connection(state).close
183
- inst.terminate
184
- if state[:ssh_key]
185
- FileUtils.rm_f(state[:ssh_key])
186
- FileUtils.rm_f("#{state[:ssh_key]}.pub")
187
- end
188
- end
189
164
  end
190
165
  end
191
166
  end
@@ -20,6 +20,8 @@
20
20
  module Kitchen
21
21
  module Driver
22
22
  # Version string for Oracle OCI Kitchen driver
23
- OCI_VERSION = "1.26.0"
23
+ #
24
+ # @author Stephen Pearson (<stephen.pearson@oracle.com>)
25
+ OCI_VERSION = "1.27.0"
24
26
  end
25
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.26.0
4
+ version: 1.27.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-01-17 00:00:00.000000000 Z
12
+ date: 2025-02-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: oci
@@ -109,6 +109,20 @@ dependencies:
109
109
  - - ">="
110
110
  - !ruby/object:Gem::Version
111
111
  version: '0'
112
+ - !ruby/object:Gem::Dependency
113
+ name: yard
114
+ requirement: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ version: '0'
119
+ type: :development
120
+ prerelease: false
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
112
126
  description: A Test Kitchen Driver for Oracle Cloud Infrastructure
113
127
  email:
114
128
  - stephen.pearson@oracle.com
@@ -128,18 +142,25 @@ files:
128
142
  - lib/kitchen/driver/oci/instance/database.rb
129
143
  - lib/kitchen/driver/oci/instance/db_home.rb
130
144
  - lib/kitchen/driver/oci/instance/dbaas.rb
131
- - lib/kitchen/driver/oci/models.rb
145
+ - lib/kitchen/driver/oci/mixin/actions.rb
146
+ - lib/kitchen/driver/oci/mixin/models.rb
147
+ - lib/kitchen/driver/oci/mixin/volumes.rb
132
148
  - lib/kitchen/driver/oci/models/compute.rb
133
149
  - lib/kitchen/driver/oci/models/dbaas.rb
134
150
  - lib/kitchen/driver/oci/models/iscsi.rb
135
151
  - lib/kitchen/driver/oci/models/paravirtual.rb
136
- - lib/kitchen/driver/oci/volumes.rb
137
152
  - lib/kitchen/driver/oci_version.rb
138
153
  - tpl/setup_winrm.ps1.erb
139
154
  homepage: https://github.com/stephenpearson/kitchen-oci
140
155
  licenses:
141
156
  - Apache-2.0
142
- metadata: {}
157
+ metadata:
158
+ bug_tracker_uri: https://github.com/stephenpearson/kitchen-oci/issues
159
+ changelog_uri: https://github.com/stephenpearson/kitchen-oci/blob/master/CHANGELOG.md
160
+ documentation_uri: https://github.com/stephenpearson/kitchen-oci/blob/master/README.md
161
+ homepage_uri: https://github.com/stephenpearson/kitchen-oci
162
+ source_code_uri: https://github.com/stephenpearson/kitchen-oci
163
+ rubygems_mfa_required: 'true'
143
164
  post_install_message:
144
165
  rdoc_options: []
145
166
  require_paths:
@@ -1,48 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- #
4
- # Author:: Justin Steele (<justin.steele@oracle.com>)
5
- #
6
- # Copyright (C) 2024, Stephen Pearson
7
- #
8
- # Licensed under the Apache License, Version 2.0 (the "License");
9
- # you may not use this file except in compliance with the License.
10
- # You may obtain a copy of the License at
11
- #
12
- # http://www.apache.org/licenses/LICENSE-2.0
13
- #
14
- # Unless required by applicable law or agreed to in writing, software
15
- # distributed under the License is distributed on an "AS IS" BASIS,
16
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
- # See the License for the specific language governing permissions and
18
- # limitations under the License.
19
-
20
- module Kitchen
21
- module Driver
22
- class Oci
23
- # models definitions
24
- module Models
25
- require_relative "instance"
26
- require_relative "blockstorage"
27
-
28
- def instance_class(config, state, oci, api, action)
29
- Oci::Models.const_get(config[:instance_type].capitalize).new(config: config, state: state, oci: oci, api: api, action: action, logger: instance.logger)
30
- end
31
-
32
- def volume_class(type, config, state, oci, api)
33
- Oci::Models.const_get(volume_attachment_type(type)).new(config: config, state: state, oci: oci, api: api, logger: instance.logger)
34
- end
35
-
36
- private
37
-
38
- def volume_attachment_type(type)
39
- if type.nil?
40
- "Paravirtual"
41
- else
42
- type.capitalize
43
- end
44
- end
45
- end
46
- end
47
- end
48
- end