Class: Provisioner::Command::Bootstrap::HostCommand
- Inherits:
-
Object
- Object
- Provisioner::Command::Bootstrap::HostCommand
- Defined in:
- lib/provisioner/command/bootstrap.rb
Instance Attribute Summary collapse
-
#context ⇒ Object
Returns the value of attribute context.
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
- #bootstrap_command ⇒ Object
-
#initialize(name, context) ⇒ HostCommand
constructor
A new instance of HostCommand.
- #ip_for_host ⇒ Object
- #reset_command ⇒ Object
Constructor Details
#initialize(name, context) ⇒ HostCommand
Returns a new instance of HostCommand.
25 26 27 28 |
# File 'lib/provisioner/command/bootstrap.rb', line 25 def initialize(name, context) @name = name @context = context end |
Instance Attribute Details
#context ⇒ Object
Returns the value of attribute context.
24 25 26 |
# File 'lib/provisioner/command/bootstrap.rb', line 24 def context @context end |
#name ⇒ Object
Returns the value of attribute name.
24 25 26 |
# File 'lib/provisioner/command/bootstrap.rb', line 24 def name @name end |
Instance Method Details
#bootstrap_command ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# 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 ⇒ Object
30 31 32 |
# File 'lib/provisioner/command/bootstrap.rb', line 30 def ip_for_host Provisioner::HostIP.ip_for name end |
#reset_command ⇒ Object
34 35 36 |
# 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 |