rubix 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.1.3
@@ -91,7 +91,7 @@ module Rubix
91
91
  hp[:status] = (monitored ? 0 : 1) unless monitored.nil?
92
92
 
93
93
  case
94
- when use_ip && (!ip.nil?) && (!ip.empty?)
94
+ when use_ip == true && (!ip.nil?) && (!ip.empty?)
95
95
  hp[:useip] = 1
96
96
  hp[:ip] = ip
97
97
  hp[:port] = port || self.class::DEFAULT_PORT
@@ -145,10 +145,10 @@ module Rubix
145
145
  response = create_request
146
146
  if response.has_data?
147
147
  @id = response.result[id_field + 's'].first.to_i
148
- info("Created #{resource_name}")
148
+ info("Created Zabbix #{resource_name}")
149
149
  true
150
150
  else
151
- error("Error creating #{resource_name}: #{response.error_message}")
151
+ error("Error creating Zabbix #{resource_name}: #{response.error_message}")
152
152
  return false
153
153
  end
154
154
  end
@@ -181,13 +181,13 @@ module Rubix
181
181
  response = update_request
182
182
  case
183
183
  when response.has_data? && response.result.values.first.map(&:to_i).include?(id)
184
- info("Updated #{resource_name}")
184
+ info("Updated Zabbix #{resource_name}")
185
185
  true
186
186
  when response.has_data?
187
- error("No error, but failed to update #{resource_name}")
187
+ error("No error, but failed to update Zabbix #{resource_name}")
188
188
  false
189
189
  else
190
- error("Error updating #{resource_name}: #{response.error_message}")
190
+ error("Error updating Zabbix #{resource_name}: #{response.error_message}")
191
191
  false
192
192
  end
193
193
  end
@@ -229,13 +229,13 @@ module Rubix
229
229
  response = destroy_request
230
230
  case
231
231
  when response.has_data? && response.result.values.first.first.to_i == id
232
- info("Destroyed #{resource_name}")
232
+ info("Destroyed Zabbix #{resource_name}")
233
233
  true
234
234
  when response.zabbix_error? && response.error_message =~ /does not exist/i
235
235
  # was never there
236
236
  true
237
237
  else
238
- error("Could not destroy #{resource_name}: #{response.error_message}")
238
+ error("Could not destroy Zabbix #{resource_name}: #{response.error_message}")
239
239
  false
240
240
  end
241
241
  end
@@ -286,7 +286,7 @@ module Rubix
286
286
  if response.has_data?
287
287
  response.result.map { |obj_data| build(obj_data) }
288
288
  else
289
- error("Error listing all #{resource_name}s: #{response.error_message}") unless response.success?
289
+ error("Error listing all Zabbix #{resource_name}s: #{response.error_message}") unless response.success?
290
290
  []
291
291
  end
292
292
  end
@@ -332,7 +332,7 @@ module Rubix
332
332
  when response.success?
333
333
  # a successful but empty response means it wasn't found
334
334
  else
335
- error("Error finding #{resource_name} using #{options.inspect}: #{response.error_message}")
335
+ error("Error finding Zabbix #{resource_name} using #{options.inspect}: #{response.error_message}")
336
336
  nil
337
337
  end
338
338
  end
@@ -357,7 +357,7 @@ module Rubix
357
357
  false
358
358
  end
359
359
  else
360
- error("Error creating #{resource_name} using #{options.inspect}: #{response.error_message}")
360
+ error("Error creating Zabbix #{resource_name} using #{options.inspect}: #{response.error_message}")
361
361
  false
362
362
  end
363
363
  end
@@ -77,8 +77,8 @@ module Rubix
77
77
  :templateid => (template_id || host_id),
78
78
  :description => (description || 'Unknown'),
79
79
  :expression => expression,
80
- :priority => self.class::PRIORITY_CODES[priority],
81
- :status => self.class::STATUS_CODES[status],
80
+ :priority => self.class::PRIORITY_NAMES[priority],
81
+ :status => self.class::STATUS_NAMES[status],
82
82
  :comments => comments,
83
83
  :url => url
84
84
  }
@@ -48,8 +48,9 @@ describe "Triggers" do
48
48
  @trigger = ensure_save(Rubix::Trigger.new(:expression => '{rubix_spec_template_1:rubix.spec1.count(120,1)}>1', :description => 'rubix template trigger description 1', :status => :enabled))
49
49
  end
50
50
 
51
- it "can have its host, description, and status updated" do
51
+ it "can have its host, description, priority, and status updated" do
52
52
  @trigger.status = :disabled
53
+ @trigger.priority = :average
53
54
  @trigger.description = 'rubix template trigger description 2'
54
55
  # @trigger.host_id = @template_2.id
55
56
  @trigger.save.should be_true
@@ -61,6 +62,7 @@ describe "Triggers" do
61
62
  new_trigger.template.name.should == @template_1.name
62
63
  new_trigger.items.map(&:id).should include(@template_item_1.id)
63
64
  new_trigger.status.should == :disabled
65
+ new_trigger.priority.should == :average
64
66
  end
65
67
 
66
68
  it "can be destroyed" do
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 2
9
- version: 0.1.2
8
+ - 3
9
+ version: 0.1.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - Dhruv Bansal
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2012-02-02 00:00:00 -06:00
17
+ date: 2012-02-06 00:00:00 -06:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency