class Provisioner::Command::Bootstrap::HostCommand

Attributes

context[RW]
name[RW]

Public Class Methods

new(name, context) click to toggle source
# File lib/provisioner/command/bootstrap.rb, line 25
def initialize(name, context)
  @name = name
  @context = context
end

Public Instance Methods

bootstrap_command() click to toggle source
# File lib/provisioner/command/bootstrap.rb, line 38
def bootstrap_command
  bootstrap_command = [
      'knife bootstrap',
      ip_for_host,
      "--bootstrap-template #{context.distro}",
      "--environment #{context.environment}",
      "--node-name #{name}",
  ]

  bootstrap_command << "--run-list #{context.run_list}" if context.run_list
  bootstrap_command << "--ssh-user #{context.ssh_user}"
  bootstrap_command << '--sudo' if context.use_sudo?
  bootstrap_command << "2>&1 > #{context.log_dir}/#{name}_provision.log &"
  bootstrap_command.join(' ')
end
ip_for_host() click to toggle source
# File lib/provisioner/command/bootstrap.rb, line 30
def ip_for_host
  Provisioner::HostIP.ip_for name
end
reset_command() click to toggle source
# File lib/provisioner/command/bootstrap.rb, line 34
def reset_command
  "ssh #{ip_for_host} -l #{context.ssh_user} 'sudo rm -rf /etc/chef'"
end