Blob Blame History Raw
From 6a84665b2422a98fbce8581ee9ae5eb60953f945 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ond=C5=99ej=20Lyson=C4=9Bk?= <olysonek@redhat.com>
Date: Fri, 11 Jan 2019 15:24:00 +0100
Subject: [PATCH] sysctl: Fix refreshing cache
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Fix iterating over the 'cache' dictionary in refresh(). A dictionary is
not callable. This fixes the following error:

>>> import procfs.sysctl
>>> s = procfs.sysctl()
>>> s.refresh()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.6/site-packages/procfs/sysctl.py", line 64, in refresh
    for key in self.cache():
TypeError: 'dict' object is not callable

Signed-off-by: Ondřej Lysoněk <olysonek@redhat.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
---
 procfs/sysctl.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/procfs/sysctl.py b/procfs/sysctl.py
index 8b256ab4317f..6a9145518c27 100755
--- a/procfs/sysctl.py
+++ b/procfs/sysctl.py
@@ -61,7 +61,7 @@ class sysctl:
 		f.close()
 
 	def refresh(self):
-		for key in self.cache():
+		for key in self.cache.keys():
 			del self.cache[key]
 			value = self.read(key)
 			if value != None:
-- 
2.20.1