Sha256: 6c98cf8aff07165bb613b4c04afa3e774fbd8662c37c9bc3d445a6efb8d381f5

Contents?: true

Size: 1.04 KB

Versions: 2

Compression:

Stored size: 1.04 KB

Contents

require 'chef/knife'
require 'chef/knife/solo_cook'
require 'chef/knife/solo_prepare'

require 'knife-solo/ssh_command'

class Chef
  class Knife
    class SoloBootstrap < Knife
      include KnifeSolo::SshCommand

      deps do
        KnifeSolo::SshCommand.load_deps
        SoloPrepare.load_deps
        SoloCook.load_deps
      end

      banner "knife solo bootstrap [USER@]HOSTNAME [JSON] (options)"

      # Use (some) options from prepare and cook commands
      self.options = SoloPrepare.options
      [:librarian, :sync_only, :why_run].each { |opt| option opt, SoloCook.options[opt] }

      def run
        validate!

        prepare = command_with_same_args(SoloPrepare)
        prepare.run

        cook = command_with_same_args(SoloCook)
        cook.config[:chef_check] = false
        cook.run
      end

      def validate!
        validate_ssh_options!
      end

      def command_with_same_args(klass)
        cmd = klass.new
        cmd.ui = ui
        cmd.name_args = @name_args
        cmd.config = config
        cmd
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
knife-solo-0.3.0.pre2 lib/chef/knife/solo_bootstrap.rb
knife-solo-0.3.0.pre1 lib/chef/knife/solo_bootstrap.rb