lib/cloudstack-nagios/helper.rb in cloudstack-nagios-0.2.0 vs lib/cloudstack-nagios/helper.rb in cloudstack-nagios-0.3.0

- old
+ new

@@ -1,13 +1,18 @@ module CloudstackNagios module Helper - def load_template(name) - templ = File.read(File.join(File.dirname(__FILE__), "templates", name)) - Erubis::Eruby.new(templ) + def load_template(template_path) + if File.file?(template_path) + templ = File.read(template_path) + return Erubis::Eruby.new(templ) + else + say "Error: template not found #{template_path}" + exit 1 + end end - def routers - routers = client.list_routers - routers += client.list_routers(projectid: -1) + def cs_routers + routers = client.list_routers(status: 'Running') + routers += client.list_routers(projectid: -1, status: 'Running') end end end