kitchen-oci 1.18.0 → 1.19.0

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
  SHA256:
3
- metadata.gz: 04441716ec20ae5cf111a087f07990af96826770804f92a67edaa7335622391a
4
- data.tar.gz: 378640fe182082b49904fcef4671c7954bb794a51090c7e29a74ad25128addd0
3
+ metadata.gz: f1d7c6a979b6b660f6276347dac37a38939ce1d5052983d99501afac1a2ddf9f
4
+ data.tar.gz: b5863f89a61b48ecb90d22aae58d5f0cd841a75ec4c61c61bf84608f3f7938cf
5
5
  SHA512:
6
- metadata.gz: 8cddfba0d04e8a8634656694b1158e9ea6e87eed48bb78b1f949d32aa2b2d0e58de38326c802da9ece1de1d5da209eab75c6b7d6e1e6f2c0e7224fa1dc81033a
7
- data.tar.gz: 7ed171e81ff8ab9d2559df7b9a4bab80d5d7fee5440ac0816971def8b48e6d4e65eed1b098b2f95cd1d5658e702c8523e053d05998a2929cb41636b846f4d674
6
+ metadata.gz: daad8d4224903f776c41405d6c7d53b021a476b176cfe21887e90f5ba385815b3117383f80ac6bd28969678c272d564e66cb5e0635486d89345149a77397f33b
7
+ data.tar.gz: c2a6482d468e9b52dd0187c20e7e7569b19a05a99fa2281299f893f5b0fe6468d7ee4e684fdc7a0783b4ffb529117ddc82ac7ef14acc9345bc44f8c050e29936
@@ -66,13 +66,19 @@ module Kitchen
66
66
  def generic_api(klass)
67
67
  params = {}
68
68
  params[:proxy_settings] = api_proxy if api_proxy
69
- params[:signer] = if config[:use_instance_principals]
70
- OCI::Auth::Signers::InstancePrincipalsSecurityTokenSigner.new
71
- elsif config[:use_token_auth]
72
- token_signer
73
- end
69
+ params[:signer] = signer
74
70
  params[:config] = oci_config unless config[:use_instance_principals]
75
- klass.new(**params.compact)
71
+ # this is to accommodate old versions of ruby that do not have a compact method on a Hash
72
+ params.reject! { |_, v| v.nil? }
73
+ klass.new(**params)
74
+ end
75
+
76
+ def signer
77
+ if config[:use_instance_principals]
78
+ OCI::Auth::Signers::InstancePrincipalsSecurityTokenSigner.new
79
+ elsif config[:use_token_auth]
80
+ token_signer
81
+ end
76
82
  end
77
83
 
78
84
  def token_signer
@@ -65,7 +65,9 @@ module Kitchen
65
65
  end
66
66
 
67
67
  def config_loader(opts = {})
68
- OCI::ConfigFileLoader.load_config(**opts.compact)
68
+ # this is to accommodate old versions of ruby that do not have a compact method on a Hash
69
+ opts.reject! { |_, v| v.nil? }
70
+ OCI::ConfigFileLoader.load_config(**opts)
69
71
  rescue OCI::ConfigFileLoader::Errors::ConfigFileNotFoundError
70
72
  OCI::Config.new
71
73
  end
@@ -42,7 +42,7 @@ module Kitchen
42
42
  process_windows_options
43
43
  response = api.compute.launch_instance(launch_instance_details)
44
44
  instance_id = response.data.id
45
- api.compute.get_instance(instance_id).wait_until(:lifecycle_state, OCI::Core::Models::Instance::LIFECYCLE_STATE_RUNNING )
45
+ api.compute.get_instance(instance_id).wait_until(:lifecycle_state, OCI::Core::Models::Instance::LIFECYCLE_STATE_RUNNING)
46
46
  final_state(state, instance_id)
47
47
  end
48
48
 
@@ -51,6 +51,11 @@ module Kitchen
51
51
  api.compute.get_instance(state[:server_id]).wait_until(:lifecycle_state, OCI::Core::Models::Instance::LIFECYCLE_STATE_TERMINATING)
52
52
  end
53
53
 
54
+ def reboot
55
+ api.compute.instance_action(state[:server_id], "SOFTRESET")
56
+ api.compute.get_instance(state[:server_id]).wait_until(:lifecycle_state, OCI::Core::Models::Instance::LIFECYCLE_STATE_RUNNING)
57
+ end
58
+
54
59
  private
55
60
 
56
61
  def image_id
@@ -63,7 +68,7 @@ module Kitchen
63
68
 
64
69
  def image_id_by_name
65
70
  image_name = config[:image_name].gsub(" ", "-")
66
- image_list = images.select { |i| i.display_name.match?(/#{image_name}/) }
71
+ image_list = images.select { |i| i.display_name.match(/#{image_name}/) }
67
72
  raise "unable to find image_id" if image_list.empty?
68
73
 
69
74
  image_list = filter_image_list(image_list, image_name) if image_list.count > 1
@@ -73,7 +78,7 @@ module Kitchen
73
78
  end
74
79
 
75
80
  def filter_image_list(image_list, image_name)
76
- image_list.select { |i| i.display_name.match?(/#{image_name}-[0-9]{4}\.[0-9]{2}\.[0-9]{2}/) }
81
+ image_list.select { |i| i.display_name.match(/#{image_name}-[0-9]{4}\.[0-9]{2}\.[0-9]{2}/) }
77
82
  end
78
83
 
79
84
  def latest_image_id(image_list)
@@ -69,6 +69,12 @@ module Kitchen
69
69
  max_interval_seconds: 900, max_wait_seconds: 21_600)
70
70
  end
71
71
 
72
+ def reboot
73
+ db_node_id = dbaas_node(state[:server_id]).first.id
74
+ api.dbaas.db_node_action(db_node_id, "SOFTRESET")
75
+ api.dbaas.get_db_node(db_node_id).wait_until(:lifecycle_state, OCI::Database::Models::DbNode::LIFECYCLE_STATE_AVAILABLE)
76
+ end
77
+
72
78
  private
73
79
 
74
80
  def instance_ip(instance_id)
@@ -71,6 +71,7 @@ module Kitchen
71
71
  default_config :all_plugins_disabled, false
72
72
  default_config :management_disabled, false
73
73
  default_config :monitoring_disabled, false
74
+ default_config :post_create_reboot, false
74
75
 
75
76
  # compute only configs
76
77
  default_config :setup_winrm, false
@@ -112,21 +113,19 @@ module Kitchen
112
113
  validate_config!
113
114
  oci, api = auth(__method__)
114
115
  inst = instance_class(config, state, oci, api, __method__)
115
- state_details = inst.launch
116
- state.merge!(state_details)
117
- instance.transport.connection(state).wait_until_ready
116
+ launch(state, inst)
118
117
  create_and_attach_volumes(config, state, oci, api)
119
118
  process_post_script(state)
119
+ reboot(state, inst)
120
120
  end
121
121
 
122
122
  def destroy(state)
123
123
  return unless state[:server_id]
124
124
 
125
125
  oci, api = auth(__method__)
126
- instance.transport.connection(state).close
127
- detatch_and_delete_volumes(state, oci, api) if state[:volumes]
128
126
  inst = instance_class(config, state, oci, api, __method__)
129
- inst.terminate
127
+ detatch_and_delete_volumes(state, oci, api)
128
+ terminate(state, inst)
130
129
  end
131
130
 
132
131
  private
@@ -138,6 +137,12 @@ module Kitchen
138
137
  [oci, api]
139
138
  end
140
139
 
140
+ def launch(state, inst)
141
+ state_details = inst.launch
142
+ state.merge!(state_details)
143
+ instance.transport.connection(state).wait_until_ready
144
+ end
145
+
141
146
  def create_and_attach_volumes(config, state, oci, api)
142
147
  return if config[:volumes].empty?
143
148
 
@@ -152,12 +157,6 @@ module Kitchen
152
157
  state.merge!(volume_state)
153
158
  end
154
159
 
155
- def detatch_and_delete_volumes(state, oci, api)
156
- bls = Blockstorage.new(config, state, oci, api, :destroy)
157
- state[:volume_attachments].each { |att| bls.detatch_volume(att) }
158
- state[:volumes].each { |vol| bls.delete_volume(vol) }
159
- end
160
-
161
160
  def process_post_script(state)
162
161
  return if config[:post_create_script].nil?
163
162
 
@@ -165,6 +164,27 @@ module Kitchen
165
164
  script = config[:post_create_script]
166
165
  instance.transport.connection(state).execute(script)
167
166
  end
167
+
168
+ def reboot(state, inst)
169
+ return unless config[:post_create_reboot]
170
+
171
+ instance.transport.connection(state).close
172
+ inst.reboot
173
+ instance.transport.connection(state).wait_until_ready
174
+ end
175
+
176
+ def detatch_and_delete_volumes(state, oci, api)
177
+ return unless state[:volumes]
178
+
179
+ bls = Blockstorage.new(config, state, oci, api, :destroy)
180
+ state[:volume_attachments].each { |att| bls.detatch_volume(att) }
181
+ state[:volumes].each { |vol| bls.delete_volume(vol) }
182
+ end
183
+
184
+ def terminate(state, inst)
185
+ instance.transport.connection(state).close
186
+ inst.terminate
187
+ end
168
188
  end
169
189
  end
170
190
  end
@@ -20,6 +20,6 @@
20
20
  module Kitchen
21
21
  module Driver
22
22
  # Version string for Oracle OCI Kitchen driver
23
- OCI_VERSION = "1.18.0"
23
+ OCI_VERSION = "1.19.0"
24
24
  end
25
25
  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.18.0
4
+ version: 1.19.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: 2024-04-04 00:00:00.000000000 Z
12
+ date: 2024-04-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: oci
@@ -109,7 +109,7 @@ dependencies:
109
109
  - - ">="
110
110
  - !ruby/object:Gem::Version
111
111
  version: '0'
112
- description: A Test Kitchen Driver for Oracle OCI
112
+ description: A Test Kitchen Driver for Oracle Cloud Infrastructure
113
113
  email:
114
114
  - stephen.pearson@oracle.com
115
115
  - justin.steele@oracle.com
@@ -157,5 +157,5 @@ requirements: []
157
157
  rubygems_version: 3.3.7
158
158
  signing_key:
159
159
  specification_version: 4
160
- summary: A Test Kitchen Driver for Oracle OCI
160
+ summary: A Test Kitchen Driver for Oracle Cloud Infrastructure
161
161
  test_files: []