Class: Tinychef::BootScript

Inherits:
Object
  • Object
show all
Defined in:
lib/tinychef/boot_script.rb

Constant Summary collapse

OPTIONS_ERROR =
<<-EOH
Required arguments:

  DEST:     ssh username@host string to use to connect to host.
  SCRIPT:   optional path to the boot script (boot.sh by default).
            You must craft your Chef Solo boot script by yourself, 
            something like this: https://gist.github.com/3153784

EOH

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(dest, script) ⇒ BootScript

Returns a new instance of BootScript.



20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/tinychef/boot_script.rb', line 20

def initialize(dest, script)
  script ||= 'boot.sh'

  begin
    @dest = Tinychef::Destination.new(dest)
    @script = Pathname.new(script)
  rescue => e
    raise OptionsError.new BootScript::OPTIONS_ERROR
  end
  
  file_check
end

Instance Attribute Details

#destObject (readonly)

Returns the value of attribute dest.



18
19
20
# File 'lib/tinychef/boot_script.rb', line 18

def dest
  @dest
end

#scriptObject (readonly)

Returns the value of attribute script.



18
19
20
# File 'lib/tinychef/boot_script.rb', line 18

def script
  @script
end

Instance Method Details

#runObject



33
34
35
36
# File 'lib/tinychef/boot_script.rb', line 33

def run
  push_to_remote
  execute_remote
end