Class: Chef::Knife::ProfitbricksServerCreate
- Inherits:
-
Chef::Knife
- Object
- Chef::Knife
- Chef::Knife::ProfitbricksServerCreate
- Includes:
- ProfitbricksBase
- Defined in:
- lib/chef/knife/profitbricks_server_create.rb
Instance Method Summary collapse
Methods included from ProfitbricksBase
#connection, included, #msg_pair
Instance Method Details
#run ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/chef/knife/profitbricks_server_create.rb', line 55 def run $stdout.sync = true print "#{ui.color('Creating server...', :magenta)}" params = { name: config[:name], cores: config[:cores], cpuFamily: config[:cpufamily], ram: config[:ram], availabilityZone: config[:availabilityzone], bootVolume: config[:bootvolume], bootCdrom: config[:bootcdrom] } connection server = ProfitBricks::Server.create( config[:datacenter_id], params.compact ) dot = ui.color('.', :magenta) server.wait_for { print dot; ready? } server.reload puts "\n" puts "#{ui.color('ID', :cyan)}: #{server.id}" puts "#{ui.color('Name', :cyan)}: #{server.properties['name']}" puts "#{ui.color('Cores', :cyan)}: #{server.properties['cores']}" puts "#{ui.color('CPU Family', :cyan)}: #{server.properties['cpuFamily']}" puts "#{ui.color('Ram', :cyan)}: #{server.properties['ram']}" puts "#{ui.color('Availability Zone', :cyan)}: #{server.properties['availabilityZone']}" puts "#{ui.color('Boot Volume', :cyan)}: #{server.properties['bootVolume']}" puts "#{ui.color('Boot CDROM', :cyan)}: #{server.properties['bootCdrom']}" puts 'done' end |