Merge lp:~cjwatson/charms/trusty/turnip/cgit-openid into lp:~canonical-launchpad-branches/charms/trusty/turnip/devel

Proposed by Colin Watson
Status: Merged
Merged at revision: 80
Proposed branch: lp:~cjwatson/charms/trusty/turnip/cgit-openid
Merge into: lp:~canonical-launchpad-branches/charms/trusty/turnip/devel
Diff against target: 105 lines (+32/-0)
6 files modified
config.yaml (+12/-0)
hooks/actions.py (+13/-0)
hooks/services.py (+4/-0)
templates/envs/CGIT_SECRET_PATH.j2 (+1/-0)
templates/envs/MAIN_SITE_ROOT.j2 (+1/-0)
templates/envs/OPENID_PROVIDER_ROOT.j2 (+1/-0)
To merge this branch: bzr merge lp:~cjwatson/charms/trusty/turnip/cgit-openid
Reviewer Review Type Date Requested Status
William Grant code Approve
Review via email: mp+259949@code.launchpad.net

Commit message

Pass through the necessary configuration options for cgit OpenID authentication support.

Description of the change

Pass through the necessary configuration options for cgit OpenID authentication support.

This goes with: https://code.launchpad.net/~cjwatson/turnip/cgit-openid/+merge/259948

To post a comment you must log in.
Revision history for this message
William Grant (wgrant) :
review: Approve (code)

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 2015-05-11 11:04:54 +0000
3+++ config.yaml 2015-05-22 15:45:36 +0000
4@@ -76,10 +76,18 @@
5 type: string
6 default: turnip_cgit
7 description: The cgit code browser will run under this group.
8+ openid_provider_root:
9+ type: string
10+ default: https://testopenid.dev/
11+ description: URL to the OpenID provider to authenticate against.
12 site_name:
13 type: string
14 default: git.launchpad.dev
15 description: Public host name used for clone URLs in cgit.
16+ main_site_root:
17+ type: string
18+ default: https://launchpad.dev/
19+ description: Root URL to the associated main Launchpad instance.
20 private_ssh_key:
21 type: string
22 default: ''
23@@ -88,6 +96,10 @@
24 type: string
25 default: ''
26 description: Base64 encoded public host ssh key.
27+ cgit_secret:
28+ type: string
29+ default: ''
30+ description: Base64 encoded cgit session secret.
31 virtinfo_endpoint:
32 type: string
33 default: http://localhost:6543/githosting
34
35=== modified file 'hooks/actions.py'
36--- hooks/actions.py 2015-05-21 14:49:16 +0000
37+++ hooks/actions.py 2015-05-22 15:45:36 +0000
38@@ -50,6 +50,8 @@
39 PRIVATE_KEY_PATH = os.path.join(KEY_DIR, 'ssh-host-key')
40 PUBLIC_KEY = config['public_ssh_key']
41 PUBLIC_KEY_PATH = os.path.join(KEY_DIR, 'ssh-host-key.pub')
42+CGIT_SECRET = config['cgit_secret']
43+CGIT_SECRET_PATH = os.path.join(KEY_DIR, 'cgit-secret')
44
45
46 def get_ports():
47@@ -146,6 +148,17 @@
48 config.save()
49
50
51+def write_cgit_secret(service_name):
52+ if CGIT_SECRET:
53+ hookenv.log(
54+ "Writing cgit session secret from config to: {}".format(
55+ CGIT_SECRET_PATH))
56+ with open(CGIT_SECRET_PATH, 'wb') as f:
57+ f.write(base64.b64decode(CGIT_SECRET))
58+ config['cgit_secret_path'] = CGIT_SECRET_PATH
59+ config.save()
60+
61+
62 def restart_rsync(service_name):
63 # Only makes sense with basenode.
64 if not config['log_hosts_allow']:
65
66=== modified file 'hooks/services.py'
67--- hooks/services.py 2015-05-11 15:27:16 +0000
68+++ hooks/services.py 2015-05-22 15:45:36 +0000
69@@ -95,6 +95,8 @@
70 actions.write_ssh_keys,
71 render_env_template(config, 'PRIVATE_SSH_KEY_PATH'),
72 render_env_template(config, 'PUBLIC_SSH_KEY_PATH'),
73+ actions.write_cgit_secret,
74+ render_env_template(config, 'CGIT_SECRET_PATH'),
75 helpers.render_template(
76 source='sudoers-cgit.j2',
77 target='/etc/sudoers.d/turnip-cgit',
78@@ -104,7 +106,9 @@
79 target='/usr/local/bin/cgitwrap',
80 perms=0o755),
81 render_env_template(config, 'CGIT_EXEC_PATH'),
82+ render_env_template(config, 'OPENID_PROVIDER_ROOT'),
83 render_env_template(config, 'SITE_NAME'),
84+ render_env_template(config, 'MAIN_SITE_ROOT'),
85 helpers.render_template(
86 source='turnip-logrotate.j2',
87 target='/etc/logrotate.d/turnip',
88
89=== added file 'templates/envs/CGIT_SECRET_PATH.j2'
90--- templates/envs/CGIT_SECRET_PATH.j2 1970-01-01 00:00:00 +0000
91+++ templates/envs/CGIT_SECRET_PATH.j2 2015-05-22 15:45:36 +0000
92@@ -0,0 +1,1 @@
93+{{ cgit_secret_path }}
94
95=== added file 'templates/envs/MAIN_SITE_ROOT.j2'
96--- templates/envs/MAIN_SITE_ROOT.j2 1970-01-01 00:00:00 +0000
97+++ templates/envs/MAIN_SITE_ROOT.j2 2015-05-22 15:45:36 +0000
98@@ -0,0 +1,1 @@
99+{{ main_site_root }}
100
101=== added file 'templates/envs/OPENID_PROVIDER_ROOT.j2'
102--- templates/envs/OPENID_PROVIDER_ROOT.j2 1970-01-01 00:00:00 +0000
103+++ templates/envs/OPENID_PROVIDER_ROOT.j2 2015-05-22 15:45:36 +0000
104@@ -0,0 +1,1 @@
105+{{ openid_provider_root }}

Subscribers

People subscribed via source and target branches

to all changes: