class Chef::Knife::SoftlayerFlavorList

Public Instance Methods

run() click to toggle source

Run the procedure to list softlayer VM flavors or display all available options. @return [nil]

# File lib/chef/knife/softlayer_flavor_list.rb, line 29
def run
  $stdout.sync = true
  if config[:all]

    if OS.windows?
      puts ui.list(options_table, :uneven_columns_across, 6)
    else
      IO.popen('less', 'w') do |pipe|
        pipe.puts ui.list(options_table, :uneven_columns_across, 6)
      end
    end

    msg = "These options can be used in place of 'flavors'; See `knife softlayer server create --help` for details.\n"
  else
    puts connection.flavors.table([:id, :cpu, :ram, :disk,])
    msg = "'flavors' provided here for convenience; SoftLayer allows you to choose a configuration a la carte.\nFor a full list of available instance options use --all with the `knife softlayer flavor list` subcommand."
  end
  puts ui.color("\nNOTICE: ", :yellow)
  puts ui.color(msg)
end