Merge lp:~brian.curtin/ubuntuone-storage-protocol/get_cert_location-removal into lp:ubuntuone-storage-protocol
- get_cert_location-removal
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Brian Curtin |
Approved revision: | 169 |
Merged at revision: | 160 |
Proposed branch: | lp:~brian.curtin/ubuntuone-storage-protocol/get_cert_location-removal |
Merge into: | lp:ubuntuone-storage-protocol |
Diff against target: |
265 lines (+6/-153) 8 files modified
MANIFEST.in (+0/-1) data/UbuntuOne-Go_Daddy_CA.pem (+0/-29) data/UbuntuOne-Go_Daddy_Class_2_CA.pem (+0/-25) data/UbuntuOne-ValiCert_Class_2_VA.pem (+0/-18) run-tests.bat (+1/-1) setup.py (+0/-6) tests/test_context.py (+3/-45) ubuntuone/storageprotocol/context.py (+2/-28) |
To merge this branch: | bzr merge lp:~brian.curtin/ubuntuone-storage-protocol/get_cert_location-removal |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
dobey (community) | Approve | ||
Mike McCracken (community) | Approve | ||
Review via email: mp+165232@code.launchpad.net |
Commit message
- Remove get_cert_location because it is now implemented as get_cert_dir in ubuntu-sso-client
Description of the change
Now that get_cert_dir is implemented in ubuntu-sso-client, remove its implementation and tests from storageprotocol.
Mike McCracken (mikemc) : | # |
dobey (dobey) wrote : | # |
14 === modified file 'setup.py'
15 --- setup.py 2012-12-03 19:45:43 +0000
16 +++ setup.py 2013-05-22 21:39:27 +0000
17 @@ -26,7 +26,7 @@
18 from distutils.core import setup
19 from distutils.spawn import find_executable
20 from distutils.command import clean, build
21 -from ubuntuone.
22 +from ubuntu_sso.utils import get_cert_dir
23
24
25 class StorageProtocol
26 @@ -74,7 +74,7 @@
27 packages=
28 'ubuntuone.
29 extra_path=
30 - data_files=
31 + data_files=
32 ['data/
33 'data/UbuntuOne
34 'data/UbuntuOne
35
sso-client and storage-protocol can't both be installing the same files to the same place. These files will need to be removed from this tree, and not installed at all.
dobey (dobey) : | # |
dobey (dobey) : | # |
Ubuntu One Auto Pilot (otto-pilot) wrote : | # |
The attempt to merge lp:~brian.curtin/ubuntuone-storage-protocol/get_cert_location-removal into lp:ubuntuone-storage-protocol failed. Below is the output from the failed tests.
running build
running build_py
creating build
creating build/lib.
creating build/lib.
copying ubuntuone/
creating build/lib.
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
Traceback (most recent call last):
File "/usr/bin/u1trial", line 40, in <module>
main()
File "/usr/lib/
suite = test_runner.
File "/usr/lib/
config[
File "/usr/lib/
module_suite = self._load_
File "/usr/lib/
module = __import__(modpath, None, None, [""])
File "/mnt/tarmac/
from ubuntuone.
File "/mnt/tarmac/
from ubuntu_sso.utils import get_cert_dir
ImportError: cannot import name get_cert_dir
Ubuntu One Auto Pilot (otto-pilot) wrote : | # |
The attempt to merge lp:~brian.curtin/ubuntuone-storage-protocol/get_cert_location-removal into lp:ubuntuone-storage-protocol failed. Below is the output from the failed tests.
running build
running build_py
creating build
creating build/lib.
creating build/lib.
copying ubuntuone/
creating build/lib.
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
tests.test_hashes
ContentHashin
test_
test_
test_
test_
FactoriesTest
test_
test_
test_
test_
test_
test_
MagicHashingTests
test_
test_
test_
test_
test_
Ubuntu One Auto Pilot (otto-pilot) wrote : | # |
The attempt to merge lp:~brian.curtin/ubuntuone-storage-protocol/get_cert_location-removal into lp:ubuntuone-storage-protocol failed. Below is the output from the failed tests.
running build
running build_py
creating build
creating build/lib.
creating build/lib.
copying ubuntuone/
creating build/lib.
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
tests.test_hashes
ContentHashin
test_
test_
test_
test_
FactoriesTest
test_
test_
test_
test_
test_
test_
MagicHashingTests
test_
test_
test_
test_
test_
Ubuntu One Auto Pilot (otto-pilot) wrote : | # |
The attempt to merge lp:~brian.curtin/ubuntuone-storage-protocol/get_cert_location-removal into lp:ubuntuone-storage-protocol failed. Below is the output from the failed tests.
running build
running build_py
creating build
creating build/lib.
creating build/lib.
copying ubuntuone/
creating build/lib.
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
copying ubuntuone/
tests.test_hashes
ContentHashin
test_
test_
test_
test_
FactoriesTest
test_
test_
test_
test_
test_
test_
MagicHashingTests
test_
test_
test_
test_
test_
- 169. By Brian Curtin
-
lint...
Preview Diff
1 | === modified file 'MANIFEST.in' |
2 | --- MANIFEST.in 2012-03-29 20:28:09 +0000 |
3 | +++ MANIFEST.in 2013-05-28 14:43:22 +0000 |
4 | @@ -4,6 +4,5 @@ |
5 | include run-tests |
6 | include *.pth |
7 | recursive-include ubuntuone *.proto |
8 | -recursive-include data *.pem |
9 | recursive-include samples *.py |
10 | recursive-include tests *.py |
11 | |
12 | === removed directory 'data' |
13 | === removed file 'data/UbuntuOne-Go_Daddy_CA.pem' |
14 | --- data/UbuntuOne-Go_Daddy_CA.pem 2011-09-21 12:53:10 +0000 |
15 | +++ data/UbuntuOne-Go_Daddy_CA.pem 1970-01-01 00:00:00 +0000 |
16 | @@ -1,29 +0,0 @@ |
17 | ------BEGIN CERTIFICATE----- |
18 | -MIIE3jCCA8agAwIBA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HRMBAf8ECDAGAQH/AgEAMDMGCCsGAQUFBwEB |
34 | -BCcwJTAjBggrBgEFBQcwAYYXaHR0cDovL29jc3AuZ29kYWRkeS5jb20wRgYDVR0f |
35 | -BD8wPTA7oDmgN4Y1aHR0cDovL2NlcnRpZmljYXRlcy5nb2RhZGR5LmNvbS9yZXBv |
36 | -c2l0b3J5L2dkcm9vdC5jcmwwSwYDVR0gBEQwQjBABgRVHSAAMDgwNgYIKwYBBQUH |
37 | -AgEWKmh0dHA6Ly9jZXJ0aWZpY2F0ZXMuZ29kYWRkeS5jb20vcmVwb3NpdG9yeTAO |
38 | -BgNVHQ8BAf8EBAMCAQYwDQYJKoZIhvcNAQEFBQADggEBANKGwOy9+aG2Z+5mC6IG |
39 | -OgRQjhVyrEp0lVPLN8tESe8HkGsz2ZbwlFalEzAFPIUyIXvJxwqoJKSQ3kbTJSMU |
40 | -A2fCENZvD117esyfxVgqwcSeIaha86ykRvOe5GPLL5CkKSkB2XIsKd83ASe8T+5o |
41 | -0yGPwLPk9Qnt0hCqU7S+8MxZC9Y7lhyVJEnfzuz9p0iRFEUOOjZv2kWzRaJBydTX |
42 | -RE4+uXR21aITVSzGh6O1mawGhId/dQb8vxRMDsxuxN89txJx9OjxUUAiKEngHUuH |
43 | -qDTMBqLdElrRhjZkAzVvb3du6/KFUJheqwNTrZEjYx8WnM25sgVjOuH0aBsXBTWV |
44 | -U+4= |
45 | ------END CERTIFICATE----- |
46 | |
47 | === removed file 'data/UbuntuOne-Go_Daddy_Class_2_CA.pem' |
48 | --- data/UbuntuOne-Go_Daddy_Class_2_CA.pem 2009-06-23 19:38:42 +0000 |
49 | +++ data/UbuntuOne-Go_Daddy_Class_2_CA.pem 1970-01-01 00:00:00 +0000 |
50 | @@ -1,25 +0,0 @@ |
51 | ------BEGIN CERTIFICATE----- |
52 | -MIIEADCCAuigAwIBAgIBADANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJV |
53 | -UzEhMB8GA1UEChMYVGhlIE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6AzBhRckB4Y9wimPQoZ+YeAEW5p5JYX |
70 | -MP80kWNyOO7MHAGjHZQopDH2esRU1/blMVgDoszOYtuURXO1v0XJJLXVggKt |
71 | -I3lpjbi2Tc7PTMozI+gciKqdi0FuFskg5YmezTvacPd+mSYgFFQlq25zheab |
72 | -IZ0KbIIOqPjCDPoQHmyW74cNxA9hi63ugyuV+I6ShHI56yDqg+2DzZduCLzr |
73 | -Tia2cyvk0/ZM/iZx4mERdEr/VxqHD3VILs9RaRegAhJhldXRQLIQTO7ErBBD |
74 | -pqWeCtWVYpoNz4iCxTIM5CufReYNnyicsbkqWletNw+vHX/bvZ8= |
75 | ------END CERTIFICATE----- |
76 | |
77 | === removed file 'data/UbuntuOne-ValiCert_Class_2_VA.pem' |
78 | --- data/UbuntuOne-ValiCert_Class_2_VA.pem 2012-08-15 21:53:43 +0000 |
79 | +++ data/UbuntuOne-ValiCert_Class_2_VA.pem 1970-01-01 00:00:00 +0000 |
80 | @@ -1,18 +0,0 @@ |
81 | ------BEGIN CERTIFICATE----- |
82 | -MIIC5zCCAlACAQEwDQYJKoZIhvcNAQEFBQAwgbsxJDAiBgNVBAcTG1ZhbGlDZXJ0 |
83 | -IFZhbGlkYXRpb24gTmV0d29yazEXMBUGA1UEChMOVmFsaUNlcnQsIEluYy4xNTAz |
84 | -BgNVBAsTLFZhbGlDZXJ0IENsYXNzIDIgUG9saWN5IFZhbGlkYXRpb24gQXV0aG9y |
85 | -aXR5MSEwHwYDVQQDExhodHRwOi8vd3d3LnZhbGljZXJ0LmNvbS8xIDAeBgkqhkiG |
86 | -9w0BCQEWEWluZm9AdmFsaWNlcnQuY29tMB4XDTk5MDYyNjAwMTk1NFoXDTE5MDYy |
87 | -NjAwMTk1NFowgbsxJDAiBgNVBAcTG1ZhbGlDZXJ0IFZhbGlkYXRpb24gTmV0d29y |
88 | -azEXMBUGA1UEChMOVmFsaUNlcnQsIEluYy4xNTAzBgNVBAsTLFZhbGlDZXJ0IENs |
89 | -YXNzIDIgUG9saWN5IFZhbGlkYXRpb24gQXV0aG9yaXR5MSEwHwYDVQQDExhodHRw |
90 | -Oi8vd3d3LnZhbGljZXJ0LmNvbS8xIDAeBgkqhkiG9w0BCQEWEWluZm9AdmFsaWNl |
91 | -cnQuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDOOnHK5avIWZJV16vY |
92 | -dA757tn2VUdZZUcOBVXc65g2PFxTXdMwzzjsvUGJ7SVCCSRrCl6zfN1SLUzm1NZ9 |
93 | -WlmpZdRJEy0kTRxQb7XBhVQ7/nHk01xC+YDgkRoKWzk2Z/M/VXwbP7RfZHM047QS |
94 | -v4dk+NoS/zcnwbNDu+97bi5p9wIDAQABMA0GCSqGSIb3DQEBBQUAA4GBADt/UG9v |
95 | -UJSZSWI4OB9L+KXIPqeCgfYrx+jFzug6EILLGACOTb2oWH+heQC1u+mNr0HZDzTu |
96 | -IYEZoDJJKPTEjlbVUjP9UNV+mWwD5MlM/Mtsq2azSiGM5bUMMj4QssxsodyamEwC |
97 | -W/POuZ6lcg5Ktz885hZo+L7tdEy8W9ViH0Pd |
98 | ------END CERTIFICATE----- |
99 | |
100 | === modified file 'run-tests.bat' |
101 | --- run-tests.bat 2012-08-15 18:08:39 +0000 |
102 | +++ run-tests.bat 2013-05-28 14:43:22 +0000 |
103 | @@ -18,7 +18,7 @@ |
104 | SET PYTHONEXEPATH="" |
105 | SET IGNORE_PATHS="ubuntuone\controlpanel\dbustests" |
106 | SET IGNORE_MODULES="test_linux.py, test_darwin.py" |
107 | -SET PYTHONPATH=%PYTHONPATH%;..\ubuntuone-dev-tools\;..\dirspec;. |
108 | +SET PYTHONPATH=%PYTHONPATH%;..\ubuntu-sso-client;..\ubuntuone-dev-tools\;..\dirspec;. |
109 | |
110 | ECHO Checking for Python on the path |
111 | :: Look for Python from buildout |
112 | |
113 | === modified file 'setup.py' |
114 | --- setup.py 2012-12-03 19:45:43 +0000 |
115 | +++ setup.py 2013-05-28 14:43:22 +0000 |
116 | @@ -26,7 +26,6 @@ |
117 | from distutils.core import setup |
118 | from distutils.spawn import find_executable |
119 | from distutils.command import clean, build |
120 | -from ubuntuone.storageprotocol.context import get_cert_location |
121 | |
122 | |
123 | class StorageProtocolBuild(build.build): |
124 | @@ -74,11 +73,6 @@ |
125 | packages=['ubuntuone', |
126 | 'ubuntuone.storageprotocol'], |
127 | extra_path='ubuntuone-storage-protocol', |
128 | - data_files=[(get_cert_location(), |
129 | - ['data/UbuntuOne-Go_Daddy_CA.pem', |
130 | - 'data/UbuntuOne-ValiCert_Class_2_VA.pem', |
131 | - 'data/UbuntuOne-Go_Daddy_Class_2_CA.pem'])], |
132 | - |
133 | cmdclass={'build': StorageProtocolBuild, |
134 | 'clean': StorageProtocolClean}, |
135 | ) |
136 | |
137 | === modified file 'tests/test_context.py' |
138 | --- tests/test_context.py 2012-12-03 19:45:43 +0000 |
139 | +++ tests/test_context.py 2013-05-28 14:43:22 +0000 |
140 | @@ -28,7 +28,6 @@ |
141 | # files in the program, then also delete it here. |
142 | |
143 | import os |
144 | -import sys |
145 | |
146 | from OpenSSL import crypto, SSL |
147 | from twisted.internet import defer, error, reactor, ssl |
148 | @@ -36,6 +35,7 @@ |
149 | from twisted.web import client, resource, server |
150 | |
151 | from ubuntuone.storageprotocol import context |
152 | +from ubuntu_sso.utils import get_cert_dir |
153 | |
154 | |
155 | class FakeCerts(object): |
156 | @@ -125,7 +125,8 @@ |
157 | def get_certificates(self): |
158 | """Get the uninstalled certificates, for testing.""" |
159 | certs = [] |
160 | - data_dir = os.path.join(os.path.dirname(__file__), os.pardir, 'data') |
161 | + data_dir = get_cert_dir() |
162 | + |
163 | for certname in ['UbuntuOne-Go_Daddy_Class_2_CA.pem', |
164 | 'UbuntuOne-Go_Daddy_CA.pem']: |
165 | cert_path = os.path.abspath(os.path.join(data_dir, certname)) |
166 | @@ -198,46 +199,3 @@ |
167 | hostname="localhost") |
168 | |
169 | yield self.verify_context(server_context, client_context) |
170 | - |
171 | - |
172 | -class SSLCertLocationTestCase(unittest.TestCase): |
173 | - """Test determining the cert location.""" |
174 | - |
175 | - @defer.inlineCallbacks |
176 | - def setUp(self): |
177 | - yield super(SSLCertLocationTestCase, self).setUp() |
178 | - |
179 | - def test_win(self): |
180 | - """Test geting a path when Common AppData is defined.""" |
181 | - self.patch(context, "load_config_paths", |
182 | - lambda x: [os.path.join("returned-value", x)]) |
183 | - self.patch(sys, "platform", "win32") |
184 | - path = context.get_cert_location() |
185 | - self.assertEqual(path, os.path.join("returned-value", |
186 | - "ubuntuone-storageprotocol")) |
187 | - |
188 | - def test_darwin_frozen(self): |
189 | - """Test that we get a path with .app in it on frozen darwin.""" |
190 | - self.patch(sys, "platform", "darwin") |
191 | - sys.frozen = "macosx-app" |
192 | - self.addCleanup(delattr, sys, "frozen") |
193 | - self.patch(context, "__file__", |
194 | - os.path.join("path", "to", "Main.app", "ignore")) |
195 | - path = context.get_cert_location() |
196 | - self.assertEqual(path, os.path.join("path", "to", "Main.app", |
197 | - "Contents", "Resources")) |
198 | - |
199 | - def test_darwin_unfrozen(self): |
200 | - """Test that we get a source-relative path on unfrozen darwin.""" |
201 | - self.patch(sys, "platform", "darwin") |
202 | - self.patch(context, "__file__", |
203 | - os.path.join("path", "to", "ubuntuone", |
204 | - "storageprotocol", "context.py")) |
205 | - path = context.get_cert_location() |
206 | - self.assertEqual(path, os.path.join("path", "to", "data")) |
207 | - |
208 | - def test_linux(self): |
209 | - """Test that linux gets the right path.""" |
210 | - self.patch(sys, "platform", "linux2") |
211 | - path = context.get_cert_location() |
212 | - self.assertEqual(path, "/etc/ssl/certs") |
213 | |
214 | === modified file 'ubuntuone/storageprotocol/context.py' |
215 | --- ubuntuone/storageprotocol/context.py 2012-08-16 19:21:06 +0000 |
216 | +++ ubuntuone/storageprotocol/context.py 2013-05-28 14:43:22 +0000 |
217 | @@ -30,38 +30,12 @@ |
218 | Standard Routines for working with ssl context creation |
219 | """ |
220 | import os |
221 | -import sys |
222 | |
223 | from OpenSSL import SSL |
224 | from twisted.internet import error, ssl |
225 | from twisted.python import log |
226 | |
227 | -from dirspec.basedir import load_config_paths |
228 | - |
229 | - |
230 | -def get_cert_location(): |
231 | - """Return path to certificate files.""" |
232 | - |
233 | - if sys.platform == "win32": |
234 | - ssl_cert_location = list(load_config_paths( |
235 | - "ubuntuone-storageprotocol"))[0] |
236 | - |
237 | - elif sys.platform == "darwin": |
238 | - if getattr(sys, "frozen", None) is not None: |
239 | - main_app_dir = "".join(__file__.partition(".app")[:-1]) |
240 | - main_app_resources_dir = os.path.join(main_app_dir, |
241 | - "Contents", |
242 | - "Resources") |
243 | - ssl_cert_location = main_app_resources_dir |
244 | - else: |
245 | - pkg_dir = os.path.dirname(__file__) |
246 | - src_tree_path = os.path.dirname(os.path.dirname(pkg_dir)) |
247 | - ssl_cert_location = os.path.join(src_tree_path, |
248 | - "data") |
249 | - else: |
250 | - ssl_cert_location = '/etc/ssl/certs' |
251 | - |
252 | - return ssl_cert_location |
253 | +from ubuntu_sso.utils import get_cert_dir |
254 | |
255 | |
256 | class HostnameVerifyContextFactory(ssl.CertificateOptions): |
257 | @@ -93,7 +67,7 @@ |
258 | |
259 | def get_certificates(): |
260 | """Get a list of certificate paths.""" |
261 | - ssl_cert_location = get_cert_location() |
262 | + ssl_cert_location = get_cert_dir() |
263 | ca_file = ssl.Certificate.loadPEM(file(os.path.join(ssl_cert_location, |
264 | 'UbuntuOne-Go_Daddy_Class_2_CA.pem'), 'r').read()) |
265 | ca_file_2 = ssl.Certificate.loadPEM(file(os.path.join(ssl_cert_location, |
minor lint stuff:
== Python Lint Notices ==
/Users/ mmccrack/ Documents/ Canonical/ Source/ test-improve- buildout/ scripts/ devsetup/ parts/ubuntuone -storage- protocol/ tests/test_ context. py:
31: 'sys' imported but unused
/Users/ mmccrack/ Documents/ Canonical/ Source/ test-improve- buildout/ scripts/ devsetup/ parts/ubuntuone -storage- protocol/ ubuntuone/ storageprotocol /context. py:
33: 'sys' imported but unused
39: 'load_config_paths' imported but unused