Merge lp:~suligap/canonical-identity-provider/charm-de-oops into lp:~ubuntuone-pqm-team/canonical-identity-provider/charm

Proposed by Przemysław Suliga
Status: Merged
Approved by: Przemysław Suliga
Approved revision: 96
Merge reported by: Otto Co-Pilot
Merged at revision: 99
Proposed branch: lp:~suligap/canonical-identity-provider/charm-de-oops
Merge into: lp:~ubuntuone-pqm-team/canonical-identity-provider/charm
Diff against target: 118 lines (+0/-43)
5 files modified
config.yaml (+0/-16)
deploy.yaml (+0/-1)
playbook.yaml (+0/-2)
templates/settings.py.j2 (+0/-8)
unit_tests/test_templates.py (+0/-16)
To merge this branch: bzr merge lp:~suligap/canonical-identity-provider/charm-de-oops
Reviewer Review Type Date Requested Status
Guillermo Gonzalez Approve
Daniel Manrique (community) Approve
Review via email: mp+385254@code.launchpad.net

Commit message

Remove OOPS config

"Remove OOPSes"
https://code.launchpad.net/~suligap/canonical-identity-provider/+git/canonical-identity-provider/+merge/385205
depends on this change, since the charm currently assumes that settings.OOPSES
(removed in the above MP) exists in settings_base.py

To post a comment you must log in.
Revision history for this message
Daniel Manrique (roadmr) wrote :

+1 code-wise, also worth double-checking with GUillermo in case there's anything we need to be careful with, with removing config options from charms.

The reason is that the CI tests for SSO will try to set the configuration for both the old and new revision, and if things are not updated in the correct order, CI might fail with a version of the charm that doesn't support a specific option, and that'll leave us without a testing path and might require manual intervention.

review: Approve
Revision history for this message
Guillermo Gonzalez (verterok) wrote :

If I remember correctly we need multiple MP to remove a config in a "safe" way.

1) remove the usage in templates and charm code, but keep it in config.yaml

2) land and deploy the changes from (1)

3) remove the config entries from local.yaml and mojo spec deployer configs

4) land that change

5) remove configs from config.yaml

Might be exploding the thing a bit too much and some steps could be merged, need to double check the mojo spec and CI to be sure

Revision history for this message
Przemysław Suliga (suligap) wrote :

Thanks!

FWIW, here's the spec MP: https://code.launchpad.net/~suligap/canonical-mojo-specs/mojo-ols-canonical-identity-provider-de-oops/+merge/385258.

I wonder if it's enough to just do:

1. Land the spec, local.yaml changes.
2. Land this MP.

Since in this charm we only use these config options in templates and unit tests? (and that's what's being removed here apart from the config options themselves.) I'm probably missing something.

Revision history for this message
Przemysław Suliga (suligap) wrote :
Revision history for this message
Guillermo Gonzalez (verterok) wrote :

+1

review: Approve

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 2019-09-26 20:45:23 +0000
3+++ config.yaml 2020-06-08 09:08:44 +0000
4@@ -41,22 +41,6 @@
5 type: string
6 default: ""
7 description: Django secret key. Service will not run without this set.
8- oops_config:
9- type: string
10- default: ""
11- description: >
12- A python dict representing an amqp oops_publisher, with the followinga
13- fields; inherit_id, exchange_name, routing_key, vhost, host user,
14- password
15- content_type: python
16- oops_password:
17- type: string
18- default: ""
19- description: "secret for oops_config password section"
20- oops_reporter:
21- default: AS-PRODUCTION.SSO
22- type: string
23- description: ""
24 captcha_private_key:
25 type: string
26 default: ""
27
28=== modified file 'deploy.yaml'
29--- deploy.yaml 2019-08-15 21:49:05 +0000
30+++ deploy.yaml 2020-06-08 09:08:44 +0000
31@@ -5,7 +5,6 @@
32 charm: local:xenial/canonical-identity-provider
33 options:
34 deployment: devel
35- oops_reporter: AS-DEVEL.SSO
36 secret_key: development
37 statsd_prefix: dev.sso
38 db_user: sso
39
40=== modified file 'playbook.yaml'
41--- playbook.yaml 2020-06-03 06:43:21 +0000
42+++ playbook.yaml 2020-06-08 09:08:44 +0000
43@@ -12,7 +12,6 @@
44 python: "{{ venv }}/bin/python"
45 wheel_dir: "{{ current_dir }}/branches/wheels"
46 logs_dir: "{{ basedir }}/logs"
47- oops_dir: "{{ basedir }}/logs/www-oops"
48 conf_dir: "{{ basedir }}/etc"
49 run_dir: "{{ basedir }}/run"
50 bin_dir: "{{ basedir }}/bin"
51@@ -55,7 +54,6 @@
52 writable_dirs:
53 - "{{ logs_dir }}"
54 - "{{ run_dir }}"
55- - "{{ oops_dir }}"
56 - "{{ migrate_log_dir }}"
57
58 - role: payload
59
60=== modified file 'templates/settings.py.j2'
61--- templates/settings.py.j2 2019-09-26 20:45:23 +0000
62+++ templates/settings.py.j2 2020-06-08 09:08:44 +0000
63@@ -89,14 +89,6 @@
64 {% if noreply_from_address %}
65 NOREPLY_FROM_ADDRESS = "{{ noreply_from_address }}"
66 {% endif %}
67-{% if oops_config %}
68-{# TODO: ensure oops_config is dict? #}
69-OOPSES['publishers'].append({{ oops_config }})
70-{% if oops_password %}
71-OOPSES['publishers'][-1]['password'] = "{{ oops_password }}"
72-{% endif %}
73-{% endif %}
74-OOPSES['template']['reporter'] = '{{ oops_reporter }}'
75 OPENID_LAUNCHPAD_STAFF_TEAMS = {{ openid_launchpad_staff_teams }}
76 OPENID_LAUNCHPAD_TEAMS_MAPPING = {{ openid_launchpad_teams_mapping }}
77 {% if openid_token_limit %}
78
79=== modified file 'unit_tests/test_templates.py'
80--- unit_tests/test_templates.py 2019-05-22 17:28:30 +0000
81+++ unit_tests/test_templates.py 2020-06-08 09:08:44 +0000
82@@ -65,7 +65,6 @@
83 # mock things in settings_base module that we modify, rather than
84 # overwrite
85 m = imp.new_module('settings_base')
86- m.OOPSES = {'publishers': [], 'template': {}}
87 m.DATABASES = {'default': {}}
88 m.CACHES = {'default': {}}
89 m.SAML2IDP_CONFIG = {}
90@@ -167,15 +166,6 @@
91 self.assertEqual(DB['HOST'], expected_config['db_host'])
92 self.assertEqual(DB['PORT'], expected_config['db_port'])
93
94- if expected_config.get('oops_config', "") != "":
95- expected = {}
96- expected.update(ast.literal_eval(expected_config['oops_config']))
97- if expected_config.get('oops_password', "") != "":
98- expected['password'] = expected_config['oops_password']
99- self.assertEqual(settings.OOPSES['publishers'][0], expected)
100- else:
101- self.assertEqual(len(settings.OOPSES['publishers']), 0)
102-
103 if expected_config.get('statsd_hostport', "") != "":
104 host, port = expected_config['statsd_hostport'].split(':')
105 self.assertEqual(settings.STATSD_HOST, host)
106@@ -220,12 +210,6 @@
107 settings = self.do_render(self.context)
108 self.assert_settings(settings)
109
110- def test_oops_config(self):
111- oops = '{"a": "b"}'
112- self.context['oops_config'] = oops
113- settings = self.do_render(self.context)
114- self.assert_settings(settings, oops_config=oops)
115-
116 def test_statds_hostport(self):
117 hostport = "localhost:777"
118 self.context['statsd_hostport'] = hostport

Subscribers

People subscribed via source and target branches