Merge lp:~verterok/canonical-identity-provider/xenial-charm into lp:~ubuntuone-pqm-team/canonical-identity-provider/charm

Proposed by Guillermo Gonzalez on 2019-04-30
Status: Merged
Approved by: Guillermo Gonzalez on 2019-05-22
Approved revision: 94
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: lp:~verterok/canonical-identity-provider/xenial-charm
Merge into: lp:~ubuntuone-pqm-team/canonical-identity-provider/charm
Diff against target: 201 lines (+43/-18)
9 files modified
config.yaml (+0/-4)
hooks/hooks.py (+3/-0)
hooks/install (+21/-0)
playbook.yaml (+8/-7)
roles/directories-and-permissions/handlers/main.yaml (+3/-1)
roles/directories-and-permissions/tasks/main.yaml (+3/-1)
roles/django/tasks/main.yaml (+3/-3)
templates/settings.py.j2 (+1/-1)
unit_tests/test_templates.py (+1/-1)
To merge this branch: bzr merge lp:~verterok/canonical-identity-provider/xenial-charm
Reviewer Review Type Date Requested Status
Daniel Manrique 2019-04-30 Approve on 2019-04-30
Review via email: mp+366733@code.launchpad.net

Commit message

make it work in xenial

Description of the change

Please do not land this as it will break CI, we need to coordinate landing of several branches and jenkins config updates

To post a comment you must log in.
Daniel Manrique (roadmr) wrote :

LGTM

review: Approve
94. By Guillermo Gonzalez on 2019-05-22

fix template tests

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'config.yaml'
2--- config.yaml 2018-08-31 18:29:22 +0000
3+++ config.yaml 2019-05-22 17:28:46 +0000
4@@ -209,10 +209,6 @@
5 type: string
6 default: ""
7 description: Key for SAML cert for google, in base64
8- user:
9- default: ubunet
10- type: string
11- description: user to run under
12 raven_dsn:
13 type: string
14 default: ""
15
16=== modified file 'hooks/hooks.py'
17--- hooks/hooks.py 2015-12-01 17:52:16 +0000
18+++ hooks/hooks.py 2019-05-22 17:28:46 +0000
19@@ -70,4 +70,7 @@
20
21
22 if __name__ == "__main__":
23+ # workaround install.real script name
24+ if 'install.real' in sys.argv[0]:
25+ sys.argv[0] = sys.argv[0].replace('install.real', 'install')
26 hooks.execute(sys.argv)
27
28=== added file 'hooks/install'
29--- hooks/install 1970-01-01 00:00:00 +0000
30+++ hooks/install 2019-05-22 17:28:46 +0000
31@@ -0,0 +1,21 @@
32+#!/bin/bash
33+# Wrapper to deal with newer Ubuntu versions that don't have py2 installed
34+# by default.
35+
36+declare -a DEPS=('apt' 'netaddr' 'netifaces' 'pip' 'yaml')
37+
38+check_and_install() {
39+ pkg="${1}-${2}"
40+ if ! dpkg -s ${pkg} 2>&1 > /dev/null; then
41+ apt-get -y install ${pkg}
42+ fi
43+}
44+
45+PYTHON="python"
46+
47+for dep in ${DEPS[@]}; do
48+ check_and_install ${PYTHON} ${dep}
49+done
50+
51+exec ./hooks/install.real
52+
53
54=== renamed symlink 'hooks/install' => 'hooks/install.real'
55=== modified file 'playbook.yaml'
56--- playbook.yaml 2018-07-11 15:47:41 +0000
57+++ playbook.yaml 2019-05-22 17:28:46 +0000
58@@ -2,6 +2,7 @@
59 - hosts: localhost
60
61 vars:
62+ user: "ubunet"
63 hostdir: /srv/{{ hostname }}
64 basedir: /srv/{{ hostname }}/{{ deployment }}
65 code_dir: "{{ basedir }}/code"
66@@ -10,13 +11,13 @@
67 venv: "{{ current_dir }}/env"
68 python: "{{ venv }}/bin/python"
69 wheel_dir: "{{ current_dir }}/branches/wheels"
70- log_dir: "{{ basedir }}/logs"
71- sso_log: "{{ log_dir }}/sso.log"
72+ logs_dir: "{{ basedir }}/logs"
73+ sso_log: "{{ logs_dir }}/sso.log"
74 oops_dir: "{{ basedir }}/logs/www-oops"
75 conf_dir: "{{ basedir }}/etc"
76 run_dir: "{{ basedir }}/run"
77 bin_dir: "{{ basedir }}/bin"
78- migrate_log_dir: "{{ log_dir }}/schema-updates"
79+ migrate_log_dir: "{{ logs_dir }}/schema-updates"
80 db_readonly_path: "{{ run_dir }}"
81 port: 8080
82 conn_check_script: "{{ current_dir }}/scripts/settings-to-conncheck.py"
83@@ -46,14 +47,14 @@
84 when: relations['nrpe-external-master'] and 'nagios_host_context' in relations['nrpe-external-master'][0]
85
86 - role: directories-and-permissions
87- user: "{{ user }}"
88+ user: "ubunet"
89 readonly_dirs:
90 - "{{ code_dir }}"
91 - "{{ archive_dir }}"
92 - "{{ conf_dir }}"
93 - "{{ bin_dir }}"
94 writable_dirs:
95- - "{{ log_dir }}"
96+ - "{{ logs_dir }}"
97 - "{{ run_dir }}"
98 - "{{ oops_dir }}"
99 - "{{ migrate_log_dir }}"
100@@ -72,7 +73,7 @@
101 current_symlink: "{{ build_label }}"
102 service_name: "{{ hostname }}"
103 listen_port: "{{ port }}"
104- log_dir: "{{ log_dir }}"
105+ log_dir: "{{ logs_dir }}"
106 wsgi_user: "{{ user }}"
107 wsgi_group: "{{ user }}"
108 wsgi_application: django_project.wsgi
109@@ -162,7 +163,7 @@
110 tags:
111 - config-changed
112 file:
113- path: "{{ log_dir }}/sso.log"
114+ path: "{{ logs_dir }}/sso.log"
115 src: /var/log/upstart/gunicorn.log
116 state: link
117 # temporary when until migrated to talisker
118
119=== modified file 'roles/directories-and-permissions/handlers/main.yaml'
120--- roles/directories-and-permissions/handlers/main.yaml 2015-10-01 13:52:11 +0000
121+++ roles/directories-and-permissions/handlers/main.yaml 2019-05-22 17:28:46 +0000
122@@ -1,7 +1,9 @@
123 # ansible file module's recursion seems broken
124 - name: Ensure group ownership
125 shell: chown -R :{{ user }} {{ item }}
126- with_items: readonly_dirs + writable_dirs
127+ with_flattened:
128+ - readonly_dirs
129+ - writable_dirs
130
131 - name: Ensure readonly group permissions
132 shell: chmod -R g-w {{ item }}
133
134=== modified file 'roles/directories-and-permissions/tasks/main.yaml'
135--- roles/directories-and-permissions/tasks/main.yaml 2015-10-01 13:52:11 +0000
136+++ roles/directories-and-permissions/tasks/main.yaml 2019-05-22 17:28:46 +0000
137@@ -16,7 +16,9 @@
138 - upgrade-charm
139 - config-changed
140 command: mkdir -p {{ item }}
141- with_items: readonly_dirs + writable_dirs
142+ with_flattened:
143+ - readonly_dirs
144+ - writable_dirs
145
146 - name: Force permissions
147 tags:
148
149=== modified file 'roles/django/tasks/main.yaml'
150--- roles/django/tasks/main.yaml 2018-02-26 15:51:30 +0000
151+++ roles/django/tasks/main.yaml 2019-05-22 17:28:46 +0000
152@@ -14,20 +14,20 @@
153 when: has_syncdb|success
154 tags: migrate
155 command: "{{ python }} {{ manage }} syncdb --noinput"
156- environment: migrate_env
157+ environment: "{{ migrate_env }}"
158 args:
159 chdir: "{{ src_dir }}"
160
161 - name: run migrations
162 tags: migrate
163 command: "{{ python }} {{ manage }} migrate --noinput {% if build_label == 'r1604' %}--fake-initial{% endif %}"
164- environment: migrate_env
165+ environment: "{{ migrate_env }}"
166 args:
167 chdir: "{{ src_dir }}"
168
169 - name: grant user
170 tags: migrate
171 command: "{{ python }} {{ manage }} grantuser {{ grant_user }}"
172- environment: migrate_env
173+ environment: "{{ migrate_env }}"
174 args:
175 chdir: "{{ src_dir }}"
176
177=== modified file 'templates/settings.py.j2'
178--- templates/settings.py.j2 2018-08-31 18:29:22 +0000
179+++ templates/settings.py.j2 2019-05-22 17:28:46 +0000
180@@ -6,7 +6,7 @@
181 import os
182
183 os.environ['SSO_HOST_DIR'] = "{{ hostdir }}"
184-os.environ.setdefault('SSO_LOGS_DIR', "{{ log_dir }}")
185+os.environ.setdefault('SSO_LOGS_DIR', "{{ logs_dir }}")
186 os.environ.setdefault('SSO_ROOT_URL', "https://{{ hostname }}")
187
188 from django_project.settings_base import *
189
190=== modified file 'unit_tests/test_templates.py'
191--- unit_tests/test_templates.py 2017-10-10 16:11:43 +0000
192+++ unit_tests/test_templates.py 2019-05-22 17:28:46 +0000
193@@ -109,7 +109,7 @@
194 "port": 8080,
195 "hostdir": "/hostdir",
196 "basedir": "/basedir",
197- "log_dir": "/logdir",
198+ "logs_dir": "/logdir",
199 "db_readonly_path": "/tmp",
200 "google_saml_key_path": "/saml/key",
201 "google_saml_cert_path": "/saml/cert",

Subscribers

People subscribed via source and target branches