753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
|
# File 'lib/chef/knife/octo.rb', line 753
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
if name_args.size == 0
ui.error('Specify a variable list!')
return
end
if name_args.size > 1
ui.error ("You specified two variables!\n Try giving the variable name in quotes.")
return
end
octo_methods = OctoHelperMethods.new(Chef::Config[:knife][:octo_apikey],Chef::Config[:knife][:octo_instance])
if config[:long]
if octo_methods.parse_variable_sets(name_args[0],true)['response'] == 'ok'
octo_methods.create_local_file_by_id('environments')
print octo_methods.parse_variable_sets(name_args[0],true)['message']
else
ui.error(octo_methods.parse_variable_sets(name_args[0],true)['message'])
exit
end
else
if octo_methods.parse_variable_sets(name_args[0],false)['response'] == 'ok'
print octo_methods.parse_variable_sets(name_args[0],false)['message']
else
ui.error(octo_methods.parse_variable_sets(name_args[0],false)['message'])
exit
end
end
print "\n"
end
|