Class: Kitchen::Driver::Oci
- Inherits:
-
Base
- Object
- Base
- Kitchen::Driver::Oci
- Defined in:
- lib/kitchen/driver/oci.rb
Overview
Oracle OCI driver for Kitchen.
Instance Method Summary collapse
- #create(state) ⇒ Object
- #destroy(state) ⇒ Object
- #process_freeform_tags(freeform_tags) ⇒ Object
- #process_windows_options(state) ⇒ Object
Instance Method Details
#create(state) ⇒ Object
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/kitchen/driver/oci.rb', line 73 def create(state) return if state[:server_id] state = (state) instance_id = launch_instance(state) state[:server_id] = instance_id state[:hostname] = instance_ip(instance_id) instance.transport.connection(state).wait_until_ready return unless config[:post_create_script] info('Running post create script') script = config[:post_create_script] instance.transport.connection(state).execute(script) end |
#destroy(state) ⇒ Object
92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/kitchen/driver/oci.rb', line 92 def destroy(state) return unless state[:server_id] instance.transport.connection(state).close if instance_type == 'compute' comp_api.terminate_instance(state[:server_id]) elsif instance_type == 'dbaas' dbaas_api.terminate_db_system(state[:server_id]) end state.delete(:server_id) state.delete(:hostname) end |
#process_freeform_tags(freeform_tags) ⇒ Object
107 108 109 110 111 112 113 114 115 |
# File 'lib/kitchen/driver/oci.rb', line 107 def () prov = instance.provisioner.instance_variable_get(:@config) = %w[run_list policyfile] .each do |tag| [tag] = prov[tag.to_sym].join(',') unless prov[tag.to_sym].nil? || prov[tag.to_sym].empty? end [:kitchen] = true end |
#process_windows_options(state) ⇒ Object
117 118 119 120 121 122 123 124 125 |
# File 'lib/kitchen/driver/oci.rb', line 117 def (state) state[:username] = config[:winrm_user] if config[:setup_winrm] if config[:setup_winrm] == true && config[:password].nil? && state[:password].nil? state[:password] = config[:winrm_password] || random_password end state end |