Class: Chef::Knife::ProfitbricksDatacenterCreate
- Inherits:
-
Chef::Knife
- Object
- Chef::Knife
- Chef::Knife::ProfitbricksDatacenterCreate
- Includes:
- ProfitbricksBase
- Defined in:
- lib/chef/knife/profitbricks_datacenter_create.rb
Instance Method Summary collapse
Methods included from ProfitbricksBase
#connection, included, #msg_pair
Instance Method Details
#run ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/chef/knife/profitbricks_datacenter_create.rb', line 28 def run $stdout.sync = true print "#{ui.color('Creating data center...', :magenta)}" connection datacenter = ProfitBricks::Datacenter.create( name: config[:name], description: config[:description], location: config[:location] ) dot = ui.color('.', :magenta) datacenter.wait_for { print dot; ready? } datacenter.reload puts "\n" puts "#{ui.color('ID', :cyan)}: #{datacenter.id}" puts "#{ui.color('Name', :cyan)}: #{datacenter.properties['name']}" puts "#{ui.color('Description', :cyan)}: #{datacenter.properties['description']}" puts "#{ui.color('Location', :cyan)}: #{datacenter.properties['location']}" puts 'done' end |