Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
caucase
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vincent Pelletier
caucase
Commits
7f9e56cf
Commit
7f9e56cf
authored
Jul 21, 2018
by
Vincent Pelletier
Committed by
Vincent Pelletier
Sep 26, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
all: Reduce differences with python3.
Using only 2to3 conversions which are python2-compatible.
parent
719959e0
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
73 additions
and
58 deletions
+73
-58
caucase/ca.py
caucase/ca.py
+1
-1
caucase/cli.py
caucase/cli.py
+66
-51
caucase/test.py
caucase/test.py
+3
-3
caucase/utils.py
caucase/utils.py
+1
-1
caucase/wsgi.py
caucase/wsgi.py
+2
-2
No files found.
caucase/ca.py
View file @
7f9e56cf
...
@@ -625,7 +625,7 @@ class CertificateAuthority(object):
...
@@ -625,7 +625,7 @@ class CertificateAuthority(object):
self
.
_renewCAIfNeeded
()
self
.
_renewCAIfNeeded
()
result
=
[]
result
=
[]
iter_key_pair
=
iter
(
self
.
_ca_key_pairs_list
)
iter_key_pair
=
iter
(
self
.
_ca_key_pairs_list
)
first_key_pair
=
iter_key_pair
.
next
(
)
first_key_pair
=
next
(
iter_key_pair
)
previous_crt_pem
=
utils
.
dump_certificate
(
first_key_pair
[
'crt'
])
previous_crt_pem
=
utils
.
dump_certificate
(
first_key_pair
[
'crt'
])
previous_key
=
first_key_pair
[
'key'
]
previous_key
=
first_key_pair
[
'key'
]
for
key_pair
in
iter_key_pair
:
for
key_pair
in
iter_key_pair
:
...
...
caucase/cli.py
View file @
7f9e56cf
This diff is collapsed.
Click to expand it.
caucase/test.py
View file @
7f9e56cf
...
@@ -107,7 +107,7 @@ def canConnect(address): # pragma: no cover
...
@@ -107,7 +107,7 @@ def canConnect(address): # pragma: no cover
"""
"""
try
:
try
:
socket
.
create_connection
(
address
)
socket
.
create_connection
(
address
)
except
socket
.
error
,
e
:
except
socket
.
error
as
e
:
if
e
.
errno
==
errno
.
ECONNREFUSED
:
if
e
.
errno
==
errno
.
ECONNREFUSED
:
return
False
return
False
raise
raise
...
@@ -334,7 +334,7 @@ class CaucaseTest(unittest.TestCase):
...
@@ -334,7 +334,7 @@ class CaucaseTest(unittest.TestCase):
new_key_path
,
new_key_path
,
),
),
)
)
except
SystemExit
,
e
:
except
SystemExit
as
e
:
return
e
.
code
# pragma: no cover
return
e
.
code
# pragma: no cover
except
:
# pylint: disable=bare-except
except
:
# pylint: disable=bare-except
return
1
return
1
...
@@ -896,7 +896,7 @@ class CaucaseTest(unittest.TestCase):
...
@@ -896,7 +896,7 @@ class CaucaseTest(unittest.TestCase):
client
=
CaucaseClient
(
self
.
_caucase_url
+
'/cas'
)
client
=
CaucaseClient
(
self
.
_caucase_url
+
'/cas'
)
try
:
try
:
client
.
createCertificateSigningRequest
(
'Not actually a CSR'
)
client
.
createCertificateSigningRequest
(
'Not actually a CSR'
)
except
CaucaseError
,
e
:
except
CaucaseError
as
e
:
self
.
assertEqual
(
e
.
args
[
0
],
400
,
e
)
self
.
assertEqual
(
e
.
args
[
0
],
400
,
e
)
else
:
# pragma: no cover
else
:
# pragma: no cover
raise
AssertionError
(
'Did not raise CaucaseError(400, ...)'
)
raise
AssertionError
(
'Did not raise CaucaseError(400, ...)'
)
...
...
caucase/utils.py
View file @
7f9e56cf
...
@@ -264,7 +264,7 @@ def _verifyCertificateChain(cert, trusted_cert_list, crl):
...
@@ -264,7 +264,7 @@ def _verifyCertificateChain(cert, trusted_cert_list, crl):
except
(
except
(
crypto
.
X509StoreContextError
,
crypto
.
X509StoreContextError
,
crypto
.
Error
,
crypto
.
Error
,
)
,
e
:
)
as
e
:
raise
CertificateVerificationError
(
raise
CertificateVerificationError
(
'Certificate verification error: %s'
%
str
(
e
),
'Certificate verification error: %s'
%
str
(
e
),
)
)
...
...
caucase/wsgi.py
View file @
7f9e56cf
...
@@ -572,13 +572,13 @@ class Application(object):
...
@@ -572,13 +572,13 @@ class Application(object):
raise
InsufficientStorage
raise
InsufficientStorage
except
exceptions
.
NotJSON
:
except
exceptions
.
NotJSON
:
raise
BadRequest
(
'Invalid json payload'
)
raise
BadRequest
(
'Invalid json payload'
)
except
exceptions
.
CertificateAuthorityException
,
e
:
except
exceptions
.
CertificateAuthorityException
as
e
:
raise
BadRequest
(
str
(
e
))
raise
BadRequest
(
str
(
e
))
except
Exception
:
except
Exception
:
environ
[
'wsgi.errors'
].
write
(
'Unhandled exception
\
n
'
)
environ
[
'wsgi.errors'
].
write
(
'Unhandled exception
\
n
'
)
traceback
.
print_exc
(
file
=
environ
[
'wsgi.errors'
])
traceback
.
print_exc
(
file
=
environ
[
'wsgi.errors'
])
raise
ApplicationError
raise
ApplicationError
except
ApplicationError
,
e
:
except
ApplicationError
as
e
:
status
=
e
.
status
status
=
e
.
status
header_list
=
e
.
response_headers
header_list
=
e
.
response_headers
result
=
[
str
(
x
)
for
x
in
e
.
args
]
result
=
[
str
(
x
)
for
x
in
e
.
args
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment