Skip to content

Commit ea37683

Browse files
committed
Add headers for csv output.
1 parent c4da15d commit ea37683

File tree

6 files changed

+14
-14
lines changed

6 files changed

+14
-14
lines changed

usr/lib/python3/dist-packages/linuxmusterCli/typers/check_attic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def check(
3333
cmd_count = 0
3434
to_delete = []
3535

36-
data = []
36+
data = [[c.header for c in attic.columns]]
3737
for user,details in result.items():
3838
if details['start']:
3939
if details['status'] == "killed":

usr/lib/python3/dist-packages/linuxmusterCli/typers/devices.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def ls(
5151
devices.add_column("Role", style="bright_magenta")
5252
devices.add_column("LDAP", style="bright_magenta")
5353

54-
output = []
54+
output = [[c.header for c in devices.columns]]
5555

5656
for device in devices_data:
5757
for ldap_device in ldap_data:

usr/lib/python3/dist-packages/linuxmusterCli/typers/linbo.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def groups(school: Annotated[str, typer.Option("--school", "-s")] = 'default-sch
2828
with LMNFile(f'/etc/linuxmuster/sophomorix/{school}/{prefix}devices.csv', 'r') as f:
2929
devices = f.read()
3030

31-
data = []
31+
data = [[c.header for c in groups.columns]]
3232
for file in os.listdir(LINBO_PATH):
3333
path = os.path.join(LINBO_PATH, file)
3434
if (
@@ -59,7 +59,7 @@ def images():
5959
images.add_column("Differential image", style="cyan")
6060
# images.add_column("Used in groups", style="cyan")
6161

62-
data = []
62+
data = [[c.header for c in images.columns]]
6363
lim = LinboImageManager()
6464
for name,group in lim.groups.items():
6565
size = str(round(group.base.size / 1024 / 1024))
@@ -114,7 +114,7 @@ def format(sync_data):
114114
sync = Table()
115115
sync.add_column('Hostname', style="cyan")
116116
sync.add_column('IP', style="cyan")
117-
data = [['Hostname', 'IP']]
117+
data = [[c.header for c in sync.columns]]
118118
for image in images:
119119
sync.add_column(f'Last synchronisation for {image}')
120120
data[0].append(f'Last synchronisation for {image}')

usr/lib/python3/dist-packages/linuxmusterCli/typers/samba.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def gpos():
2222
gpos.add_column("GPO", style="cyan")
2323
gpos.add_column("Path", style="bright_magenta")
2424

25-
data = []
25+
data = [[c.header for c in gpos.columns]]
2626
for name, details in GPOS.items():
2727
gpos.add_row(name, details.gpo, details.path)
2828
data.append([name, details.gpo, details.path])
@@ -43,7 +43,7 @@ def drives(school: Annotated[str, typer.Option("--school", "-s")] = 'default-sch
4343
# drives.add_column("Visible teachers", style="bright_magenta")
4444
# drives.add_column("Visible students", style="bright_magenta")
4545

46-
data = []
46+
data = [[c.header for c in drives.columns]]
4747
for drive in GPOS[f"sophomorix:school:{school}"].drivemgr.drives:
4848
drives.add_row(
4949
drive.id,
@@ -86,7 +86,7 @@ def status(
8686
users_connections.add_column("IP", style="yellow")
8787
users_connections.add_column("Hostname", style="cyan")
8888

89-
data = []
89+
data = [[c.header for c in users_connections.columns]]
9090
for user,details in conn.users.items():
9191
users_connections.add_row(
9292
user,
@@ -110,7 +110,7 @@ def status(
110110
machines_connections.add_column("IP", style="cyan")
111111

112112
conn.get_machines()
113-
data = []
113+
data = [[c.header for c in machines_connections.columns]]
114114
for machine, details in conn.machines.items():
115115
machines_connections.add_row(
116116
machine,
@@ -146,12 +146,12 @@ def dns(
146146
dns_table.add_column("TTL", style="yellow")
147147
dns_table.add_column("Value", style="cyan")
148148

149-
root_data = []
149+
root_data = [[c.header for c in root_table.columns]]
150150
for entry in DNS['root']:
151151
root_table.add_row(entry['type'], entry['ttl'], entry['value'])
152152
root_data.append([entry['type'], entry['ttl'], entry['value']])
153153

154-
dns_data = []
154+
dns_data = [[c.header for c in dns_table.columns]]
155155
for entry in DNS['sub']:
156156
dns_table.add_row(entry['host'], entry['type'], entry['ttl'], entry['value'])
157157
dns_data.append([entry['host'], entry['type'], entry['ttl'], entry['value']])
@@ -178,7 +178,7 @@ def lastlogin(
178178
logins.add_column("IP", style="cyan")
179179
logins.add_column("Date", style="bright_magenta")
180180

181-
data = []
181+
data = [[c.header for c in logins.columns]]
182182
for entry in last_login(pattern, include_gz=all_logs):
183183
logins.add_row(entry['user'], entry['ip'], str(entry['datetime']))
184184
data.append([entry['user'], entry['ip'], str(entry['datetime'])])

usr/lib/python3/dist-packages/linuxmusterCli/typers/up.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def check_online(
3131
table_results.add_column("IP", style="yellow")
3232
table_results.add_column("Status")
3333

34-
data = []
34+
data = [[c.header for c in table_results.columns]]
3535
for ip, status in results.items():
3636
if state.format:
3737
data.append([ip, status])

usr/lib/python3/dist-packages/linuxmusterCli/typers/users.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def ls(
6363
users.add_column("Role", style="bright_magenta")
6464
users.add_column("Status", style="yellow")
6565

66-
data = []
66+
data = [[c.header for c in users.columns]]
6767
for user in users_data:
6868
data.append([user['sn'], user['givenName'], user['sAMAccountName'], user['sophomorixAdminClass'], user['sophomorixRole'], user['sophomorixStatus']])
6969
users.add_row(user['sn'], user['givenName'], user['sAMAccountName'], user['sophomorixAdminClass'], user['sophomorixRole'], user['sophomorixStatus'])

0 commit comments

Comments
 (0)