kitchen-oci 1.19.0 → 1.20.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f1d7c6a979b6b660f6276347dac37a38939ce1d5052983d99501afac1a2ddf9f
4
- data.tar.gz: b5863f89a61b48ecb90d22aae58d5f0cd841a75ec4c61c61bf84608f3f7938cf
3
+ metadata.gz: d605c9336d53fbeff2b9b87b00a3c862615d4f46d301ec2fe1deafa43922c39c
4
+ data.tar.gz: ad8c34ef492edc7b2b6912726cc7978d50ac4a370a624e3640f1fb3931cbbf37
5
5
  SHA512:
6
- metadata.gz: daad8d4224903f776c41405d6c7d53b021a476b176cfe21887e90f5ba385815b3117383f80ac6bd28969678c272d564e66cb5e0635486d89345149a77397f33b
7
- data.tar.gz: c2a6482d468e9b52dd0187c20e7e7569b19a05a99fa2281299f893f5b0fe6468d7ee4e684fdc7a0783b4ffb529117ddc82ac7ef14acc9345bc44f8c050e29936
6
+ metadata.gz: 27b2cd8c880fd1faff1012abbcaa2a703813841051962c3653c02b2503e07565718a101595dbe1affcba513cd86bd6adcd2a700af97212da9ba420f16cda8921
7
+ data.tar.gz: 7bc6d52865dd933e2c4fdf896bc11649af610c92e74782821da6bf7cd6525bffabffb0735c9e30261a538d36c82f2c48f5e1e333c356cf1a7712dc6636847d90
@@ -57,7 +57,9 @@ module Kitchen
57
57
  )
58
58
  end
59
59
 
60
- def instance_source_details
60
+ def instance_source_via_image
61
+ return if config[:boot_volume_id]
62
+
61
63
  launch_details.source_details = OCI::Core::Models::InstanceSourceViaImageDetails.new(
62
64
  sourceType: "image",
63
65
  imageId: image_id,
@@ -65,6 +67,15 @@ module Kitchen
65
67
  )
66
68
  end
67
69
 
70
+ def instance_source_via_boot_volume
71
+ return unless config[:boot_volume_id]
72
+
73
+ launch_details.source_details = OCI::Core::Models::InstanceSourceViaBootVolumeDetails.new(
74
+ boot_volume_id: clone_boot_volume,
75
+ sourceType: "bootVolume"
76
+ )
77
+ end
78
+
68
79
  def instance_metadata
69
80
  launch_details.metadata = metadata
70
81
  end
@@ -22,6 +22,12 @@ module Kitchen
22
22
  class Instance
23
23
  # setter methods that populate the details of OCI::Database::Models::CreateDatabaseDetails
24
24
  module DatabaseDetails
25
+ def database_software_image
26
+ return unless config[:dbaas][:db_software_image_id]
27
+
28
+ database_details.database_software_image_id = config[:dbaas][:db_software_image_id]
29
+ end
30
+
25
31
  def character_set
26
32
  database_details.character_set = config[:dbaas][:character_set] ||= "AL32UTF8"
27
33
  end
@@ -35,6 +35,12 @@ module Kitchen
35
35
  def db_home_display_name
36
36
  db_home_details.display_name = ["dbhome", random_number(10)].compact.join
37
37
  end
38
+
39
+ def db_home_software_image
40
+ return unless config[:dbaas][:db_software_image_id]
41
+
42
+ db_home_details.database_software_image_id = config[:dbaas][:db_software_image_id]
43
+ end
38
44
  end
39
45
  end
40
46
  end
@@ -29,7 +29,6 @@ module Kitchen
29
29
  include DbHomeDetails
30
30
  #
31
31
  # TODO: add support for the #domain property
32
- # add support for #database_software_image_id property
33
32
  #
34
33
  def db_home
35
34
  launch_details.db_home = db_home_details
@@ -93,6 +93,28 @@ module Kitchen
93
93
  image_list.flatten
94
94
  end
95
95
 
96
+ def clone_boot_volume
97
+ info("Cloning boot volume...")
98
+ cbv = api.blockstorage.create_boot_volume(clone_boot_volume_details)
99
+ api.blockstorage.get_boot_volume(cbv.data.id).wait_until(:lifecycle_state, OCI::Core::Models::BootVolume::LIFECYCLE_STATE_AVAILABLE)
100
+ info("Finished cloning boot volume.")
101
+ cbv.data.id
102
+ end
103
+
104
+ def clone_boot_volume_details
105
+ OCI::Core::Models::CreateBootVolumeDetails.new(
106
+ source_details: OCI::Core::Models::BootVolumeSourceFromBootVolumeDetails.new(
107
+ id: config[:boot_volume_id]
108
+ ),
109
+ display_name: boot_volume_display_name,
110
+ compartment_id: oci.compartment
111
+ )
112
+ end
113
+
114
+ def boot_volume_display_name
115
+ "#{api.blockstorage.get_boot_volume(config[:boot_volume_id]).data.display_name} (Clone)"
116
+ end
117
+
96
118
  def instance_ip(instance_id)
97
119
  vnic = vnics(instance_id).select(&:is_primary).first
98
120
  if public_ip_allowed?
@@ -114,7 +136,7 @@ module Kitchen
114
136
  end
115
137
 
116
138
  def hostname
117
- [config[:hostname_prefix], random_string(6)].compact.join("-")
139
+ %W{#{config[:hostname_prefix]} #{config[:instance_name]} #{random_string(6)}}.uniq.compact.join("-")
118
140
  end
119
141
 
120
142
  def create_vnic_details(name)
@@ -52,10 +52,14 @@ module Kitchen
52
52
  default_config :compartment_name, nil
53
53
  default_config :instance_type, "compute"
54
54
  default_config :image_id, nil
55
+ default_config :boot_volume_id, nil
55
56
  default_config :image_name, nil
56
57
  default_config :hostname_prefix do |hnp|
57
58
  hnp.instance.name
58
59
  end
60
+ default_config :instance_name do |inst|
61
+ inst.instance.name
62
+ end
59
63
  default_keypath = File.expand_path(File.join(%w{~ .ssh id_rsa.pub}))
60
64
  default_config :ssh_keypath, default_keypath
61
65
  default_config :post_create_script, nil
@@ -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.19.0"
23
+ OCI_VERSION = "1.20.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.19.0
4
+ version: 1.20.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-16 00:00:00.000000000 Z
12
+ date: 2024-05-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: oci