Class: Kitchen::Verifier::Base
- Inherits:
-
Object
- Object
- Kitchen::Verifier::Base
- Defined in:
- lib/kitchen/helpers.rb
Instance Method Summary collapse
Instance Method Details
#call(state) ⇒ Object
309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 |
# File 'lib/kitchen/helpers.rb', line 309 def call(state) create_sandbox instance.transport.connection(state) do |conn| conn.execute(install_command) unless state[:data_container].nil? conn.execute(init_command) info("Transferring files to #{instance.to_str}") conn.upload(sandbox_dirs, config[:root_path]) debug('Transfer complete') end conn.execute(prepare_command) conn.execute(run_command) end rescue Kitchen::Transport::TransportFailed => ex raise ActionFailed, ex. end |
#create_sandbox ⇒ Object
292 293 294 295 296 297 298 |
# File 'lib/kitchen/helpers.rb', line 292 def create_sandbox info("Creating kitchen sandbox in #{sandbox_path}") unless ::Dir.exist?(sandbox_path) FileUtils.mkdir_p(sandbox_path) File.chmod(0o755, sandbox_path) end end |
#instance_name ⇒ Object
304 305 306 307 |
# File 'lib/kitchen/helpers.rb', line 304 def instance_name prefix = (Digest::SHA2.hexdigest FileUtils.pwd)[0, 10] "#{prefix}-#{instance.name}" end |
#sandbox_path ⇒ Object
300 301 302 |
# File 'lib/kitchen/helpers.rb', line 300 def sandbox_path "#{Dir.home}/.dokken/verifier_sandbox/#{instance_name}" end |