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, #error_and_exit, #get_image, included, #msg_pair, #validate_required_params
Instance Method Details
#run ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/chef/knife/profitbricks_datacenter_create.rb', line 27 def run $stdout.sync = true validate_required_params(%i(name location), Chef::Config[:knife]) print "#{ui.color('Creating data center...', :magenta)}" connection datacenter = ProfitBricks::Datacenter.create( name: Chef::Config[:knife][:name], description: Chef::Config[:knife][:description], location: Chef::Config[:knife][:location] ) dot = ui.color('.', :magenta) datacenter.wait_for { print dot; ready? } @dcid = datacenter.id 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 |