summaryrefslogtreecommitdiffstats
path: root/utils/mk-discovery-conf.py
blob: a13c48e840b96cd1158b1c60dd9849bc146c938c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/usr/bin/env python3

# USAGE: stafctl ls | ./mk-discovery-conf.py

import sys

KEYS = [
    ('transport', None),
    ('traddr', None),
    ('subsysnqn', 'nqn'),
    ('host-iface', None),
    ('host-traddr', None),
]

for ctrl in eval(sys.stdin.read()):
    print(f"{' '.join([f'--{kout or kin}={ctrl[kin]}' for kin,kout in KEYS if ctrl[kin] != ''])}")