ansible / galaxy

Legacy Galaxy still available as read-only on https://old-galaxy.ansible.com - looking for the new galaxy -> https://github.com/ansible/galaxy_ng
Apache License 2.0
855 stars 329 forks source link

So close: The 'galaxy' distribution was not found #59

Open chouseknecht opened 7 years ago

chouseknecht commented 7 years ago

From @smapjb on February 15, 2017 10:28

I have managed to get this up and running behind the firewall following the CONTRIBUTOR instructions.

I noticed the following fly by the logs on 'make run'

django_1             | TASK [Perform initial migrations] **********************************************
django_1             | fatal: [localhost]: FAILED! => {"changed": true, "cmd": ["/venv/bin/galaxy-manage", "migrate", "--noinput", "--fake-initial"], "delta": "0:00:01.190621", "end": "2017-02-15 09:49:12.751114", "failed": true, "rc": 1, "start": "2017-02-15 09:49:11.560493", "stderr": "Traceback (most recent call last):\n  File \"/venv/bin/galaxy-manage\", line 6, in <module>\n    from pkg_resources import load_entry_point\n  File \"build/bdist.linux-x86_64/egg/pkg_resources/__init__.py\", line 3019, in <module>\n  File \"build/bdist.linux-x86_64/egg/pkg_resources/__init__.py\", line 3003, in _call_aside\n  File \"build/bdist.linux-x86_64/egg/pkg_resources/__init__.py\", line 3032, in _initialize_master_working_set\n  File \"build/bdist.linux-x86_64/egg/pkg_resources/__init__.py\", line 655, in _build_master\n  File \"build/bdist.linux-x86_64/egg/pkg_resources/__init__.py\", line 963, in require\n  File \"build/bdist.linux-x86_64/egg/pkg_resources/__init__.py\", line 849, in resolve\npkg_resources.DistributionNotFound: The 'galaxy' distribution was not found and is required by the application", "stdout": "", "stdout_lines": [], "warnings": []}
django_1             |  to retry, use: --limit @/setup/dbinit.retry

I similarly get the same when I 'make createsuperuser'

[root@galaxy galaxy]# make createsuperuser
Create Superuser
Traceback (most recent call last):
  File "/venv/bin/galaxy-manage", line 6, in <module>
    from pkg_resources import load_entry_point
  File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 3019, in <module>
  File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 3003, in _call_aside
  File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 3032, in _initialize_master_working_set
  File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 655, in _build_master
  File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 963, in require
  File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 849, in resolve
pkg_resources.DistributionNotFound: The 'galaxy' distribution was not found and is required by the application
make: *** [createsuperuser] Error 1

I have tried putting / /galaxy and even /galaxy/galaxy on the python path from 'make shell' but I can't get the galaxy-manage command work.

Too many new concepts in my brain at once, could use a pointer?

My setup is

[root@galaxy galaxy]# cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 7.3 (Maipo)
[root@galaxy galaxy]# docker --version
Docker version 1.12.5, build 047e51b/1.12.5
[root@galaxy galaxy]# ansible-container version
Ansible Container, version 0.3.0-pre
[root@galaxy galaxy]# ansible --version
ansible 2.2.1.0
  config file = 
  configured module search path = Default w/o overrides

Copied from original issue: ansible/galaxy-issues#234

chouseknecht commented 7 years ago

From @smapjb on February 15, 2017 18:15

To get this working I had to

[root@galaxy galaxy]# docker exec -u 0 -i -t ansible_django_1 /bin/bash
[root@90b06225a736 galaxy]# /venv/bin/activate
[root@90b06225a736 galaxy]# /venv/bin/python /galaxy/setup.py install

And because the ansible_gulp_1 container had failed I also had to

docker commit ansible_gulp_1 temp_image
docker run -v ${pwd}:/galaxy:z --entrypoint=bash -it temp_image

And then from inside the container

npm install
gulp

So clearly those tasks are failing in the ansible-container build

chouseknecht commented 7 years ago

From @MarcusTomlinson on April 17, 2017 19:16

So the issue with gulp was that the package.json file from galaxy/ was not being copied over to the container for the "Install node packages" task to do anything useful. Unfortunately you get a 0 return from "npm install" even when a package.json file is not present, so all looks to have executed correctly during the build, when it really didn’t.

The issue with the django container was that by installing galaxy in editable mode (“setup.py develop”) the egg-info dir was being dropped into the container’s /galaxy directory. Upon restarting the container, that galaxy folder (and consequently the egg-info dir) is overwritten with a mount of your local galaxy directory. By calling “setup.py develop” from outside of the mount location and setting PYTHONPATH to the source directory, you can have the egg-info persist over restarts.

I’ve pull requested a branch for these fixes here: https://github.com/ansible/galaxy/pull/21