@@ -14,8 +14,8 @@ def self.instances
1414 selectInterfaces : %w[ interfaceid type main ip port useip details ] ,
1515 selectGroups : [ 'name' ] ,
1616 selectMacros : %w[ macro value ] ,
17- output : %w[ host proxy_hostid tls_accept tls_connect tls_issuer tls_subject ]
18- }
17+ output : %w[ host proxy_hostid tls_accept tls_connect tls_issuer tls_subject ] ,
18+ } ,
1919 )
2020
2121 api_hosts . map do |h |
@@ -43,7 +43,7 @@ def self.instances
4343 tls_accept : h [ 'tls_accept' ] . to_i ,
4444 tls_connect : h [ 'tls_connect' ] . to_i ,
4545 tls_issuer : h [ 'tls_issuer' ] . to_s ,
46- tls_subject : h [ 'tls_subject' ] . to_s
46+ tls_subject : h [ 'tls_subject' ] . to_s ,
4747 )
4848 end
4949 end
@@ -63,7 +63,7 @@ def create
6363 gids = get_groupids ( @resource [ :groups ] , @resource [ :group_create ] )
6464 groups = transform_to_array_hash ( 'groupid' , gids )
6565
66- proxy_hostid = @resource [ :proxy ] . nil? || @resource [ :proxy ] . empty? ? nil : zbx . proxies . get_id ( host : @resource [ :proxy ] )
66+ proxy_hostid = ( @resource [ :proxy ] . nil? || @resource [ :proxy ] . empty? ) ? nil : zbx . proxies . get_id ( host : @resource [ :proxy ] )
6767
6868 tls_accept = @resource [ :tls_accept ] . nil? ? 1 : @resource [ :tls_accept ]
6969 tls_connect = @resource [ :tls_connect ] . nil? ? 1 : @resource [ :tls_connect ]
@@ -80,15 +80,15 @@ def create
8080 dns : @resource [ :hostname ] ,
8181 port : @resource [ :port ] ,
8282 useip : @resource [ :use_ip ] ? 1 : 0 ,
83- details : @resource [ :interfacedetails ] . nil? ? { } : @resource [ :interfacedetails ]
84- }
83+ details : @resource [ :interfacedetails ] . nil? ? { } : @resource [ :interfacedetails ] ,
84+ } ,
8585 ] ,
8686 templates : templates ,
8787 groups : groups ,
8888 tls_connect : tls_connect ,
8989 tls_accept : tls_accept ,
9090 tls_issuer : @resource [ :tls_issuer ] . nil? ? '' : @resource [ :tls_issuer ] ,
91- tls_subject : @resource [ :tls_subject ] . nil? ? '' : @resource [ :tls_subject ]
91+ tls_subject : @resource [ :tls_subject ] . nil? ? '' : @resource [ :tls_subject ] ,
9292 )
9393 end
9494
@@ -139,8 +139,8 @@ def ipaddress=(string)
139139 method : 'hostinterface.update' ,
140140 params : {
141141 interfaceid : @property_hash [ :interfaceid ] ,
142- ip : string
143- }
142+ ip : string ,
143+ } ,
144144 )
145145 end
146146
@@ -150,8 +150,8 @@ def use_ip=(boolean)
150150 params : {
151151 interfaceid : @property_hash [ :interfaceid ] ,
152152 useip : boolean ? 1 : 0 ,
153- dns : @resource [ :hostname ]
154- }
153+ dns : @resource [ :hostname ] ,
154+ } ,
155155 )
156156 end
157157
@@ -160,8 +160,8 @@ def port=(int)
160160 method : 'hostinterface.update' ,
161161 params : {
162162 interfaceid : @property_hash [ :interfaceid ] ,
163- port : int
164- }
163+ port : int ,
164+ } ,
165165 )
166166 end
167167
@@ -170,8 +170,8 @@ def interfacetype=(int)
170170 method : 'hostinterface.update' ,
171171 params : {
172172 interfaceid : @property_hash [ :interfaceid ] ,
173- type : int
174- }
173+ type : int ,
174+ } ,
175175 )
176176 end
177177
@@ -180,8 +180,8 @@ def interfacedetails=(hash)
180180 method : 'hostinterface.update' ,
181181 params : {
182182 interfaceid : @property_hash [ :interfaceid ] ,
183- details : hash
184- }
183+ details : hash ,
184+ } ,
185185 )
186186 end
187187
@@ -191,7 +191,7 @@ def groups=(hostgroups)
191191
192192 zbx . hosts . create_or_update (
193193 host : @resource [ :hostname ] ,
194- groups : groups
194+ groups : groups ,
195195 )
196196 end
197197
@@ -204,8 +204,8 @@ def templates=(array)
204204 params : {
205205 hostids : @property_hash [ :id ] ,
206206 selectParentTemplates : [ 'templateid' ] ,
207- output : [ 'host' ]
208- }
207+ output : [ 'host' ] ,
208+ } ,
209209 ) . first [ 'parentTemplates' ] . map { |t | t [ 'templateid' ] . to_i }
210210 templates_clear = is_template_ids - should_template_ids
211211
@@ -214,8 +214,8 @@ def templates=(array)
214214 params : {
215215 hostid : @property_hash [ :id ] ,
216216 templates : transform_to_array_hash ( 'templateid' , should_template_ids ) ,
217- templates_clear : transform_to_array_hash ( 'templateid' , templates_clear )
218- }
217+ templates_clear : transform_to_array_hash ( 'templateid' , templates_clear ) ,
218+ } ,
219219 )
220220 end
221221
@@ -225,23 +225,23 @@ def macros=(array)
225225 method : 'host.update' ,
226226 params : {
227227 hostid : @property_hash [ :id ] ,
228- macros : macroarray
229- }
228+ macros : macroarray ,
229+ } ,
230230 )
231231 end
232232
233233 def proxy = ( string )
234234 zbx . hosts . create_or_update (
235235 host : @resource [ :hostname ] ,
236- proxy_hostid : zbx . proxies . get_id ( host : string )
236+ proxy_hostid : zbx . proxies . get_id ( host : string ) ,
237237 )
238238 end
239239
240240 def tls_connect = ( int )
241241 @property_hash [ :tls_connect ] = int
242242 zbx . hosts . create_or_update (
243243 host : @resource [ :hostname ] ,
244- tls_connect : @property_hash [ :tls_connect ] . nil? ? 1 : @property_hash [ :tls_connect ]
244+ tls_connect : @property_hash [ :tls_connect ] . nil? ? 1 : @property_hash [ :tls_connect ] ,
245245 )
246246 end
247247
@@ -250,23 +250,23 @@ def tls_accept=(int)
250250
251251 zbx . hosts . create_or_update (
252252 host : @resource [ :hostname ] ,
253- tls_accept : @property_hash [ :tls_accept ] . nil? ? 1 : @property_hash [ :tls_accept ]
253+ tls_accept : @property_hash [ :tls_accept ] . nil? ? 1 : @property_hash [ :tls_accept ] ,
254254 )
255255 end
256256
257257 def tls_issuer = ( string )
258258 @property_hash [ :tls_issuer ] = string
259259 zbx . hosts . create_or_update (
260260 host : @resource [ :hostname ] ,
261- tls_issuer : @property_hash [ :tls_issuer ] . nil? ? '' : @property_hash [ :tls_issuer ]
261+ tls_issuer : @property_hash [ :tls_issuer ] . nil? ? '' : @property_hash [ :tls_issuer ] ,
262262 )
263263 end
264264
265265 def tls_subject = ( string )
266266 @property_hash [ :tls_subject ] = string
267267 zbx . hosts . create_or_update (
268268 host : @resource [ :hostname ] ,
269- tls_subject : @property_hash [ :tls_subject ] . nil? ? '' : @property_hash [ :tls_subject ]
269+ tls_subject : @property_hash [ :tls_subject ] . nil? ? '' : @property_hash [ :tls_subject ] ,
270270 )
271271 end
272272end
0 commit comments