Class: Chef::Knife::SoftlayerFlavorList

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

Constant Summary

Constants included from SoftlayerBase

Chef::Knife::SoftlayerBase::USER_AGENT

Instance Method Summary collapse

Methods included from SoftlayerFlavorBase

#options_table

Methods included from SoftlayerBase

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

Instance Method Details

#runnil

Run the procedure to list softlayer VM flavors or display all available options.

Returns:

  • (nil)


29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# 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