Import packaging.version explicitly
"packaging.version" should be imported explicitly to avoid the following error: >>> import packaging >>> packaging.version Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: module 'packaging' has no attribute 'version' This patch also inclues "packaging" in the requirements file. Change-Id: Ibd277e2fcc152fcf7c81ef7470e3beb0c668575c Closes-Bug: #1904854
This commit is contained in:
parent
44888cff74
commit
fd335b4037
@ -81,6 +81,7 @@ oslotest==3.2.0
|
||||
osprofiler==2.3.0
|
||||
ovs==2.8.0
|
||||
ovsdbapp==1.4.0
|
||||
packaging==20.4
|
||||
Paste==2.0.2
|
||||
PasteDeploy==1.5.0
|
||||
pbr==4.0.0
|
||||
|
@ -13,7 +13,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import packaging
|
||||
from packaging import version
|
||||
|
||||
from neutron_lib import exceptions
|
||||
from oslo_log import log as logging
|
||||
@ -41,14 +41,14 @@ def keepalived_use_no_track_support():
|
||||
cmd = ['keepalived', '--version']
|
||||
env = {'LC_ALL': 'C', 'PATH': '/sbin:/usr/sbin'}
|
||||
|
||||
keepalived_with_track = packaging.version.parse("2.0.0")
|
||||
keepalived_with_track = version.parse("2.0.0")
|
||||
try:
|
||||
# keepalived --version returns with stderr only
|
||||
res = agent_utils.execute(cmd, addl_env=env, log_fail_as_error=False,
|
||||
return_stderr=True)
|
||||
# First line is the interesting one here from stderr
|
||||
version_line = res[1].split('\n')[0]
|
||||
keepalived_version = packaging.version.parse(version_line.split()[1])
|
||||
keepalived_version = version.parse(version_line.split()[1])
|
||||
return keepalived_version >= keepalived_with_track
|
||||
except exceptions.ProcessExecutionError:
|
||||
return False
|
||||
|
@ -46,6 +46,7 @@ osprofiler>=2.3.0 # Apache-2.0
|
||||
os-ken >= 0.3.0 # Apache-2.0
|
||||
ovs>=2.8.0 # Apache-2.0
|
||||
ovsdbapp>=1.4.0 # Apache-2.0
|
||||
packaging>=20.4 # Apache-2.0
|
||||
psutil>=5.3.0 # BSD
|
||||
pyroute2>=0.5.13;sys_platform!='win32' # Apache-2.0 (+ dual licensed GPL2)
|
||||
pyOpenSSL>=17.1.0 # Apache-2.0
|
||||
|
Loading…
Reference in New Issue
Block a user