Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion hetzner/reset.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,10 @@ def observed_reboot(self, patience=300, tries=None, manual=False):
is_down = False

if tries is None:
tries = ['soft', 'hard']
if 'sw' not in self.reset_types:
tries = ['hard']
else:
tries = ['soft', 'hard']

for mode in tries:
self.server.logger.info("Trying to reboot using the %r method.",
Expand Down
19 changes: 16 additions & 3 deletions hetzner/util/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,21 @@ def connect(self):
).encode('ascii'))
ca_certs.flush()
cafile = ca_certs.name
self.sock = ssl.wrap_socket(sock, self.key_file, self.cert_file,
cert_reqs=ssl.CERT_REQUIRED,
ca_certs=cafile)
#self.sock = ssl.wrap_socket(sock, self.key_file, self.cert_file,
# cert_reqs=ssl.CERT_REQUIRED,
# ca_certs=cafile)
context = ssl.create_default_context(cafile=cafile)
context.check_hostname = True
context.verify_mode = ssl.CERT_REQUIRED

key_file = getattr(self, 'key_file', None)
cert_file = getattr(self, 'cert_file', None)

if key_file and cert_file:
context.load_cert_chain(cert_file, key_file)

hostname = self.host
self.sock = context.wrap_socket(sock, server_hostname=hostname)

if bundle is None:
ca_certs.close()