Skip to content

Add 'sudo' to required calls #48

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 10, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 16 additions & 13 deletions show/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ def summary():
@platform.command()
def syseeprom():
"""Show system EEPROM information"""
run_command("decode-syseeprom")
run_command("sudo decode-syseeprom")


#
Expand All @@ -270,22 +270,25 @@ def syseeprom():
def logging():
pass

# Default 'lldp' command (called if no subcommands or their aliases were passed)
# Default 'logging' command (called if no subcommands or their aliases were passed)
@logging.command(default=True)
@click.argument('process', required=False)
@click.option('--tail', required=False, default=10)
@click.option('--follow', required=False)
def default(process, tail, follow):
@click.option('-l', '--lines')
@click.option('-f', '--follow', is_flag=True)
def default(process, lines, follow):
"""Show system log"""
if process is not None:
command = "grep {} /var/log/syslog".format(process)
if tail is not None:
command += "| tail -{}".format(tail)
elif follow is not None:
command += "| tail -f"
run_command(command)
if follow:
run_command("sudo tail -f /var/log/syslog")
else:
run_command("cat /var/log/syslog", pager=True)
command = "sudo cat /var/log/syslog"

if process is not None:
command += " | grep '{}'".format(process)

if lines is not None:
command += " | tail -{}".format(lines)

run_command(command, pager=True)


#
Expand Down