Skip to content

Commit d4891de

Browse files
committed
SNMP: format and fix line-length in apc_ups e2e diagnostic dump
1 parent dde7ea3 commit d4891de

1 file changed

Lines changed: 40 additions & 11 deletions

File tree

snmp/tests/test_e2e_core.py

Lines changed: 40 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,20 +47,49 @@ def _run(cmd, label):
4747
print('error: {}'.format(exc), flush=True)
4848

4949
print('\n========== SNMP E2E DIAGNOSTICS ==========', flush=True)
50-
print('instance: ip={} port={} community={}'.format(
51-
instance.get('ip_address'), instance.get('port'), community), flush=True)
50+
print(
51+
'instance: ip={} port={} community={}'.format(instance.get('ip_address'), instance.get('port'), community),
52+
flush=True,
53+
)
5254

5355
_run(['docker', 'ps', '-a', '--format', '{{.Names}}\t{{.Image}}\t{{.Status}}'], 'docker ps')
5456
_run(['docker', 'logs', '--tail', '40', SNMP_CONTAINER_NAME], 'snmpsim logs (tail 40)')
55-
_run(['docker', 'inspect', SNMP_CONTAINER_NAME,
56-
'--format', '{{range .Mounts}}{{.Source}} -> {{.Destination}}{{println}}{{end}}'],
57-
'snmpsim mounts')
58-
_run(['docker', 'exec', SNMP_CONTAINER_NAME, 'sh', '-c',
59-
'ls /usr/snmpsim/data/ | wc -l; ls /usr/snmpsim/data/apc_ups* 2>&1; head -5 /usr/snmpsim/data/args_list.txt 2>&1'],
60-
'snmpsim data dir + apc_ups fixture + args_list.txt head')
61-
_run(['docker', 'exec', SNMP_CONTAINER_NAME, 'sh', '-c',
62-
'snmpget -v1 -c apc_ups 127.0.0.1:1161 1.3.6.1.2.1.1.1.0 2>&1 || true'],
63-
'snmpget apc_ups sysDescr from inside snmpsim container')
57+
_run(
58+
[
59+
'docker',
60+
'inspect',
61+
SNMP_CONTAINER_NAME,
62+
'--format',
63+
'{{range .Mounts}}{{.Source}} -> {{.Destination}}{{println}}{{end}}',
64+
],
65+
'snmpsim mounts',
66+
)
67+
_run(
68+
[
69+
'docker',
70+
'exec',
71+
SNMP_CONTAINER_NAME,
72+
'sh',
73+
'-c',
74+
(
75+
'ls /usr/snmpsim/data/ | wc -l; '
76+
'ls /usr/snmpsim/data/apc_ups* 2>&1; '
77+
'head -5 /usr/snmpsim/data/args_list.txt 2>&1'
78+
),
79+
],
80+
'snmpsim data dir + apc_ups fixture + args_list.txt head',
81+
)
82+
_run(
83+
[
84+
'docker',
85+
'exec',
86+
SNMP_CONTAINER_NAME,
87+
'sh',
88+
'-c',
89+
'snmpget -v1 -c apc_ups 127.0.0.1:1161 1.3.6.1.2.1.1.1.0 2>&1 || true',
90+
],
91+
'snmpget apc_ups sysDescr from inside snmpsim container',
92+
)
6493
print('========== END SNMP E2E DIAGNOSTICS ==========\n', flush=True)
6594

6695

0 commit comments

Comments
 (0)