|
|
591d66 |
From d249ea3316fcfaa203055d2b1f2c52423216e7e7 Mon Sep 17 00:00:00 2001
|
|
|
e0325d |
From: Petr Lautrbach <plautrba@redhat.com>
|
|
|
e0325d |
Date: Tue, 30 Jul 2019 17:13:44 +0200
|
|
|
e0325d |
Subject: [PATCH] Do not use NoteNotFound as it's not implemented in networkx-1
|
|
|
e0325d |
|
|
|
e0325d |
---
|
|
|
e0325d |
setools/dta.py | 8 ++++----
|
|
|
e0325d |
setools/infoflow.py | 8 ++++----
|
|
|
e0325d |
2 files changed, 8 insertions(+), 8 deletions(-)
|
|
|
e0325d |
|
|
|
e0325d |
diff --git a/setools/dta.py b/setools/dta.py
|
|
|
e0325d |
index 3239d2d..e15d8b8 100644
|
|
|
e0325d |
--- a/setools/dta.py
|
|
|
e0325d |
+++ b/setools/dta.py
|
|
|
e0325d |
@@ -24,7 +24,7 @@ from collections import defaultdict, namedtuple
|
|
|
e0325d |
from contextlib import suppress
|
|
|
e0325d |
|
|
|
e0325d |
import networkx as nx
|
|
|
e0325d |
-from networkx.exception import NetworkXError, NetworkXNoPath, NodeNotFound
|
|
|
e0325d |
+from networkx.exception import NetworkXError, NetworkXNoPath
|
|
|
e0325d |
|
|
|
e0325d |
from .descriptors import EdgeAttrDict, EdgeAttrList
|
|
|
e0325d |
from .policyrep import TERuletype
|
|
|
e0325d |
@@ -111,7 +111,7 @@ class DomainTransitionAnalysis:
|
|
|
e0325d |
|
|
|
e0325d |
self.log.info("Generating one domain transition path from {0} to {1}...".format(s, t))
|
|
|
e0325d |
|
|
|
e0325d |
- with suppress(NetworkXNoPath, NodeNotFound):
|
|
|
e0325d |
+ with suppress(NetworkXNoPath):
|
|
|
e0325d |
# NodeNotFound: the type is valid but not in graph, e.g. excluded
|
|
|
e0325d |
# NetworkXNoPath: no paths or the target type is
|
|
|
e0325d |
# not in the graph
|
|
|
e0325d |
@@ -146,7 +146,7 @@ class DomainTransitionAnalysis:
|
|
|
e0325d |
self.log.info("Generating all domain transition paths from {0} to {1}, max length {2}...".
|
|
|
e0325d |
format(s, t, maxlen))
|
|
|
e0325d |
|
|
|
e0325d |
- with suppress(NetworkXNoPath, NodeNotFound):
|
|
|
e0325d |
+ with suppress(NetworkXNoPath):
|
|
|
e0325d |
# NodeNotFound: the type is valid but not in graph, e.g. excluded
|
|
|
e0325d |
# NetworkXNoPath: no paths or the target type is
|
|
|
e0325d |
# not in the graph
|
|
|
e0325d |
@@ -177,7 +177,7 @@ class DomainTransitionAnalysis:
|
|
|
e0325d |
self.log.info("Generating all shortest domain transition paths from {0} to {1}...".
|
|
|
e0325d |
format(s, t))
|
|
|
e0325d |
|
|
|
e0325d |
- with suppress(NetworkXNoPath, NodeNotFound):
|
|
|
e0325d |
+ with suppress(NetworkXNoPath):
|
|
|
e0325d |
# NodeNotFound: the type is valid but not in graph, e.g. excluded
|
|
|
e0325d |
# NetworkXNoPath: no paths or the target type is
|
|
|
e0325d |
# not in the graph
|
|
|
e0325d |
diff --git a/setools/infoflow.py b/setools/infoflow.py
|
|
|
591d66 |
index 579e064..89e5c8e 100644
|
|
|
e0325d |
--- a/setools/infoflow.py
|
|
|
e0325d |
+++ b/setools/infoflow.py
|
|
|
e0325d |
@@ -21,7 +21,7 @@ import logging
|
|
|
e0325d |
from contextlib import suppress
|
|
|
e0325d |
|
|
|
e0325d |
import networkx as nx
|
|
|
e0325d |
-from networkx.exception import NetworkXError, NetworkXNoPath, NodeNotFound
|
|
|
e0325d |
+from networkx.exception import NetworkXError, NetworkXNoPath
|
|
|
e0325d |
|
|
|
e0325d |
from .descriptors import EdgeAttrIntMax, EdgeAttrList
|
|
|
591d66 |
from .exception import RuleNotConditional
|
|
|
591d66 |
@@ -124,7 +124,7 @@ class InfoFlowAnalysis:
|
|
|
e0325d |
self.log.info("Generating one shortest information flow path from {0} to {1}...".
|
|
|
e0325d |
format(s, t))
|
|
|
e0325d |
|
|
|
e0325d |
- with suppress(NetworkXNoPath, NodeNotFound):
|
|
|
e0325d |
+ with suppress(NetworkXNoPath):
|
|
|
e0325d |
# NodeNotFound: the type is valid but not in graph, e.g.
|
|
|
e0325d |
# excluded or disconnected due to min weight
|
|
|
e0325d |
# NetworkXNoPath: no paths or the target type is
|
|
|
591d66 |
@@ -163,7 +163,7 @@ class InfoFlowAnalysis:
|
|
|
e0325d |
self.log.info("Generating all information flow paths from {0} to {1}, max length {2}...".
|
|
|
e0325d |
format(s, t, maxlen))
|
|
|
e0325d |
|
|
|
e0325d |
- with suppress(NetworkXNoPath, NodeNotFound):
|
|
|
e0325d |
+ with suppress(NetworkXNoPath):
|
|
|
e0325d |
# NodeNotFound: the type is valid but not in graph, e.g.
|
|
|
e0325d |
# excluded or disconnected due to min weight
|
|
|
e0325d |
# NetworkXNoPath: no paths or the target type is
|
|
|
591d66 |
@@ -197,7 +197,7 @@ class InfoFlowAnalysis:
|
|
|
e0325d |
self.log.info("Generating all shortest information flow paths from {0} to {1}...".
|
|
|
e0325d |
format(s, t))
|
|
|
e0325d |
|
|
|
e0325d |
- with suppress(NetworkXNoPath, NodeNotFound):
|
|
|
e0325d |
+ with suppress(NetworkXNoPath):
|
|
|
e0325d |
# NodeNotFound: the type is valid but not in graph, e.g.
|
|
|
e0325d |
# excluded or disconnected due to min weight
|
|
|
e0325d |
# NetworkXNoPath: no paths or the target type is
|
|
|
e0325d |
--
|
|
|
591d66 |
2.25.1
|
|
|
e0325d |
|