Merge lp:~dpb/charms/precise/apache2/1335473-pyasn1-libs into lp:charms/apache2

Proposed by David Britton
Status: Merged
Merged at revision: 58
Proposed branch: lp:~dpb/charms/precise/apache2/1335473-pyasn1-libs
Merge into: lp:charms/apache2
Diff against target: 20 lines (+7/-3)
1 file modified
hooks/hooks.py (+7/-3)
To merge this branch: bzr merge lp:~dpb/charms/precise/apache2/1335473-pyasn1-libs
Reviewer Review Type Date Requested Status
Marco Ceppi (community) Approve
Review via email: mp+224913@code.launchpad.net

Commit message

Don't fail self-signed cert generation if we can't install/import python-pyasn1-modules

Description of the change

Don't fail self-signed cert generation if we can't install/import python-pyasn1-modules (to read the SubjAltName field in the cert). Instead just don't check that part of the cert.

To post a comment you must log in.
Revision history for this message
Marco Ceppi (marcoceppi) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hooks/hooks.py'
2--- hooks/hooks.py 2014-06-27 11:46:03 +0000
3+++ hooks/hooks.py 2014-06-28 19:31:20 +0000
4@@ -218,9 +218,13 @@
5 if config['servername'] != cn:
6 return True
7
8- # Subject Alternate Name
9- from pyasn1.codec.der import decoder
10- from pyasn1_modules import rfc2459
11+ # Subject Alternate Name -- only trusty+ support this
12+ try:
13+ from pyasn1.codec.der import decoder
14+ from pyasn1_modules import rfc2459
15+ except ImportError:
16+ log("Cannot check subjAltName on <= 12.04, skipping.")
17+ return False
18 cert_addresses = set()
19 unit_addresses = set(
20 [unit_get("public-address"), unit_get("private-address")])

Subscribers

People subscribed via source and target branches

to all changes: