diff --git a/drydock_provisioner/drivers/node/maasdriver/models/machine.py b/drydock_provisioner/drivers/node/maasdriver/models/machine.py index c00e887a..2c71592d 100644 --- a/drydock_provisioner/drivers/node/maasdriver/models/machine.py +++ b/drydock_provisioner/drivers/node/maasdriver/models/machine.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. """Model representing MAAS node/machine resource.""" +import logging import drydock_provisioner.error as errors import drydock_provisioner.drivers.node.maasdriver.models.base as model_base @@ -19,8 +20,9 @@ import drydock_provisioner.drivers.node.maasdriver.models.interface as maas_inte import drydock_provisioner.drivers.node.maasdriver.models.blockdev as maas_blockdev import drydock_provisioner.drivers.node.maasdriver.models.volumegroup as maas_vg -import bson +from bson import BSON +LOG = logging.getLogger(__name__) class Machine(model_base.ResourceBase): @@ -288,7 +290,7 @@ class Machine(model_base.ResourceBase): resp = self.api_client.get(url, op='details') if resp.status_code == 200: - detail_config = bson.loads(resp.content) + detail_config = BSON.decode(resp.content) return detail_config def set_owner_data(self, key, value): diff --git a/requirements-direct.txt b/requirements-direct.txt index 8465992e..814eeab3 100644 --- a/requirements-direct.txt +++ b/requirements-direct.txt @@ -6,7 +6,7 @@ oslo.versionedobjects==1.23.0 requests oauthlib uwsgi==2.0.15 -bson==0.4.7 +pymongo==3.6.1 oslo.config==3.16.0 click==6.7 PasteDeploy==1.5.2 diff --git a/requirements-lock.txt b/requirements-lock.txt index 90dbe01d..28235636 100644 --- a/requirements-lock.txt +++ b/requirements-lock.txt @@ -1,20 +1,18 @@ alembic==0.8.2 amqp==2.2.2 Babel==2.5.3 -bson==0.4.7 cachetools==2.0.1 -certifi==2017.11.5 +certifi==2018.4.16 chardet==3.0.4 click==6.7 contextlib2==0.5.5 debtcollector==1.19.0 defusedxml==0.5.0 -enum-compat==0.0.2 -eventlet==0.20.0 +eventlet==0.22.1 falcon==1.4.1 fasteners==0.14.1 futurist==1.6.0 -greenlet==0.4.12 +greenlet==0.4.13 idna==2.6 iso8601==0.1.11 Jinja2==2.9.6 @@ -25,56 +23,56 @@ kombu==4.1.0 Mako==1.0.7 MarkupSafe==1.0 monotonic==1.4 -msgpack-python==0.5.1 +msgpack==0.5.6 netaddr==0.7.19 netifaces==0.10.6 -oauthlib==2.0.6 -oslo.concurrency==3.25.0 +oauthlib==2.0.7 +oslo.concurrency==3.27.0 oslo.config==3.16.0 oslo.context==2.20.0 -oslo.i18n==3.19.0 -oslo.log==3.36.0 -oslo.messaging==5.35.0 -oslo.middleware==3.34.0 +oslo.i18n==3.20.0 +oslo.log==3.38.0 +oslo.messaging==6.2.0 +oslo.middleware==3.35.0 oslo.policy==1.22.1 -oslo.serialization==2.23.0 -oslo.service==1.29.0 -oslo.utils==3.35.0 +oslo.serialization==2.25.0 +oslo.service==1.31.1 +oslo.utils==3.36.0 oslo.versionedobjects==1.23.0 Paste==2.0.3 PasteDeploy==1.5.2 -pbr==3.1.1 -pika==0.11.2 -pika-pool==0.1.3 -pip==9.0.1 +pbr==4.0.2 +pip==10.0.0 positional==1.2.1 prettytable==0.7.2 psycopg2==2.7.3.1 PTable==0.9.2 -pycadf==2.6.0 +pycadf==2.7.0 pycrypto==2.6.1 pyghmi==1.0.18 +pyinotify==0.9.6 +pymongo==3.6.1 pyparsing==2.2.0 -python-dateutil==2.6.1 +python-dateutil==2.7.2 python-editor==1.0.3 -python-keystoneclient==3.14.0 +python-keystoneclient==3.15.0 python-mimeparse==1.6.0 -pytz==2017.3 +pytz==2018.4 PyYAML==3.12 repoze.lru==0.7 requests==2.18.4 rfc3986==1.1.0 Routes==2.4.1 -setuptools==38.4.0 +setuptools==39.0.1 six==1.11.0 SQLAlchemy==1.1.14 statsd==3.2.2 stevedore==1.28.0 -tenacity==4.8.0 +tenacity==4.10.0 ulid2==0.1.1 urllib3==1.22 uWSGI==2.0.15 vine==1.1.4 -WebOb==1.7.4 -wheel==0.30.0 +WebOb==1.8.1 +wheel==0.31.0 wrapt==1.10.11 diff --git a/tests/integration/postgres/test_build_data_collection.py b/tests/integration/postgres/test_build_data_collection.py index 6087ffac..a9a26926 100644 --- a/tests/integration/postgres/test_build_data_collection.py +++ b/tests/integration/postgres/test_build_data_collection.py @@ -26,11 +26,11 @@ class TestBuildDataCollection(object): 'lshw': 'foo'.encode(), 'lldp': 'bar'.encode(), } - bson_data = bson.loads(bson.dumps(sample_data)) + bson_data = bson.BSON.encode(sample_data) machine = mocker.MagicMock() mocker_config = { - 'get_details.return_value': bson_data, + 'get_details.return_value': bson.BSON.decode(bson_data), 'hostname': 'foo', } machine.configure_mock(**mocker_config) diff --git a/tox.ini b/tox.ini index 8098f8cd..f1a069f2 100644 --- a/tox.ini +++ b/tox.ini @@ -5,7 +5,7 @@ envlist = pep8,bandit,unit setenv = YAMLDIR = {toxinidir}/tests/yaml_samples/ basepython=python3.5 deps= - -rrequirements-direct.txt + -rrequirements-lock.txt -rrequirements-test.txt [testenv:freeze]