Sha256: 4e336ca6c0d69e47f7222b1ed3569c3b8188e02ec72ec350634f1ca402c56433

Contents?: true

Size: 1.19 KB

Versions: 1

Compression:

Stored size: 1.19 KB

Contents

require 'kitchen/provisioner/chef_zero'
require 'kitchen-appbundle-updater/helpers'

module Kitchen
  module Provisioner
    class ChefGithub < Kitchen::Provisioner::ChefZero
      default_config :refname, "master"
      default_config :github_owner, "chef"
      default_config :github_repo, "chef"

      def create_sandbox
        super
        dna = {
          chef_appbundle_updater: {
            github_org: config[:github_owner],
            github_repo: config[:github_repo],
            refname: config[:refname]
          }
        }

        File.open(File.join(sandbox_path, 'dna_updater.json'), "wb") do |f|
          f.write(dna.to_json)
        end
      end

      def prepare_command
        [
          prepare_command_vars,
          KitchenAppbundleUpdater::Helpers.load_file("chef_base_updater", powershell_shell?)
        ].join("\n")
      end

      def prepare_command_vars
        vars = [
          shell_var("json", File.join(config[:root_path], 'dna_updater.json')),
          shell_var("chef_omnibus_root", config[:chef_omnibus_root]),
        ]

        if powershell_shell?
          vars.join("\n")
        else
          vars.join(";\n")
        end
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
kitchen-appbundle-updater-0.0.1 lib/kitchen/provisioner/chef_github.rb