Skip to content

Commit

Permalink
Moved user-configurable-path into __init__ to save execution steps, f…
Browse files Browse the repository at this point in the history
…ixed indentation.
  • Loading branch information
nfdump committed Jul 5, 2013
1 parent 8f2e80e commit d05ab80
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions pynfdump/nfdump.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,16 @@ class NFDumpError(Exception):
pass

class Dumper:
def __init__(self, datadir='/', profile='live',sources=None,remote_host=None,executable_path=None):
def __init__(self, datadir='/', profile='live',sources=None,remote_host=None,executable_path='nfdump'):
if not datadir.endswith("/"):
datadir = datadir + '/'
self.datadir = datadir
self.profile = profile
self.sources = maybe_split(sources, ',')
self.remote_host = remote_host
self.exec_path = executable_path
if os.path.isdir(self.exec_path):
self.exec_path = os.path.join(self.exec_path, "nfdump")
self.set_where()
self.protocols = load_protocols()

Expand Down Expand Up @@ -172,14 +174,7 @@ def _base_cmd(self):
cmd = []
if self.remote_host:
cmd = ['ssh', self.remote_host]
if self.exec_path:
if self.exec_path[-1:] == "/":
e=self.exec_path + "nfdump"
else:
e=self.exec_path + "/nfdump"
else:
e="nfdump"
cmd.extend([e, '-q', '-o', 'pipe'])
cmd.extend([self.exec_path, '-q', '-o', 'pipe'])

if self.datadir and self.sources and self.profile:
sources = ':'.join(self.sources)
Expand Down

0 comments on commit d05ab80

Please sign in to comment.