lib/chef-workflow/support/vm/knife.rb
#
# Bootstraps a single node. Validates bootstrap by checking the node metadata
# directly and ensuring it made it into the chef server.
#
Bootstraps a single node. Validates bootstrap by checking the node metadata
directly and ensuring it made it into the chef server.
Bootstraps a single node . Validates bootstrap by checking the node metadata directly and ensuring it made it into the chef server .
def bootstrap(node_name, ip)
    args = []
    args += %W[-x #{username}]                    if username
    args += %W[-P #{password}]                    if password
    args += %w[--sudo]                            if use_sudo
    args += %W[-i #{ssh_key}]                     if ssh_key
    args += %W[--template-file #{template_file}]  if template_file
    args += %W[-p #{port}]                        if port 
    args += %W[-E #{environment}]                 if environment
    @run_list ||= ["role[#{name}]"]
    args += %W[-r '#{run_list.join(",")}']
    args += %W[-N '#{node_name}']
    args += [ip]
    bootstrap_cli = init_knife_plugin(Chef::Knife::Bootstrap, args)
    Thread.new do
      bootstrap_cli.run
      run_list_size = Chef::Node.load(node_name).run_list.to_a.size
      unless run_list_size > 0
        puts bootstrap_cli.ui.stdout.string
        puts bootstrap_cli.ui.stderr.string
        raise "bootstrap for #{node_name}/#{ip} wasn't successful."
      end
      if_debug(2) do
        puts bootstrap_cli.ui.stdout.string
        puts bootstrap_cli.ui.stderr.string
      end
    end
  end
def bootstrap ( node_name , ip ) args = [ ] args += %W[ -x #{ username } ] if username args += %W[ -P #{ password } ] if password args += %w[ --sudo ] if use_sudo args += %W[ -i #{ ssh_key } ] if ssh_key args += %W[ --template-file #{ template_file } ] if template_file args += %W[ -p #{ port } ] if port args += %W[ -E #{ environment } ] if environment @run_list ||= [ "role[#{name}]" ] args += %W[ -r ' #{ run_list . join ( "," ) } ' ] args += %W[ -N ' #{ node_name } ' ] args += [ ip ] bootstrap_cli = init_knife_plugin ( Chef :: Knife :: Bootstrap , args ) Thread . new do bootstrap_cli . run run_list_size = Chef :: Node . load ( node_name ) . run_list . to_a . size unless run_list_size > 0 puts bootstrap_cli . ui . stdout . string puts bootstrap_cli . ui . stderr . string raise "bootstrap for #{node_name}/#{ip} wasn't successful." end if_debug ( 2 ) do puts bootstrap_cli . ui . stdout . string puts bootstrap_cli . ui . stderr . string end end end
Bootstraps a single node.
Bootstraps a single node .
# knife bootstrap is the honey badger when it comes to exit status. # We can't rely on it, so we examine the run_list of the node instead # to ensure it converged.
node_name
<not_specific>
ip
<not_specific>