Class: Chef::Knife::SoftlayerVlanCreate

Inherits:
Chef::Knife show all
Includes:
SoftlayerBase
Defined in:
lib/chef/knife/softlayer_vlan_create.rb

Constant Summary

Constants included from SoftlayerBase

Chef::Knife::SoftlayerBase::USER_AGENT

Instance Method Summary collapse

Methods included from SoftlayerBase

#compute, #connection, included, #locate_config_value, #msg_pair, #network

Instance Method Details

#runObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/chef/knife/softlayer_vlan_create.rb', line 18

def run

  $stdout.sync = true

  opts = {
    :name => ui.ask_question("Enter a vlan name: "),
    :datacenter => connection(:network).datacenters.by_name(ui.ask_question("Enter a datacenter name: ")),
    :router => {'hostname' => ui.ask_question("Enter a router hostname: ")},
    :network_space => ui.ask_question("Enter a network space: ", :default => 'PUBLIC'),
  }

  vlan = connection(:network).networks.create(opts)

  !!vlan and puts "#{ui.color("VLAN successfully created.  Provisioning may take a few minutes to complete.", :green)}"

end