kitchen-oci 1.18.1 → 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: dc3416b97957d72c5262acfed751b388a1387a5e18b85fc02193bc88c2283c72
4
- data.tar.gz: 2946ba6f22ac36f50e6699c8d20acbf628ba19ad0d6f80b042d89f3e269aff20
3
+ metadata.gz: f1d7c6a979b6b660f6276347dac37a38939ce1d5052983d99501afac1a2ddf9f
4
+ data.tar.gz: b5863f89a61b48ecb90d22aae58d5f0cd841a75ec4c61c61bf84608f3f7938cf
5
5
  SHA512:
6
- metadata.gz: 5c260f31d16ba17bfdffb4384b93263d7ffe415e45c65a1f6c7b432ca78aa0cc89f14140988cbe9918c01b2c7b2496b2126d3584bc8792e4a31c954b2a6164e0
7
- data.tar.gz: d7ba936db2bc7d265bab692250a595b2b94bfe9f5fe85dd9536e5d6b583bb68454c56d5d8240df5042b27b667d5c94063a4f2f3fa14d6ba4db31769e1904ad4c
6
+ metadata.gz: daad8d4224903f776c41405d6c7d53b021a476b176cfe21887e90f5ba385815b3117383f80ac6bd28969678c272d564e66cb5e0635486d89345149a77397f33b
7
+ data.tar.gz: c2a6482d468e9b52dd0187c20e7e7569b19a05a99fa2281299f893f5b0fe6468d7ee4e684fdc7a0783b4ffb529117ddc82ac7ef14acc9345bc44f8c050e29936
@@ -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
@@ -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.1"
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.1
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-06 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: []