Skip to content

Commit 5d4b70d

Browse files
committed
fix: fixed hostgroup api
1 parent 4335724 commit 5d4b70d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

mamonsu/tools/zabbix_cli/operations.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,20 +62,20 @@ def _generic_delete(self, typ, ids):
6262
sys.exit(3)
6363

6464
def _generic_list(self, typ):
65+
name, fltr = '', ''
6566
if typ == 'template':
6667
name, fltr = 'name', 'host'
6768
elif typ == 'hostgroup':
68-
name, fltr = 'name', 'host'
69+
name = 'name'
6970
elif typ == 'host':
70-
fltr, name = 'host', 'host'
71+
name, fltr = 'host', 'host'
7172
else:
7273
sys.stderr.write('Unknown type: {0} for listing'.format(typ))
7374
sys.exit(4)
7475
try:
7576
for x in self.req.post(
7677
method='{0}.get'.format(typ),
77-
params={
78-
'filter': {fltr: []}}):
78+
params={'filter': {fltr: []}} if fltr != '' else {'filter': []}):
7979
print(x[name])
8080
except Exception as e:
8181
sys.stderr.write('List error: {0}\n'.format(e))

0 commit comments

Comments
 (0)