967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
|
# File 'lib/chef/knife/octo.rb', line 967
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', 'projects/all', false)
if request['response'] == 'ok'
if config[:long]
octo_methods.create_local_file_by_id('libraryvariablesets')
parser = octo_methods.parse_project_list(request['message'],true,true)
octo_methods.delete_local_file
else
parser = octo_methods.parse_project_list(request['message'],false,true)
end
if parser['response'] == 'ok'
print parser['message']
else
ui.error(parser['message'])
end
print "\n"
else
print request['message']
end
end
|