Skip to content

Commit

Permalink
fix: Malformed content app URL (ansible#43)
Browse files Browse the repository at this point in the history
* Use CONTENT_PATH_PREFIX setting from pulpcore to
  build content app URL.
* Fix missing X_PULP_CONTENT_HOST setting for development
  environment.
  • Loading branch information
cutwater authored Mar 23, 2020
1 parent b4042a2 commit 63864a8
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 5 deletions.
1 change: 0 additions & 1 deletion dev/automation-hub/galaxy_ng.env
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
PULP_API_PATH_PREFIX=
PULP_CONTENT_PATH_PREFIX=/api/automation-hub/v3/artifacts/collections/

PULP_GALAXY_API_PATH_PREFIX=/api/automation-hub/
Expand Down
4 changes: 3 additions & 1 deletion dev/common/galaxy_ng.env
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ PULP_DB_NAME=galaxy_ng

PULP_REDIS_HOST=redis

PULP_CONTENT_ORIGIN="http://localhost:5001"
PULP_CONTENT_ORIGIN="http://localhost:5001"

PULP_X_PULP_CONTENT_HOST=content-app
2 changes: 2 additions & 0 deletions dev/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ services:
content-app:
image: "localhost/${COMPOSE_PROJECT_NAME}/galaxy_ng:latest"
command: ['run', 'content-app']
ports:
- "24816:24816"
env_file:
- './common/galaxy_ng.env'
- './automation-hub/galaxy_ng.env'
Expand Down
2 changes: 1 addition & 1 deletion galaxy_ng/app/api/v3/viewsets.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ def get(self, request, *args, **kwargs):
url = 'http://{host}:{port}/{prefix}/automation-hub/{filename}'.format(
host=settings.X_PULP_CONTENT_HOST,
port=settings.X_PULP_CONTENT_PORT,
prefix=settings.X_PULP_CONTENT_PATH_PREFIX.strip('/'),
prefix=settings.CONTENT_PATH_PREFIX.strip('/'),
filename=self.kwargs['filename'],
)
response = requests.get(url, stream=True, allow_redirects=False)
Expand Down
3 changes: 1 addition & 2 deletions galaxy_ng/app/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,5 @@
X_PULP_API_PASSWORD = "admin"
X_PULP_API_PREFIX = "pulp_ansible/galaxy/automation-hub/api"

X_PULP_CONTENT_HOST = "pulp-content"
X_PULP_CONTENT_HOST = "localhost"
X_PULP_CONTENT_PORT = 24816
X_PULP_CONTENT_PATH_PREFIX = f"/{GALAXY_API_PATH_PREFIX}/v3/artifacts/collections/"

0 comments on commit 63864a8

Please sign in to comment.