diff --git a/sysinv/sysinv/centos/sysinv.spec b/sysinv/sysinv/centos/sysinv.spec index ee67f72d60..13dfd214b2 100644 --- a/sysinv/sysinv/centos/sysinv.spec +++ b/sysinv/sysinv/centos/sysinv.spec @@ -37,8 +37,7 @@ Requires: python-webob Requires: python-webtest Requires: python-wsme Requires: python-six -Requires: python2-django -Requires: python2-mox3 +Requires: python2-rfc3986 Requires: python2-oslo-i18n Requires: python2-oslo-config Requires: python2-oslo-concurrency diff --git a/sysinv/sysinv/debian/control b/sysinv/sysinv/debian/control index a2ddeb6773..1c84324913 100644 --- a/sysinv/sysinv/debian/control +++ b/sysinv/sysinv/debian/control @@ -16,9 +16,9 @@ Architecture: all Depends: ${misc:Depends}, ${python:Depends}, python-boto3, - python-django, python-docker, python-parted, + python-rfc3986, python-six, python-pyudev, python-pbr, @@ -48,7 +48,6 @@ Depends: ${misc:Depends}, python-retrying, python-sqlalchemy, python-stevedore, - python-mox3, python-pytest, python-testtools, tsconfig diff --git a/sysinv/sysinv/opensuse/sysinv.spec b/sysinv/sysinv/opensuse/sysinv.spec index 3830e89d23..4e335af233 100644 --- a/sysinv/sysinv/opensuse/sysinv.spec +++ b/sysinv/sysinv/opensuse/sysinv.spec @@ -30,6 +30,7 @@ Requires: python2-keystonemiddleware Requires: python2-kubernetes Requires: python2-netaddr Requires: python2-paste +Requires: python2-rfc3986 Requires: python2-pyudev Requires: python2-pbr Requires: python2-psutil @@ -41,7 +42,6 @@ Requires: python2-WSME Requires: python2-six Requires: python2-sqlalchemy Requires: python2-stevedore -Requires: python2-mox3 Requires: python2-oslo.i18n Requires: python2-oslo.config Requires: python2-oslo.concurrency diff --git a/sysinv/sysinv/sysinv/requirements.txt b/sysinv/sysinv/sysinv/requirements.txt index f81c65d854..faeaa9a0de 100644 --- a/sysinv/sysinv/sysinv/requirements.txt +++ b/sysinv/sysinv/sysinv/requirements.txt @@ -1,7 +1,6 @@ pbr>=0.5 SQLAlchemy amqplib>=0.6.1 -argparse boto3 botocore cryptography!=2.0 # BSD/Apache-2.0 @@ -19,6 +18,7 @@ iso8601>=0.1.4 oslo.i18n # Apache-2.0 oslo.config>=3.7.0 # Apache-2.0 oslo.concurrency>=3.7.1 # Apache-2.0 +oslo.log # Apache-2.0 oslo.db>=4.1.0 # Apache-2.0 oslo.messaging!=9.0.0 # Apache-2.0 oslo.rootwrap>=5.8.0 # Apache-2.0 @@ -45,4 +45,9 @@ rpm ruamel.yaml>=0.13.14 # MIT docker # Apache-2.0 kubernetes # Apache-2.0 -Django +pyudev +migrate +python-ldap>=3.1.0 +psycopg2-binary +python-barbicanclient +rfc3986 diff --git a/sysinv/sysinv/sysinv/sysinv/common/utils.py b/sysinv/sysinv/sysinv/sysinv/common/utils.py index 9e5b57fa9d..ac1784bf92 100644 --- a/sysinv/sysinv/sysinv/sysinv/common/utils.py +++ b/sysinv/sysinv/sysinv/sysinv/common/utils.py @@ -49,6 +49,7 @@ import os import pwd import random import re +import rfc3986 import shutil import signal import six @@ -62,7 +63,6 @@ import uuid import wsme import yaml -from django.core.validators import URLValidator from eventlet.green import subprocess from eventlet import greenthread import netaddr @@ -1812,11 +1812,17 @@ def is_openstack_applied(dbapi): def is_url(url_str): + uri = rfc3986.uri_reference(url_str) + validator = rfc3986.validators.Validator().require_presence_of( + 'scheme', 'host', + ).check_validity_of( + 'scheme', 'host', 'path', + ) try: - URLValidator()(url_str) - return True - except Exception: + validator.validate(uri) + except rfc3986.exceptions.RFC3986Exception: return False + return True def is_valid_domain(url_str): diff --git a/sysinv/sysinv/sysinv/sysinv/tests/test_utils.py b/sysinv/sysinv/sysinv/sysinv/tests/test_utils.py index d8e742e460..9a73fbfcf8 100644 --- a/sysinv/sysinv/sysinv/sysinv/tests/test_utils.py +++ b/sysinv/sysinv/sysinv/sysinv/tests/test_utils.py @@ -326,9 +326,15 @@ class GenericUtilsTestCase(base.TestCase): self.assertTrue(any(i in special_chars for i in passwd)) def test_generate_random_password_exception(self): - self.assertRaises(exception.SysinvException, - utils.generate_random_password, - length=7) + self.assertRaises(exception.SysinvException, + utils.generate_random_password, + length=7) + + def test_is_valid_url(self): + self.assertTrue(utils.is_url('http://controller')) + self.assertTrue(utils.is_url('https://controller')) + self.assertFalse(utils.is_url('https://')) + self.assertFalse(utils.is_url('//controller')) class MkfsTestCase(base.TestCase): diff --git a/sysinv/sysinv/sysinv/test-requirements.txt b/sysinv/sysinv/sysinv/test-requirements.txt index 8c83c22fb7..b37e6ff7c6 100644 --- a/sysinv/sysinv/sysinv/test-requirements.txt +++ b/sysinv/sysinv/sysinv/test-requirements.txt @@ -7,9 +7,6 @@ bandit;python_version>="3.0" coverage>=3.6 fixtures>=3.0.0 # Apache-2.0/BSD mock>=2.0.0 # BSD -passlib>=1.7.0 -psycopg2-binary -python-barbicanclient python-subunit>=0.0.18 requests-mock>=0.6.0 # Apache-2.0 sphinx @@ -21,8 +18,3 @@ testtools!=1.2.0,>=0.9.36 isort<5;python_version>="3.0" pylint<2.1.0;python_version<"3.0" # GPLv2 pylint<2.4.0;python_version>="3.0" # GPLv2 -pytest -pyudev -migrate -python-ldap>=3.1.0 -markupsafe