Merge lp:~cjohnston/uci-engine/fix-allowed-hosts into lp:uci-engine

Proposed by Chris Johnston
Status: Merged
Approved by: Tom Haddon
Approved revision: 526
Merged at revision: 526
Proposed branch: lp:~cjohnston/uci-engine/fix-allowed-hosts
Merge into: lp:uci-engine
Diff against target: 54 lines (+9/-2)
4 files modified
charms/precise/python-django/config.yaml (+5/-0)
charms/precise/python-django/hooks/hooks.py (+2/-0)
juju-deployer/ppa-assigner.yaml.tmpl (+1/-1)
juju-deployer/ticket-system.yaml.tmpl (+1/-1)
To merge this branch: bzr merge lp:~cjohnston/uci-engine/fix-allowed-hosts
Reviewer Review Type Date Requested Status
Andy Doan (community) Approve
Tom Haddon Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+221559@code.launchpad.net

Commit message

Add hostname config option to python-django for specifying a domain

Description of the change

Hard coding django_allowed_hosts broke the ability to deploy a development environment. Remove the hard coded django_allowed_hosts, add a hostname config option to the python-django charm to allow adding a domain name.

ALLOWED_HOSTS = ['juju-hp-machine-2', 'juju-hp-machine-2', '15.125.64.86', '10.0.0.86', u'ci-airline.staging.canonical.com']

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

PASSED: Continuous integration, rev:526
http://s-jenkins.ubuntu-ci:8080/job/uci-engine-ci/761/
Executed test runs:

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/uci-engine-ci/761/rebuild

review: Approve (continuous-integration)
Revision history for this message
Tom Haddon (mthaddon) wrote :

Looks good to me. There was a longer discussion on IRC about dev/staging/prod configs, but this change is good for now.

review: Approve
Revision history for this message
Andy Doan (doanac) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'charms/precise/python-django/config.yaml'
2--- charms/precise/python-django/config.yaml 2014-05-23 12:48:00 +0000
3+++ charms/precise/python-django/config.yaml 2014-05-30 14:50:08 +0000
4@@ -133,6 +133,11 @@
5 Allows setting up extra settings.* values for Django. Acceptable
6 values are limited to comma delimited key-value pairs like:
7 SETTING_X=foo, SETTING_Y=bar
8+ hostname:
9+ type: string
10+ description: |
11+ External hostname for your service, to be added to allowed_hosts.
12+ Should not be needed if you specify django_allowed_hosts
13 urls_dir_name:
14 type: string
15 default: "juju_urls"
16
17=== modified file 'charms/precise/python-django/hooks/hooks.py'
18--- charms/precise/python-django/hooks/hooks.py 2014-05-23 10:40:13 +0000
19+++ charms/precise/python-django/hooks/hooks.py 2014-05-30 14:50:08 +0000
20@@ -586,6 +586,8 @@
21 ip = run('unit-get public-address').strip()
22 private_ip = run('unit-get private-address').strip()
23 allowed = [socket.gethostname(), socket.getfqdn(), ip, private_ip]
24+ if 'hostname' in config_data:
25+ allowed.append(config_data['hostname'])
26 if 'django_allowed_hosts' in config_data:
27 allowed = config_data['django_allowed_hosts'].split(' ')
28 process_template('allowed_hosts.tmpl', {'allowed_hosts': allowed}, dst)
29
30=== modified file 'juju-deployer/ppa-assigner.yaml.tmpl'
31--- juju-deployer/ppa-assigner.yaml.tmpl 2014-05-29 23:03:05 +0000
32+++ juju-deployer/ppa-assigner.yaml.tmpl 2014-05-30 14:50:08 +0000
33@@ -12,7 +12,7 @@
34 application_path: ppa-assigner/
35 django_settings: ppa_assigner.settings
36 django_south: True
37- django_allowed_hosts: ppa-assigner
38+ hostname: ppa-assigner
39 python_path: /srv/ci_airline_ppa_django/ci-utils:/srv/ci_airline_ppa_django/ppa-assigner
40 unit-config: include-base64://configs/unit_config.yaml
41 json_status_path: api/v1/status/
42
43=== modified file 'juju-deployer/ticket-system.yaml.tmpl'
44--- juju-deployer/ticket-system.yaml.tmpl 2014-05-29 23:03:05 +0000
45+++ juju-deployer/ticket-system.yaml.tmpl 2014-05-30 14:50:08 +0000
46@@ -27,7 +27,7 @@
47 django_settings: ticket_system.settings
48 django_south: True
49 django_debug: True
50- django_allowed_hosts: ci-airline.staging.canonical.com
51+ hostname: ci-airline.staging.canonical.com
52 python_path: /srv/ci_airline_ts_django/ci-utils:/srv/ci_airline_ts_django/ticket_system
53 # this gets shared with gunicorn via a relation-set in this charm
54 wsgi_wsgi_file: ticket_system.wsgi:application

Subscribers

People subscribed via source and target branches