Class: Octo::OctoVariablesList

Inherits:
Chef::Knife
  • Object
show all
Defined in:
lib/chef/knife/octo.rb

Instance Method Summary collapse

Instance Method Details

#runObject



717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
# File 'lib/chef/knife/octo.rb', line 717

def run
  if Chef::Config[:knife][:octo_instance].nil?
    ui.error("Please specify your Octopus Deploy instance in your knife config as -\nknife[:octo_instance] = 'MYOCTO.MYDOMAIN'")
    exit
  end
  if Chef::Config[:knife][:octo_apikey].nil?
    ui.error("Please specify your Octopus API key in your knife config as -\nknife[:octo_apikey]  = 'MYKEY'\nSee Also : https://octopus.com/docs/api-and-integration/api/how-to-create-an-api-key")
    exit
  end
  unless name_args.size == 0
    ui.error("This command does not take any arguments")
    return
  end
  octo_methods = OctoHelperMethods.new(Chef::Config[:knife][:octo_apikey],Chef::Config[:knife][:octo_instance])
  request = octo_methods.generic_call('GET', 'libraryvariablesets/all/', false)
  if request['response'] == 'ok'
    if config[:long]
      print octo_methods.parse_variable_list(request['message'],true)
    else
      print octo_methods.parse_variable_list(request['message'],false)
    end
    print "\n"
  else
    print request['message']
  end
end