Skip to content

Commit

Permalink
On sflow enable, start the docker since it is disabled by default (so…
Browse files Browse the repository at this point in the history
  • Loading branch information
padmanarayana authored and prsunny committed Jan 14, 2020
1 parent 3c09dcd commit fcfbc7f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions config/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2176,6 +2176,17 @@ def enable(ctx):

config_db.mod_entry('SFLOW', 'global', sflow_tbl['global'])

try:
proc = subprocess.Popen("systemctl is-active sflow", shell=True, stdout=subprocess.PIPE)
(out, err) = proc.communicate()
except SystemExit as e:
ctx.fail("Unable to check sflow status {}".format(e))

if out != "active":
log_info("sflow service is not enabled. Starting sflow docker...")
run_command("sudo systemctl enable sflow")
run_command("sudo systemctl start sflow")

#
# 'sflow' command ('config sflow disable')
#
Expand Down

0 comments on commit fcfbc7f

Please sign in to comment.