Skip to content

Commit

Permalink
Fix error pkg_resources.DistributionNotFound: odoo==9.0c
Browse files Browse the repository at this point in the history
The build runs 'pip install -e' on the odoo src, which creates an
odoo.egg-info directory *inside /opt/odoo/src*. So when we run a
container with a volume shared with the host, we don't have this
.egg-info (at least the first time).
When it happens, we reinstall odoo. We don't want to run it anytime
because it would slow the start of the containers
  • Loading branch information
guewen committed Jul 13, 2016
1 parent 21e98db commit 7a4df71
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
19 changes: 16 additions & 3 deletions 9.0/bin/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ USER_ID=${LOCAL_USER_ID:-9001}
echo "Starting with UID : $USER_ID"
id -u odoo &> /dev/null || useradd --shell /bin/bash -u $USER_ID -o -c "" -m odoo

BASEDIR=$(dirname $0)
BINDIR=$(dirname $0)
BASEDIR=$(readlink -f $BINDIR/..)

# Accepted values for DEMO: True / False
# Odoo use a reverse boolean for the demo, which is not handy,
Expand Down Expand Up @@ -56,7 +57,7 @@ case "$(echo "${DEMO}" | tr '[:upper:]' '[:lower:]' )" in
esac

# Create configuration file from the template
CONFIGDIR=$BASEDIR/../etc
CONFIGDIR=$BASEDIR/etc
if [ -e $CONFIGDIR/openerp.cfg.tmpl ]; then
dockerize -template $CONFIGDIR/openerp.cfg.tmpl:$CONFIGDIR/openerp.cfg
fi
Expand All @@ -66,8 +67,20 @@ if [ ! -f "$CONFIGDIR/openerp.cfg" ]; then
exit 1
fi

if [ -z "$(pip list | grep "/opt/odoo/src")" ]; then
# The build runs 'pip install -e' on the odoo src, which creates an
# odoo.egg-info directory *inside /opt/odoo/src*. So when we run a container
# with a volume shared with the host, we don't have this .egg-info (at least
# the first time).
# When it happens, we reinstall the odoo python package. We don't want to run
# the install everytime because it would slow the start of the containers
echo '/opt/odoo/src/odoo.egg-info is missing, probably because the directory is a volume.'
echo 'Running pip install -e /opt/odoo/src to restore odoo.egg-info'
pip install -e $BASEDIR/src
fi

# Wait until postgres is up
$BASEDIR/wait_postgres.sh
$BINDIR/wait_postgres.sh

BASE_CMD=$(basename $1)
if [ "$BASE_CMD" = "odoo.py" ]; then
Expand Down
4 changes: 4 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ Release History
Unreleased
++++++++++

**Fixes**

* Fix error ``pkg_resources.DistributionNotFound: odoo==9.0c`` happening at the
start of the container when we use a host volume for the odoo's src.

1.0.2 (2016-07-12)
++++++++++++++++++
Expand Down

0 comments on commit 7a4df71

Please sign in to comment.