Class: Chef::Knife::ProfitbricksIpblockCreate

Inherits:
Chef::Knife
  • Object
show all
Includes:
ProfitbricksBase
Defined in:
lib/chef/knife/profitbricks_ipblock_create.rb

Instance Method Summary collapse

Methods included from ProfitbricksBase

#connection, included, #msg_pair

Instance Method Details

#runObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/chef/knife/profitbricks_ipblock_create.rb', line 22

def run
  $stdout.sync = true

  print "#{ui.color('Allocating IP block...', :magenta)}"

  connection
  ipblock = ProfitBricks::IPBlock.create(
    location: config[:location],
    size: config[:size]
  )

  dot = ui.color('.', :magenta)
  ipblock.wait_for { print dot; ready? }

  puts "\n"
  puts "#{ui.color('ID', :cyan)}: #{ipblock.id}"
  puts "#{ui.color('Location', :cyan)}: #{ipblock.properties['location']}"
  puts "#{ui.color('IP Addresses', :cyan)}: #{ipblock.properties['ips']}"

  puts 'done'
end