Skip to content

Commit

Permalink
A few more bugfixes and some nil guarding
Browse files Browse the repository at this point in the history
  • Loading branch information
kainam00 committed Dec 30, 2015
1 parent 61527be commit 652abe3
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions lib/opsview_rest.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ def create(options = {})
when :monitoring_server
require 'opsview_rest/monitoring_server'
OpsviewRest::MonitoringServer.new(self, options)
when :notification_method
require 'opsview_rest/notification_method'
when :notificationmethod
require 'opsview_rest/notificationmethod'
OpsviewRest::NotificationMethod.new(self, options)
when :role
require 'opsview_rest/role'
Expand Down
6 changes: 3 additions & 3 deletions lib/opsview_rest/contact.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ def initialize(opsview, options = {})

@options[:all_servicegroups] = if @options[:all_servicegroups] then 1 else 0 end
@options[:all_hostgroups] = if @options[:all_hostgroups] then 1 else 0 end
@options[:servicegroups] = @options[:servicegroups].map { |x| { "name" => x } }
@options[:keywords] = @options[:keywords].map { |x| { "name" => x } }
@options[:hostgroups] = @options[:hostgroups].map { |x| { "name" => x } }
@options[:servicegroups] = @options[:servicegroups].map { |x| { "name" => x } } unless @options[:servicegroups].nil?
@options[:keywords] = @options[:keywords].map { |x| { "name" => x } } unless @options[:keywords].nil?
@options[:hostgroups] = @options[:hostgroups].map { |x| { "name" => x } } unless @options[:hostgroups].nil?
@options[:role] = { "name" => @options[:role] }

save(@options[:replace]) if @options[:save]
Expand Down
2 changes: 1 addition & 1 deletion lib/opsview_rest/notificationmethod.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def initialize(opsview, options = {})
:master => false,
:active => true,
:command => "notify_by_email",
:contact_variables => "EMAIL"
:contact_variables => "EMAIL",
:save => true,
:replace => false
}.update options
Expand Down
8 changes: 4 additions & 4 deletions lib/opsview_rest/timeperiod.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ def initialize(opsview, options = {})
@opsview = opsview
@resource_type = @options[:type]

@option[:servicecheck_notification_periods] = @option[:servicecheck_notification_periods].map { |x| { "name" => x } }
@option[:servicecheck_check_periods] = @option[:servicecheck_check_periods].map { |x| { "name" => x } }
@option[:host_check_periods] = @option[:host_check_periods].map { |x| { "name" => x } }
@option[:host_notification_periods] = @option[:host_notification_periods].map { |x| { "name" => x } }
@options[:servicecheck_notification_periods] = @options[:servicecheck_notification_periods].map { |x| { "name" => x } } unless @options[:servicecheck_notification_periods].nil?
@options[:servicecheck_check_periods] = @options[:servicecheck_check_periods].map { |x| { "name" => x } } unless @options[:servicecheck_check_periods].nil?
@options[:host_check_periods] = @options[:host_check_periods].map { |x| { "name" => x } } unless @options[:host_check_periods].nil?
@options[:host_notification_periods] = @options[:host_notification_periods].map { |x| { "name" => x } } unless @options[:host_notification_periods].nil?

save(@options[:replace]) if @options[:save]
end
Expand Down

0 comments on commit 652abe3

Please sign in to comment.