diff --git a/scripts/teamshow b/scripts/teamshow index 3c157f75fef6..3ea2691eda6b 100755 --- a/scripts/teamshow +++ b/scripts/teamshow @@ -19,6 +19,7 @@ """ import json +import os import re import swsssdk import subprocess @@ -127,6 +128,9 @@ class Teamshow(object): print tabulate(output, header) def main(): + if os.geteuid() != 0: + exit("This utility must be run as root") + try: team = Teamshow() team.get_portchannel_names() @@ -134,8 +138,7 @@ def main(): team.get_teamshow_result() team.display_summary() except Exception as e: - print e.message - sys.exit(1) + sys.exit(e.message) if __name__ == "__main__": main() diff --git a/show/main.py b/show/main.py index b853507b62bf..1a078ad134bb 100755 --- a/show/main.py +++ b/show/main.py @@ -617,7 +617,7 @@ def rif(interface, period, verbose): @click.option('--verbose', is_flag=True, help="Enable verbose output") def portchannel(verbose): """Show PortChannel information""" - cmd = "teamshow" + cmd = "sudo teamshow" run_command(cmd, display_cmd=verbose) #