[Fix] Migrate to pymongo BSON library

* bson is incompatible w/ pip 10, migrate to pymongo bson
* Update tox to run tests w/ locked requirements file as this
  is what production images are built with

Change-Id: Iacf3301ddc224f3525102b0204f349b733608138
This commit is contained in:
Scott Hussey 2018-04-19 09:09:25 -05:00
parent 29f416aefe
commit 94d351b364
5 changed files with 33 additions and 33 deletions

View File

@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
"""Model representing MAAS node/machine resource.""" """Model representing MAAS node/machine resource."""
import logging
import drydock_provisioner.error as errors import drydock_provisioner.error as errors
import drydock_provisioner.drivers.node.maasdriver.models.base as model_base 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.blockdev as maas_blockdev
import drydock_provisioner.drivers.node.maasdriver.models.volumegroup as maas_vg 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): class Machine(model_base.ResourceBase):
@ -288,7 +290,7 @@ class Machine(model_base.ResourceBase):
resp = self.api_client.get(url, op='details') resp = self.api_client.get(url, op='details')
if resp.status_code == 200: if resp.status_code == 200:
detail_config = bson.loads(resp.content) detail_config = BSON.decode(resp.content)
return detail_config return detail_config
def set_owner_data(self, key, value): def set_owner_data(self, key, value):

View File

@ -6,7 +6,7 @@ oslo.versionedobjects==1.23.0
requests requests
oauthlib oauthlib
uwsgi==2.0.15 uwsgi==2.0.15
bson==0.4.7 pymongo==3.6.1
oslo.config==3.16.0 oslo.config==3.16.0
click==6.7 click==6.7
PasteDeploy==1.5.2 PasteDeploy==1.5.2

View File

@ -1,20 +1,18 @@
alembic==0.8.2 alembic==0.8.2
amqp==2.2.2 amqp==2.2.2
Babel==2.5.3 Babel==2.5.3
bson==0.4.7
cachetools==2.0.1 cachetools==2.0.1
certifi==2017.11.5 certifi==2018.4.16
chardet==3.0.4 chardet==3.0.4
click==6.7 click==6.7
contextlib2==0.5.5 contextlib2==0.5.5
debtcollector==1.19.0 debtcollector==1.19.0
defusedxml==0.5.0 defusedxml==0.5.0
enum-compat==0.0.2 eventlet==0.22.1
eventlet==0.20.0
falcon==1.4.1 falcon==1.4.1
fasteners==0.14.1 fasteners==0.14.1
futurist==1.6.0 futurist==1.6.0
greenlet==0.4.12 greenlet==0.4.13
idna==2.6 idna==2.6
iso8601==0.1.11 iso8601==0.1.11
Jinja2==2.9.6 Jinja2==2.9.6
@ -25,56 +23,56 @@ kombu==4.1.0
Mako==1.0.7 Mako==1.0.7
MarkupSafe==1.0 MarkupSafe==1.0
monotonic==1.4 monotonic==1.4
msgpack-python==0.5.1 msgpack==0.5.6
netaddr==0.7.19 netaddr==0.7.19
netifaces==0.10.6 netifaces==0.10.6
oauthlib==2.0.6 oauthlib==2.0.7
oslo.concurrency==3.25.0 oslo.concurrency==3.27.0
oslo.config==3.16.0 oslo.config==3.16.0
oslo.context==2.20.0 oslo.context==2.20.0
oslo.i18n==3.19.0 oslo.i18n==3.20.0
oslo.log==3.36.0 oslo.log==3.38.0
oslo.messaging==5.35.0 oslo.messaging==6.2.0
oslo.middleware==3.34.0 oslo.middleware==3.35.0
oslo.policy==1.22.1 oslo.policy==1.22.1
oslo.serialization==2.23.0 oslo.serialization==2.25.0
oslo.service==1.29.0 oslo.service==1.31.1
oslo.utils==3.35.0 oslo.utils==3.36.0
oslo.versionedobjects==1.23.0 oslo.versionedobjects==1.23.0
Paste==2.0.3 Paste==2.0.3
PasteDeploy==1.5.2 PasteDeploy==1.5.2
pbr==3.1.1 pbr==4.0.2
pika==0.11.2 pip==10.0.0
pika-pool==0.1.3
pip==9.0.1
positional==1.2.1 positional==1.2.1
prettytable==0.7.2 prettytable==0.7.2
psycopg2==2.7.3.1 psycopg2==2.7.3.1
PTable==0.9.2 PTable==0.9.2
pycadf==2.6.0 pycadf==2.7.0
pycrypto==2.6.1 pycrypto==2.6.1
pyghmi==1.0.18 pyghmi==1.0.18
pyinotify==0.9.6
pymongo==3.6.1
pyparsing==2.2.0 pyparsing==2.2.0
python-dateutil==2.6.1 python-dateutil==2.7.2
python-editor==1.0.3 python-editor==1.0.3
python-keystoneclient==3.14.0 python-keystoneclient==3.15.0
python-mimeparse==1.6.0 python-mimeparse==1.6.0
pytz==2017.3 pytz==2018.4
PyYAML==3.12 PyYAML==3.12
repoze.lru==0.7 repoze.lru==0.7
requests==2.18.4 requests==2.18.4
rfc3986==1.1.0 rfc3986==1.1.0
Routes==2.4.1 Routes==2.4.1
setuptools==38.4.0 setuptools==39.0.1
six==1.11.0 six==1.11.0
SQLAlchemy==1.1.14 SQLAlchemy==1.1.14
statsd==3.2.2 statsd==3.2.2
stevedore==1.28.0 stevedore==1.28.0
tenacity==4.8.0 tenacity==4.10.0
ulid2==0.1.1 ulid2==0.1.1
urllib3==1.22 urllib3==1.22
uWSGI==2.0.15 uWSGI==2.0.15
vine==1.1.4 vine==1.1.4
WebOb==1.7.4 WebOb==1.8.1
wheel==0.30.0 wheel==0.31.0
wrapt==1.10.11 wrapt==1.10.11

View File

@ -26,11 +26,11 @@ class TestBuildDataCollection(object):
'lshw': '<xml><test>foo</test></xml>'.encode(), 'lshw': '<xml><test>foo</test></xml>'.encode(),
'lldp': '<xml><test>bar</test></xml>'.encode(), 'lldp': '<xml><test>bar</test></xml>'.encode(),
} }
bson_data = bson.loads(bson.dumps(sample_data)) bson_data = bson.BSON.encode(sample_data)
machine = mocker.MagicMock() machine = mocker.MagicMock()
mocker_config = { mocker_config = {
'get_details.return_value': bson_data, 'get_details.return_value': bson.BSON.decode(bson_data),
'hostname': 'foo', 'hostname': 'foo',
} }
machine.configure_mock(**mocker_config) machine.configure_mock(**mocker_config)

View File

@ -5,7 +5,7 @@ envlist = pep8,bandit,unit
setenv = YAMLDIR = {toxinidir}/tests/yaml_samples/ setenv = YAMLDIR = {toxinidir}/tests/yaml_samples/
basepython=python3.5 basepython=python3.5
deps= deps=
-rrequirements-direct.txt -rrequirements-lock.txt
-rrequirements-test.txt -rrequirements-test.txt
[testenv:freeze] [testenv:freeze]