module Chef::Knife::PodnixBase

Public Instance Methods

locate_config_value(key) click to toggle source
# File lib/chef/knife/podnix_base.rb, line 26
def locate_config_value(key)
  key = key.to_sym
  config[key] || Chef::Config[:knife][key]
end
msg_pair(label, value, color=:cyan) click to toggle source
# File lib/chef/knife/podnix_base.rb, line 16
def msg_pair(label, value, color=:cyan)
  if value && !value.to_s.empty?
    ui.info "#{ui.color(label, color)}: #{value}"
  end
end
podnix_apikey() click to toggle source
# File lib/chef/knife/podnix_base.rb, line 22
def podnix_apikey
  locate_config_value(:podnix_api_key) || ENV['PODNIX_API_KEY']
end
validate!() click to toggle source
# File lib/chef/knife/podnix_base.rb, line 7
def validate!
  if (!podnix_apikey)
    ui.error "You did not configure your podnix_api_key"
    ui.error "either export PODNIX_API_KEY in .bashrc"
    ui.error "or configure podnix_api_key in knife.rb"
    exit 1
  end
end