Skip to content

Commit 69b0184

Browse files
authored
[show]: Append username to temporary template filenames to prevent inter-user issues (sonic-net#81)
1 parent 08c1fae commit 69b0184

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

show/main.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import click
44
import errno
5+
import getpass
56
import os
67
import subprocess
78
import sys
@@ -269,9 +270,9 @@ def platform():
269270
@platform.command()
270271
def summary():
271272
"""Show hardware platform information"""
272-
click.echo("")
273+
username = getpass.getuser()
273274

274-
PLATFORM_TEMPLATE_FILE = "/tmp/cli_platform.j2"
275+
PLATFORM_TEMPLATE_FILE = "/tmp/cli_platform_{0}.j2".format(username)
275276
PLATFORM_TEMPLATE_CONTENTS = "Platform: {{ platform }}\n" \
276277
"HwSKU: {{ minigraph_hwsku }}\n" \
277278
"ASIC: {{ asic_type }}"
@@ -326,9 +327,9 @@ def logging(process, lines, follow):
326327
@cli.command()
327328
def version():
328329
"""Show version information"""
329-
click.echo("")
330+
username = getpass.getuser()
330331

331-
VERSION_TEMPLATE_FILE = "/tmp/cli_version.j2"
332+
VERSION_TEMPLATE_FILE = "/tmp/cli_version_{0}.j2".format(username)
332333
VERSION_TEMPLATE_CONTENTS = "SONiC Software Version: SONiC.{{ build_version }}\n" \
333334
"Distribution: Debian {{ debian_version }}\n" \
334335
"Kernel: {{ kernel_version }}\n" \

0 commit comments

Comments
 (0)