From 4a269ba0395b1f83433f53d27a81662357334af2 Mon Sep 17 00:00:00 2001
From: licanwei
Date: Wed, 27 Nov 2019 15:25:25 +0800
Subject: [PATCH] Change self.node to self.nodes in model_root
networkx removed G.node in version 2.4[1]
G.node was replaced by G.nodes since version 2.0[2],
and supports Python 2.7, 3.5, 3.6 and 3.7 from 2.2
so the lower constraint version is 2.2.
lib task_flow also invokes lib networkx,
task_flow version is also needed to be updated.
[1]: https://networkx.github.io/documentation/stable/release/release_2.4.html
[2]: https://networkx.github.io/documentation/stable/release/release_2.0.html
Change-Id: I268bcf57ec977bd8132a9f1573b28b681cb4ce1e
Closes-Bug: #1854132
---
lower-constraints.txt | 4 ++--
requirements.txt | 4 ++--
watcher/decision_engine/model/model_root.py | 8 ++++----
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/lower-constraints.txt b/lower-constraints.txt
index 5fdf6a543..46163fee0 100644
--- a/lower-constraints.txt
+++ b/lower-constraints.txt
@@ -64,7 +64,7 @@ msgpack==0.5.6
munch==2.2.0
netaddr==0.7.19
netifaces==0.10.6
-networkx==1.11
+networkx==2.2
openstackdocstheme==1.20.0
openstacksdk==0.12.0
os-api-ref===1.4.0
@@ -145,7 +145,7 @@ sqlparse==0.2.4
statsd==3.2.2
stestr==2.0.0
stevedore==1.28.0
-taskflow==3.1.0
+taskflow==3.7.1
Tempita==0.5.2
tenacity==4.9.0
testresources==2.0.1
diff --git a/requirements.txt b/requirements.txt
index bb10adffb..c5bf3b3e4 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -42,9 +42,9 @@ python-ironicclient>=2.5.0 # Apache-2.0
six>=1.11.0 # MIT
SQLAlchemy>=1.2.5 # MIT
stevedore>=1.28.0 # Apache-2.0
-taskflow>=3.1.0 # Apache-2.0
+taskflow>=3.7.1 # Apache-2.0
WebOb>=1.8.5 # MIT
WSME>=0.9.2 # MIT
-networkx>=1.11;python_version>='3.4' # BSD
+networkx>=2.2;python_version>='3.4' # BSD
microversion_parse>=0.2.1 # Apache-2.0
futurist>=1.8.0 # Apache-2.0
diff --git a/watcher/decision_engine/model/model_root.py b/watcher/decision_engine/model/model_root.py
index 74fe6a36c..d200196da 100644
--- a/watcher/decision_engine/model/model_root.py
+++ b/watcher/decision_engine/model/model_root.py
@@ -171,7 +171,7 @@ class ModelRoot(nx.DiGraph, base.Model):
def _get_by_uuid(self, uuid):
try:
- return self.node[uuid]['attr']
+ return self.nodes[uuid]['attr']
except Exception as exc:
LOG.exception(exc)
raise exception.ComputeResourceNotFound(name=uuid)
@@ -466,14 +466,14 @@ class StorageModelRoot(nx.DiGraph, base.Model):
def _get_by_uuid(self, uuid):
try:
- return self.node[uuid]['attr']
+ return self.nodes[uuid]['attr']
except Exception as exc:
LOG.exception(exc)
raise exception.StorageResourceNotFound(name=uuid)
def _get_by_name(self, name):
try:
- return self.node[name]['attr']
+ return self.nodes[name]['attr']
except Exception as exc:
LOG.exception(exc)
raise exception.StorageResourceNotFound(name=name)
@@ -648,7 +648,7 @@ class BaremetalModelRoot(nx.DiGraph, base.Model):
def _get_by_uuid(self, uuid):
try:
- return self.node[uuid]['attr']
+ return self.nodes[uuid]['attr']
except Exception as exc:
LOG.exception(exc)
raise exception.BaremetalResourceNotFound(name=uuid)