class Octo::OctoVariablesShow
Public Instance Methods
run()
click to toggle source
# 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'] #delete_local_file 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