Skip to content

Commit

Permalink
Fix python-psutil v2 issues caused by renaming foo to foo()
Browse files Browse the repository at this point in the history
  • Loading branch information
FrostyX committed Jan 26, 2015
1 parent efad173 commit cfc015d
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion tracer/resources/applications.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,6 @@ def helpers(self):

@property
def instances(self):
return Processes.all().filtered(lambda process: process.name == self.name)
return Processes.all().filtered(lambda process: process.name() == self.name)

affected_instances = None
2 changes: 1 addition & 1 deletion tracer/resources/collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class ProcessesCollection(Collection):
def owned_by(self, user):
if not user:
return self
return self.filtered(lambda process: process.username == user)
return self.filtered(lambda process: process.username() == user)

def newer_than(self, timestamp):
return self.filtered(lambda process: process.create_time() >= timestamp)
Expand Down
4 changes: 2 additions & 2 deletions tracer/resources/processes.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def files(self):

@property
def parent(self):
p = super(Process, self).parent
p = super(Process, self).parent()
if p:
p.__class__ = Process
return p
Expand All @@ -80,7 +80,7 @@ def get_children(self, recursive=False):
def exe(self):
# On Gentoo, there is #new after some files in lsof
# i.e. /usr/bin/gvim#new (deleted)
exe = super(Process, self).exe
exe = super(Process, self).exe()
if exe.endswith('#new'):
exe = exe[0:-4]

Expand Down
2 changes: 1 addition & 1 deletion tracer/resources/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,5 @@ def init_system():
"""

init = psutil.Process(1)
name = init.name.split(" ")[0]
name = init.name().split(" ")[0]
return name
4 changes: 2 additions & 2 deletions tracer/resources/tracer.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def trace_affected(self, user=None):
if p.create_time() <= package.modified:
found.append(p.pid)
p = self._apply_rules(p)
a = self._applications.find(p.name)
a = self._applications.find(p.name())

if a.name not in affected:
affected[a.name] = a
Expand Down Expand Up @@ -151,7 +151,7 @@ def _affecting_processes(self, process, packages):
return collection

def _affecting_children(self, process, packages):
if not self._rules.find(process.name):
if not self._rules.find(process.name()):
return {}

processes = AffectedProcessesCollection()
Expand Down
4 changes: 2 additions & 2 deletions tracer/views/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def render(self):
for process in self.args.processes:
print indent + "{app_name} has been started by {user} {time} ago. PID - {pid}".format(
app_name=self.args.application.name,
user=process.username,
user=process.username(),
time=process.str_started_ago,
pid=process.pid
)
Expand Down Expand Up @@ -59,7 +59,7 @@ def render_affected_by(self):

for process in self.args.affected_by:
if process not in self.args.processes:
print indent_level * indent + "{0} ({1})".format(process.name, process.pid)
print indent_level * indent + "{0} ({1})".format(process.name(), process.pid)
indent_level += 1

for package in process.packages:
Expand Down
2 changes: 1 addition & 1 deletion tracer/views/resource/processes.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ def render(self):
print 100 * "-"
# @FIXME sorting doesn't work correctly
for process in self.args.processes.sorted("create_time"):
print line.format(process.pid, process.str_started_ago, process.username, process.name)
print line.format(process.pid, process.str_started_ago, process.username(), process.name())

0 comments on commit cfc015d

Please sign in to comment.