lib/cloudstack-nagios/base.rb in cloudstack-nagios-0.17.7 vs lib/cloudstack-nagios/base.rb in cloudstack-nagios-0.18.0
- old
+ new
@@ -21,16 +21,17 @@
end
no_commands do
def client(opts = {})
@config ||= load_configuration
- @client ||= CloudstackClient::Connection.new(
+ @client ||= CloudstackClient::Client.new(
@config[:url],
@config[:api_key],
@config[:secret_key],
- opts.merge({debug: options[:debug]})
)
+ @client.debug = true if options[:debug]
+ @client
end
def load_configuration(config_file = options[:config], env = options[:environment])
unless File.exists?(config_file)
say "Configuration file #{config_file} not found.", :red
@@ -49,22 +50,9 @@
error "Can't find environment #{env} in configuration file."
exit 1
end
end
config
- end
-
- def find_project(project_name = options[:project])
- return nil unless project_name
- unless project = client.get_project(project_name)
- say "Project '#{options[:project]}' not found", :red
- exit 1
- end
- project
- end
-
- def filter_by(objects, tag_name, tag)
- objects.select {|r| r[tag_name].downcase == tag.downcase}
end
def sshoptions(ssh_key)
{
timeout: 5,