class Chef::Knife::SoftlayerVlanCreate

Public Instance Methods

run() click to toggle source
# 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