zabbixapi_mgx 7.2.0 → 7.2.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ba3a08c63fe50a869bcac02554129a491824376447f9909cdf8fcd7ac1b94822
4
- data.tar.gz: 16341e9118f66db1cca7eb2ee1e52a3906321578712ea857edf1628228a71e50
3
+ metadata.gz: 8400ec8b9feffbff0c26eb85bfe5fb2b8ffd3dc67b458d4ed99613b584e8eb8b
4
+ data.tar.gz: d3a8749581e72691d7bfda082f3dd34f2d7d7e07380dfe0b968f69ed90a8c31c
5
5
  SHA512:
6
- metadata.gz: f338d70e0ae66c3ab623bf416c9a74da7173d34713e74ccfcca2a89bc171917f0b7560cfc2ac9b40614b523c5a6692275e8ed8d6bcc0c31b573ee60586cefabd
7
- data.tar.gz: '0770190620835682928d1abc3f8a13d772b9df4b32db54b2c49c97b3960d7b3dfa1f766c2cad60a090d602009e1a666304b5fd77f6caeb32908f665b2cec7acf'
6
+ metadata.gz: b303704506861a4d8dadcaafb6ec0b5c8b477350e90f6b421f6f81813efb8ed7c5f11a12092b1bd4b9709e4493719786635d1efe41a721db0a0d30afc6f670c2
7
+ data.tar.gz: 3a0f4388545a81392d1411a2c9b94962c59c329bd1362b3720077fb217c644a97be3cacc75d652ae16e60030ef28d80c45562974e77357290ba3072ac07eee69
@@ -75,5 +75,31 @@ class ZabbixApi
75
75
  hostid = get_id(host: data[:host])
76
76
  hostid ? update(data.merge(hostid: hostid)) : create(data)
77
77
  end
78
+
79
+ # Update Host object using API
80
+ #
81
+ # @param data [Hash] Should include object's id field name (identify) and id value
82
+ # @param force [Boolean] Whether to force an object update even if provided data matches Zabbix
83
+ # @raise [ApiError] Error returned when there is a problem with the Zabbix API call.
84
+ # @raise [HttpError] Error raised when HTTP status from Zabbix Server response is not a 200 OK.
85
+ # @return [Integer] The object id if a single object is created
86
+ # @return [Boolean] True/False if multiple objects are created
87
+ def update(data, force = false)
88
+ log "[DEBUG] Call update with parameters: #{data.inspect}"
89
+ dump = {}
90
+ dump_by_id(key.to_sym => data[key.to_sym]).each do |item|
91
+ dump = symbolize_keys(item) if item[key].to_i == data[key.to_sym].to_i
92
+ end
93
+ if hash_equals?(dump, data) && !force
94
+ log "[DEBUG] Equal keys #{dump} and #{data}, skip update"
95
+ data[key.to_sym].to_i
96
+ else
97
+ data[:groups] = data.delete(:hostgroups)
98
+ data_update = [data]
99
+ result = @client.api_request(method: "#{method_name}.update", params: data_update)
100
+ parse_keys result
101
+ end
102
+ end
103
+
78
104
  end
79
105
  end
@@ -1,3 +1,3 @@
1
1
  class ZabbixApi
2
- VERSION = '7.2.0'.freeze
2
+ VERSION = '7.2.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zabbixapi_mgx
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.2.0
4
+ version: 7.2.1
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: 2025-01-19 00:00:00.000000000 Z
12
+ date: 2025-02-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: http