Class: Kitchen::Provisioner::Dokken
- Inherits:
-
ChefInfra
- Object
- ChefInfra
- Kitchen::Provisioner::Dokken
- Defined in:
- lib/kitchen/provisioner/dokken.rb
Overview
Instance Method Summary collapse
- #call(state) ⇒ Object
-
#check_license ⇒ Object
Override the parent’s check_license to skip the kitchen-omnibus-chef deprecation warning.
- #validate_config ⇒ Object
Instance Method Details
#call(state) ⇒ Object
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/kitchen/provisioner/dokken.rb', line 66 def call(state) create_sandbox write_run_command(run_command) instance.transport.connection(state) do |conn| if remote_docker_host? || running_inside_docker? info("Transferring files to #{instance.to_str}") conn.upload(sandbox_dirs, config[:root_path]) end conn.execute(prepare_command) conn.execute_with_retry( "sh #{config[:root_path]}/run_command", config[:retry_on_exit_code], config[:max_retries], config[:wait_for_retry] ) end rescue Kitchen::Transport::TransportFailed => ex raise ActionFailed, ex. ensure cleanup_dokken_sandbox if config[:clean_dokken_sandbox] # rubocop: disable Lint/EnsureReturn end |
#check_license ⇒ Object
Override the parent’s check_license to skip the kitchen-omnibus-chef deprecation warning. That warning concerns the omnibus download mechanism, which dokken does not use — the chef/cinc binary is mounted from a volume container, not downloaded via omnitruck.
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/kitchen/provisioner/dokken.rb', line 93 def check_license name = license_acceptance_id version = product_version debug("Checking if we need to prompt for license acceptance on product: #{name} version: #{version}.") acceptor = LicenseAcceptance::Acceptor.new(logger: Kitchen.logger, provided: config[:chef_license]) return unless acceptor.license_required?(name, version) debug("License acceptance required for #{name} version: #{version}. Prompting") license_id = acceptor.id_from_mixlib(name) begin acceptor.check_and_persist(license_id, version.to_s) rescue LicenseAcceptance::LicenseNotAcceptedError => e error("Cannot converge without accepting the #{e.product.pretty_name} License. Set it in your kitchen.yml or using the CHEF_LICENSE environment variable") raise end config[:chef_license] ||= acceptor.acceptance_value end |
#validate_config ⇒ Object
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
# File 'lib/kitchen/provisioner/dokken.rb', line 112 def validate_config # check if we have an space for the user provided options # or add it if not to avoid issues unless config[:chef_options].start_with? " " config[:chef_options].prepend(" ") end # strip spaces from all other options config[:chef_binary] = config[:chef_binary].strip config[:chef_log_level] = config[:chef_log_level].strip config[:chef_output_format] = config[:chef_output_format].strip # if the user wants to be funny and pass empty strings # just use the defaults config[:chef_log_level] = "warn" if config[:chef_log_level].empty? config[:chef_output_format] = "doc" if config[:chef_output_format].empty? end |