fix: ok_python global variable definition
This commit is contained in:
parent
e03ba93186
commit
cac41658f8
8
nodes.py
8
nodes.py
@ -213,9 +213,8 @@ class Node(object):
|
|||||||
for f in self.dulogs.splitlines():
|
for f in self.dulogs.splitlines():
|
||||||
try:
|
try:
|
||||||
if (('include' in lfilter and re.search(lfilter['include'], f)) and
|
if (('include' in lfilter and re.search(lfilter['include'], f)) and
|
||||||
('exclude' in lfilter and not re.search(lfilter['exclude'], f))
|
('exclude' in lfilter and not re.search(lfilter['exclude'], f))):
|
||||||
):
|
flogs[f.split("\t")[1:]] = int(f.split("\t")[0])
|
||||||
flogs[f.split("\t")[1]] = int(f.split("\t")[0])
|
|
||||||
else:
|
else:
|
||||||
logging.debug("filter %s by %s" % (f, lfilter))
|
logging.debug("filter %s by %s" % (f, lfilter))
|
||||||
except re.error as e:
|
except re.error as e:
|
||||||
@ -309,7 +308,8 @@ class Nodes(object):
|
|||||||
if self.conf.hard_filter.status and (node.status not in self.conf.hard_filter.status):
|
if self.conf.hard_filter.status and (node.status not in self.conf.hard_filter.status):
|
||||||
logging.info("hard filter by status: excluding node-%s" % node.node_id)
|
logging.info("hard filter by status: excluding node-%s" % node.node_id)
|
||||||
return False
|
return False
|
||||||
if isinstance(self.conf.hard_filter.online, bool) and (bool(node.online) != bool(self.conf.hard_filter.online)):
|
if (isinstance(self.conf.hard_filter.online, bool) and
|
||||||
|
(bool(node.online) != bool(self.conf.hard_filter.online))):
|
||||||
logging.info("hard filter by online: excluding node-%s" % node.node_id)
|
logging.info("hard filter by online: excluding node-%s" % node.node_id)
|
||||||
return False
|
return False
|
||||||
if self.conf.hard_filter.node_ids and ((int(node.node_id) not in self.conf.hard_filter.node_ids) and (str(node.node_id) not in self.conf.hard_filter.node_ids)):
|
if self.conf.hard_filter.node_ids and ((int(node.node_id) not in self.conf.hard_filter.node_ids) and (str(node.node_id) not in self.conf.hard_filter.node_ids)):
|
||||||
|
4
tools.py
4
tools.py
@ -26,15 +26,15 @@ import sys
|
|||||||
def import_subprocess():
|
def import_subprocess():
|
||||||
if 'subprocess' not in globals():
|
if 'subprocess' not in globals():
|
||||||
global subprocess
|
global subprocess
|
||||||
|
global ok_python
|
||||||
try:
|
try:
|
||||||
import subprocess32 as subprocess
|
import subprocess32 as subprocess
|
||||||
logging.info("using improved subprocess32 module\n")
|
logging.info("using improved subprocess32 module\n")
|
||||||
|
ok_python = True
|
||||||
except:
|
except:
|
||||||
import subprocess
|
import subprocess
|
||||||
logging.warning(("Please upgrade the module 'subprocess' to the latest version: "
|
logging.warning(("Please upgrade the module 'subprocess' to the latest version: "
|
||||||
"https://pypi.python.org/pypi/subprocess32/"))
|
"https://pypi.python.org/pypi/subprocess32/"))
|
||||||
### set not_ok python
|
|
||||||
global ok_python
|
|
||||||
ok_python = True
|
ok_python = True
|
||||||
if sys.version > (2,7,0):
|
if sys.version > (2,7,0):
|
||||||
ok_python = False
|
ok_python = False
|
||||||
|
Loading…
x
Reference in New Issue
Block a user