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.
@@ -1,54 +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
- # mixin for working with volumes and attachments
24
- module Volumes
25
- def create_and_attach_volumes(config, state, oci, api)
26
- return if config[:volumes].empty?
27
-
28
- volume_state = process_volumes(config, state, oci, api)
29
- state.merge!(volume_state)
30
- end
31
-
32
- def process_volumes(config, state, oci, api)
33
- volume_state = { volumes: [], volume_attachments: [] }
34
- config[:volumes].each do |volume|
35
- vol = volume_class(volume[:type], config, state, oci, api)
36
- volume_details, vol_state = create_volume(vol, volume)
37
- attach_state = vol.attach_volume(volume_details, state[:server_id], volume)
38
- volume_state[:volumes] << vol_state
39
- volume_state[:volume_attachments] << attach_state
40
- end
41
- volume_state
42
- end
43
-
44
- def create_volume(vol, volume)
45
- if volume.key?(:volume_id)
46
- vol.create_clone_volume(volume)
47
- else
48
- vol.create_volume(volume)
49
- end
50
- end
51
- end
52
- end
53
- end
54
- end