Module: Boxcutter::Razor

Defined in:
lib/bluebox-boxcutter/razor.rb

Defined Under Namespace

Classes: StubbleClient

Constant Summary collapse

ENDPOINT =
'http://razor.sea03.blueboxgrid.com:80'
USER =
'boxpanel'
PASS =
'4nlpb4IFQxjx'

Class Method Summary collapse

Class Method Details

.image!(machine, tag_name) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/bluebox-boxcutter/razor.rb', line 39

def self.image!(machine, tag_name)
  raise "unknown razor tag #{tag_name}" unless StubbleClient.tags.include?(tag_name)
  mac = Boxcutter::Machine::eth0_mac(machine)

  raise "unknown mac" unless mac and mac =~ /[a-f0-9:]+/

  StubbleClient.delete_mac mac
  StubbleClient.add_mac_to_tag mac, tag_name

  Boxcutter.msg "switching machine into vlan 255."
  Boxcutter::Machine.switch_vlan! machine, 255

  Boxcutter.msg "initiating razor boot"
  Boxcutter::Machine.power_cycle! machine

  Boxcutter.msg "removing hardware token from Boxpanel machine record"
  Boxcutter::Machine.clear_hwtoken! machine      
end