Merge "Import packaging.version explicitly"

This commit is contained in:
Zuul 2020-11-20 10:11:51 +00:00 committed by Gerrit Code Review
commit c2e39c2ce9
3 changed files with 5 additions and 3 deletions

View File

@ -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

View File

@ -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

View File

@ -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