Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
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
Paul Graydon
slapos.core
Commits
30a2de49
Commit
30a2de49
authored
Mar 21, 2012
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Raise user friendlier error when we have SSL problem
parent
ab0f08aa
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
3 deletions
+13
-3
slapos/slap/slap.py
slapos/slap/slap.py
+13
-3
No files found.
slapos/slap/slap.py
View file @
30a2de49
...
@@ -465,9 +465,13 @@ class ComputerPartition(SlapDocument):
...
@@ -465,9 +465,13 @@ class ComputerPartition(SlapDocument):
# return decorated
# return decorated
class
ConnectionHelper
:
class
ConnectionHelper
:
error_message_connect_fail
=
"Couldn't connect to the server. Please double
\
error_message_connect_fail
=
"Couldn't connect to the server. Please "
\
check given master-url argument, and make sure that IPv6 is enabled on
\
"double check given master-url argument, and make sure that IPv6 is "
\
your machine and that the server is available. The original error was:"
"enabled on your machine and that the server is available. The "
\
"original error was: "
ssl_error_message_connect_fail
=
"Couldn't authenticate computer. Please "
\
"check that certificate and key defined in slapos.cfg exist and are "
\
"valid. "
def
__init__
(
self
,
connection_wrapper
,
host
,
path
,
key_file
=
None
,
def
__init__
(
self
,
connection_wrapper
,
host
,
path
,
key_file
=
None
,
cert_file
=
None
,
master_ca_file
=
None
,
timeout
=
None
):
cert_file
=
None
,
master_ca_file
=
None
,
timeout
=
None
):
self
.
connection_wrapper
=
connection_wrapper
self
.
connection_wrapper
=
connection_wrapper
...
@@ -501,6 +505,9 @@ your machine and that the server is available. The original error was:"
...
@@ -501,6 +505,9 @@ your machine and that the server is available. The original error was:"
self
.
connect
()
self
.
connect
()
self
.
connection
.
request
(
'GET'
,
self
.
path
+
path
)
self
.
connection
.
request
(
'GET'
,
self
.
path
+
path
)
self
.
response
=
self
.
connection
.
getresponse
()
self
.
response
=
self
.
connection
.
getresponse
()
# If ssl error : must come from bad configuration
except
ssl
.
SSLError
,
e
:
raise
ssl
.
SSLError
(
self
.
ssl_error_message_connect_fail
+
str
(
e
))
except
socket
.
error
,
e
:
except
socket
.
error
,
e
:
raise
socket
.
error
(
self
.
error_message_connect_fail
+
str
(
e
))
raise
socket
.
error
(
self
.
error_message_connect_fail
+
str
(
e
))
# check self.response.status and raise exception early
# check self.response.status and raise exception early
...
@@ -528,6 +535,9 @@ your machine and that the server is available. The original error was:"
...
@@ -528,6 +535,9 @@ your machine and that the server is available. The original error was:"
header_dict
=
{
'Content-type'
:
content_type
}
header_dict
=
{
'Content-type'
:
content_type
}
self
.
connection
.
request
(
"POST"
,
self
.
path
+
path
,
self
.
connection
.
request
(
"POST"
,
self
.
path
+
path
,
urllib
.
urlencode
(
parameter_dict
),
header_dict
)
urllib
.
urlencode
(
parameter_dict
),
header_dict
)
# If ssl error : must come from bad configuration
except
ssl
.
SSLError
,
e
:
raise
ssl
.
SSLError
(
self
.
ssl_error_message_connect_fail
+
str
(
e
))
except
socket
.
error
,
e
:
except
socket
.
error
,
e
:
raise
socket
.
error
(
self
.
error_message_connect_fail
+
str
(
e
))
raise
socket
.
error
(
self
.
error_message_connect_fail
+
str
(
e
))
self
.
response
=
self
.
connection
.
getresponse
()
self
.
response
=
self
.
connection
.
getresponse
()
...
...
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