Building the MAAS package fails with "ImportError: No module named bson"

Bug #1346279 reported by Diogo Matsubara
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
maas (Ubuntu)
Fix Released
Critical
Raphaël Badin

Bug Description

As seen in http://d-jenkins.ubuntu-ci:8080/view/MAAS/job/utopic-adt-maas/239/, maas package failed to build with the following error:

HOME=/tmp/adt-run.P7YZGH/ubtree0-build/real-tree/debian/build PYTHONPATH=/tmp/adt-run.P7YZGH/ubtree0-build/real-tree/src/ python2.7 \
 /tmp/adt-run.P7YZGH/ubtree0-build/real-tree/src/maasserver/utils/jsenums.py \
 src/maasserver/enum.py src/metadataserver/enum.py > /tmp/adt-run.P7YZGH/ubtree0-build/real-tree/debian/build/enums.js
Traceback (most recent call last):
  File "/tmp/adt-run.P7YZGH/ubtree0-build/real-tree/src/maasserver/utils/jsenums.py", line 37, in <module>
    from provisioningserver.utils import map_enum
  File "/tmp/adt-run.P7YZGH/ubtree0-build/real-tree/src/provisioningserver/utils/__init__.py", line 70, in <module>
    import bson
ImportError: No module named bson
debian/rules:19: recipe for target 'override_dh_auto_build' failed
make[1]: *** [override_dh_auto_build] Error 1

Tags: ci

Related branches

tags: added: ci
Revision history for this message
Raphaël Badin (rvb) wrote :

The utility in src/maasserver/utils/jsenums.py is used when building the package. It uses the map_enum utility that recently from moved over to src/provisioningserver/utils/__init__.py. The problem with that is that is means that all the modules imported by src/provisioningserver/utils/__init__.py must be present as "build dependencies" in the packaging.

I see three possible solutions here:

- Add all the required dependencies as build dependencies in the packaging.

- Move map_enum in a place where it can be imported in isolation without triggering a ton of imports

- Add a copy of the code of map_enum in src/maasserver/utils/jsenums.py instead of importing the shared map_enum.

summary: - MAAS requires explicit dependency on python-bson
+ Building the MAAS package fails with "ImportError: No module named bson"
Changed in maas (Ubuntu):
status: New → Confirmed
Revision history for this message
Raphaël Badin (rvb) wrote :

The logical place for map_enum really is src/provisioningserver/utils/__init__.py since it's used by both maasserver and pserv so I really don't want to put it somewhere else. Since jsenum is special in the sense that it's used by the packaging, I'd favor option 3: add a copy of map_enum (it's just a couple of lines) in jsenum.

Revision history for this message
Julian Edwards (julian-edwards) wrote :

jsenum has no place in provisioning server, can't you extract that part?

Revision history for this message
Raphaël Badin (rvb) wrote :

> jsenum has no place in provisioning server, can't you extract that part?

jsenum is *not* in provisioningserver, as I said above it's in src/maasserver/utils/, where it should be. The problem is that it's *using things* (well, one thing: map_enum) from provisioningserver

Revision history for this message
Julian Edwards (julian-edwards) wrote : Re: [Bug 1346279] Re: Building the MAAS package fails with "ImportError: No module named bson"

On Tuesday 22 Jul 2014 07:09:59 you wrote:
> jsenum is *not* in provisioningserver, as I said above it's in
> src/maasserver/utils/, where it should be. The problem is that it's
> *using things* (well, one thing: map_enum) from provisioningserver

Yeah my bad. Serves me right for replying when I am jet lagged.

Changed in maas (Ubuntu):
importance: Undecided → Critical
status: Confirmed → Fix Committed
assignee: nobody → Raphaël Badin (rvb)
Changed in maas (Ubuntu):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.