zabbixapi 2.4.3 → 2.4.4
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/zabbixapi/basic/basic_logic.rb +2 -2
- data/lib/zabbixapi/version.rb +1 -1
- data/spec/host.rb +27 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d196f3e01ddbffa49332172c445ceb140d4f3c52
|
4
|
+
data.tar.gz: 340e897f40f1349a9c0da756e1b25c584061c96a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e8650a501039e28ca6e45a8bcf61ce81fd368b1a622c84c95e83240d25fec3d52e890e5d5c1b33f9039f103c374d3e4765bd3a998f0851e0bfe278a6381fe3a
|
7
|
+
data.tar.gz: ab4dc190196e5584faf2c54b8f55b5873608f0484eff14f3a0db159b4339de79d25456330734e2b90c5bb65095528dd327bd4264eb6fdb326d967e20c5786bce
|
data/CHANGELOG.md
ADDED
@@ -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
|
data/lib/zabbixapi/version.rb
CHANGED
data/spec/host.rb
CHANGED
@@ -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.
|
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-
|
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
|