Merge lp:~benji/landscape-charm/small-tweaks-for-openssl-and-makefile into lp:~landscape/landscape-charm/trunk

Proposed by Benji York
Status: Merged
Approved by: Benji York
Approved revision: 325
Merged at revision: 325
Proposed branch: lp:~benji/landscape-charm/small-tweaks-for-openssl-and-makefile
Merge into: lp:~landscape/landscape-charm/trunk
Diff against target: 64 lines (+14/-14)
2 files modified
Makefile (+7/-3)
tests/helpers.py (+7/-11)
To merge this branch: bzr merge lp:~benji/landscape-charm/small-tweaks-for-openssl-and-makefile
Reviewer Review Type Date Requested Status
🤖 Landscape Builder test results Approve
Adam Collard (community) Approve
Chris Glass (community) Approve
Review via email: mp+264277@code.launchpad.net

Commit message

- simpler invocation of openssl for grabbing server certs with a comment
  to explain what is happending
- some added nicities for the Makefile.

Description of the change

This branch makes two sets of tweaks: simpler invocation of openssl for
grabbing server certs with a comment to explain what is happending and
some added nicities for the Makefile.

To post a comment you must log in.
Revision history for this message
🤖 Landscape Builder (landscape-builder) wrote :
review: Approve (test results)
Revision history for this message
Benji York (benji) :
Revision history for this message
Chris Glass (tribaal) wrote :

Great, thanks a lot! +1

review: Approve
Revision history for this message
Adam Collard (adam-collard) :
Revision history for this message
Adam Collard (adam-collard) wrote :

Minor comment inline. +1

review: Approve
325. By Benji York

open /dev/null in update mode (plus replace beautiful single-quotes with abhorrent double-quotes)

Revision history for this message
🤖 Landscape Builder (landscape-builder) wrote :
review: Approve (test results)
Revision history for this message
Benji York (benji) wrote :

Thanks for the reviews.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Makefile'
2--- Makefile 2015-06-11 19:42:28 +0000
3+++ Makefile 2015-07-09 16:30:28 +0000
4@@ -16,7 +16,7 @@
5 exit 1;\
6 else \
7 echo "installed"; \
8- fi
9+ fi
10
11 update-charm-revision-numbers: bundles
12 @dev/update-charm-revision-numbers \
13@@ -61,7 +61,7 @@
14 flake8 lib tests
15 pyflakes3 tests dev/update-charm-revision-numbers
16 find . -name *.py -not -path "./old/*" -not -path "*/charmhelpers/*" -print0 | xargs -0 flake8
17- flake8 tests dev/update-charm-revision-numbers
18+ flake8 tests dev/update-charm-revision-numbers
19
20 clean:
21 @rm -rf bundles
22@@ -81,7 +81,11 @@
23 dev/charm_helpers_sync.py:
24 @mkdir -p dev
25 @bzr cat lp:charm-helpers/tools/charm_helpers_sync/charm_helpers_sync.py \
26- > dev/charm_helpers_sync.py
27+ > dev/charm_helpers_sync.py
28
29 sync: dev/charm_helpers_sync.py
30 $(PYTHON) dev/charm_helpers_sync.py -c charm-helpers.yaml
31+
32+build: secrets test-depends
33+
34+.DEFAULT_GOAL := build
35
36=== modified file 'tests/helpers.py'
37--- tests/helpers.py 2015-07-09 14:47:01 +0000
38+++ tests/helpers.py 2015-07-09 16:30:28 +0000
39@@ -574,18 +574,14 @@
40
41 @param endpoint: An SSL endpoint in the form <host:port>.
42 """
43- # Call openssl s_client connect to get the actual certificate served.
44- # The command line program is a bit archaic and therefore we need
45- # to do a few things like send it a user "return"), and
46- # filter some of the output (it print non-error messages on stderr).
47- process = subprocess.Popen(('echo', '-n'), stdout=subprocess.PIPE)
48- with open(os.devnull, 'w') as dev_null:
49+ # Call openssl to get the actual certificate served. The s_client command
50+ # outputs the server certificate, but expects a request body, which we
51+ # don't have, so we just pipe in /dev/null to generate an empty request.
52+ # The server is likely to generate an error response. <shrug>
53+ with open(os.devnull, "r+") as dev_null:
54 output = subprocess.check_output( # output is bytes
55- ['openssl', 's_client', '-connect', endpoint],
56- stdin=process.stdout, stderr=dev_null)
57- process.stdout.close() # Close the pipe fd
58- process.wait() # This closes the subprocess sending the return.
59-
60+ ["openssl", "s_client", "-connect", endpoint],
61+ stdin=dev_null, stderr=dev_null)
62 certificate = output.decode("utf-8")
63 start = certificate.find("-----BEGIN CERTIFICATE-----")
64 end = certificate.find("-----END CERTIFICATE-----") + len(

Subscribers

People subscribed via source and target branches