zabbixapi 2.4.3 → 2.4.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4a430b3b9e7367023a5a75e19414e842eb791a3c
4
- data.tar.gz: 0f78b7cfbbecbb96223ed5e5fc43fc6babc63c05
3
+ metadata.gz: d196f3e01ddbffa49332172c445ceb140d4f3c52
4
+ data.tar.gz: 340e897f40f1349a9c0da756e1b25c584061c96a
5
5
  SHA512:
6
- metadata.gz: 2fa71a223935015b12a3c319bc649a4e6a5ee12c676305f18a25de690cc0feb0e1da86bb31b716dae402f4637a61d0afa80feb9c2ed30fc791c7260c373b4870
7
- data.tar.gz: e23d53427667a09bf898a5e6c5b17acd59fa5d77df155e0a480045abb4a565c5c1000ca4e21dc1562b5e081cda412477ac7139ea5986d53f35dea4c05f7e6a55
6
+ metadata.gz: 7e8650a501039e28ca6e45a8bcf61ce81fd368b1a622c84c95e83240d25fec3d52e890e5d5c1b33f9039f103c374d3e4765bd3a998f0851e0bfe278a6381fe3a
7
+ data.tar.gz: ab4dc190196e5584faf2c54b8f55b5873608f0484eff14f3a0db159b4339de79d25456330734e2b90c5bb65095528dd327bd4264eb6fdb326d967e20c5786bce
@@ -0,0 +1,3 @@
1
+ ## 2.4.4
2
+
3
+ [Issue #32](https://github.com/express42/zabbixapi/issues/32): Force update of objects in zabbix
@@ -25,7 +25,7 @@ class ZabbixApi
25
25
  id ? update(data.merge(key.to_sym => id.to_s)) : create(data)
26
26
  end
27
27
 
28
- def update(data)
28
+ def update(data, force=false)
29
29
  log "[DEBUG] Call update with parametrs: #{data.inspect}"
30
30
 
31
31
  dump = {}
@@ -34,7 +34,7 @@ class ZabbixApi
34
34
  dump = symbolize_keys(item) if item[key].to_i == data[key.to_sym].to_i
35
35
  end
36
36
 
37
- if hash_equals?(dump, data)
37
+ if hash_equals?(dump, data) and not force
38
38
  log "[DEBUG] Equal keys #{dump} and #{data}, skip update"
39
39
  item_id
40
40
  else
@@ -1,3 +1,3 @@
1
1
  class ZabbixApi
2
- VERSION = "2.4.3"
2
+ VERSION = "2.4.4"
3
3
  end
@@ -136,6 +136,33 @@ describe 'host' do
136
136
  expect(zbx.hosts.dump_by_id(:hostid => @hostid).first['groups'].first["groupid"]).to eq @hostgroupid2.to_s
137
137
 
138
138
  end
139
+
140
+ it "should update interfaces when use with force: true" do
141
+ new_ip = '1.2.3.4'
142
+ zbx.hosts.update(
143
+ {:hostid => @hostid,
144
+ :interfaces => [
145
+ {
146
+ :type => 1,
147
+ :main => 1,
148
+ :ip => new_ip,
149
+ :port => 10050,
150
+ :useip => 1,
151
+ :dns => ''
152
+ }
153
+ ]}, true)
154
+
155
+ h = zbx.query(
156
+ method: 'host.get',
157
+ params: {
158
+ hostids: @hostid,
159
+ selectInterfaces: 'extend'
160
+ }
161
+ ).first
162
+
163
+ expect(h['interfaces'].first['ip']).to eq new_ip
164
+ end
165
+
139
166
  end
140
167
 
141
168
  describe 'delete' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zabbixapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.3
4
+ version: 2.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vasiliev D.V.
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-05-12 00:00:00.000000000 Z
12
+ date: 2015-06-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json
@@ -42,6 +42,7 @@ files:
42
42
  - ".gitignore"
43
43
  - ".rspec"
44
44
  - ".travis.yml"
45
+ - CHANGELOG.md
45
46
  - Gemfile
46
47
  - Gemfile.lock
47
48
  - LICENSE