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
=== modified file 'config.yaml'
--- config.yaml 2015-05-11 11:04:54 +0000
+++ config.yaml 2015-05-22 15:45:36 +0000
@@ -76,10 +76,18 @@
76 type: string76 type: string
77 default: turnip_cgit77 default: turnip_cgit
78 description: The cgit code browser will run under this group.78 description: The cgit code browser will run under this group.
79 openid_provider_root:
80 type: string
81 default: https://testopenid.dev/
82 description: URL to the OpenID provider to authenticate against.
79 site_name:83 site_name:
80 type: string84 type: string
81 default: git.launchpad.dev85 default: git.launchpad.dev
82 description: Public host name used for clone URLs in cgit.86 description: Public host name used for clone URLs in cgit.
87 main_site_root:
88 type: string
89 default: https://launchpad.dev/
90 description: Root URL to the associated main Launchpad instance.
83 private_ssh_key:91 private_ssh_key:
84 type: string92 type: string
85 default: ''93 default: ''
@@ -88,6 +96,10 @@
88 type: string96 type: string
89 default: ''97 default: ''
90 description: Base64 encoded public host ssh key.98 description: Base64 encoded public host ssh key.
99 cgit_secret:
100 type: string
101 default: ''
102 description: Base64 encoded cgit session secret.
91 virtinfo_endpoint:103 virtinfo_endpoint:
92 type: string104 type: string
93 default: http://localhost:6543/githosting105 default: http://localhost:6543/githosting
94106
=== modified file 'hooks/actions.py'
--- hooks/actions.py 2015-05-21 14:49:16 +0000
+++ hooks/actions.py 2015-05-22 15:45:36 +0000
@@ -50,6 +50,8 @@
50PRIVATE_KEY_PATH = os.path.join(KEY_DIR, 'ssh-host-key')50PRIVATE_KEY_PATH = os.path.join(KEY_DIR, 'ssh-host-key')
51PUBLIC_KEY = config['public_ssh_key']51PUBLIC_KEY = config['public_ssh_key']
52PUBLIC_KEY_PATH = os.path.join(KEY_DIR, 'ssh-host-key.pub')52PUBLIC_KEY_PATH = os.path.join(KEY_DIR, 'ssh-host-key.pub')
53CGIT_SECRET = config['cgit_secret']
54CGIT_SECRET_PATH = os.path.join(KEY_DIR, 'cgit-secret')
5355
5456
55def get_ports():57def get_ports():
@@ -146,6 +148,17 @@
146 config.save()148 config.save()
147149
148150
151def write_cgit_secret(service_name):
152 if CGIT_SECRET:
153 hookenv.log(
154 "Writing cgit session secret from config to: {}".format(
155 CGIT_SECRET_PATH))
156 with open(CGIT_SECRET_PATH, 'wb') as f:
157 f.write(base64.b64decode(CGIT_SECRET))
158 config['cgit_secret_path'] = CGIT_SECRET_PATH
159 config.save()
160
161
149def restart_rsync(service_name):162def restart_rsync(service_name):
150 # Only makes sense with basenode.163 # Only makes sense with basenode.
151 if not config['log_hosts_allow']:164 if not config['log_hosts_allow']:
152165
=== modified file 'hooks/services.py'
--- hooks/services.py 2015-05-11 15:27:16 +0000
+++ hooks/services.py 2015-05-22 15:45:36 +0000
@@ -95,6 +95,8 @@
95 actions.write_ssh_keys,95 actions.write_ssh_keys,
96 render_env_template(config, 'PRIVATE_SSH_KEY_PATH'),96 render_env_template(config, 'PRIVATE_SSH_KEY_PATH'),
97 render_env_template(config, 'PUBLIC_SSH_KEY_PATH'),97 render_env_template(config, 'PUBLIC_SSH_KEY_PATH'),
98 actions.write_cgit_secret,
99 render_env_template(config, 'CGIT_SECRET_PATH'),
98 helpers.render_template(100 helpers.render_template(
99 source='sudoers-cgit.j2',101 source='sudoers-cgit.j2',
100 target='/etc/sudoers.d/turnip-cgit',102 target='/etc/sudoers.d/turnip-cgit',
@@ -104,7 +106,9 @@
104 target='/usr/local/bin/cgitwrap',106 target='/usr/local/bin/cgitwrap',
105 perms=0o755),107 perms=0o755),
106 render_env_template(config, 'CGIT_EXEC_PATH'),108 render_env_template(config, 'CGIT_EXEC_PATH'),
109 render_env_template(config, 'OPENID_PROVIDER_ROOT'),
107 render_env_template(config, 'SITE_NAME'),110 render_env_template(config, 'SITE_NAME'),
111 render_env_template(config, 'MAIN_SITE_ROOT'),
108 helpers.render_template(112 helpers.render_template(
109 source='turnip-logrotate.j2',113 source='turnip-logrotate.j2',
110 target='/etc/logrotate.d/turnip',114 target='/etc/logrotate.d/turnip',
111115
=== added file 'templates/envs/CGIT_SECRET_PATH.j2'
--- templates/envs/CGIT_SECRET_PATH.j2 1970-01-01 00:00:00 +0000
+++ templates/envs/CGIT_SECRET_PATH.j2 2015-05-22 15:45:36 +0000
@@ -0,0 +1,1 @@
1{{ cgit_secret_path }}
02
=== added file 'templates/envs/MAIN_SITE_ROOT.j2'
--- templates/envs/MAIN_SITE_ROOT.j2 1970-01-01 00:00:00 +0000
+++ templates/envs/MAIN_SITE_ROOT.j2 2015-05-22 15:45:36 +0000
@@ -0,0 +1,1 @@
1{{ main_site_root }}
02
=== added file 'templates/envs/OPENID_PROVIDER_ROOT.j2'
--- templates/envs/OPENID_PROVIDER_ROOT.j2 1970-01-01 00:00:00 +0000
+++ templates/envs/OPENID_PROVIDER_ROOT.j2 2015-05-22 15:45:36 +0000
@@ -0,0 +1,1 @@
1{{ openid_provider_root }}

Subscribers

People subscribed via source and target branches

to all changes: