Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reset method "soft" does not work on AX servers #61

Open
halmartin opened this issue May 8, 2023 · 3 comments
Open

Reset method "soft" does not work on AX servers #61

halmartin opened this issue May 8, 2023 · 3 comments

Comments

@halmartin
Copy link

Hello,

Attempting to reset an AX root server does not work:

$ hetznerctl rescue -a $SSH_FINGERPRINT $IP
Server #1234567: Trying to reboot using the 'soft' method.
hetzner.RobotError: 400 - invalid input, fields: type (400)

According to the Robot documentation, the sw reboot method (used by soft) is no longer available:

"type":[
  "power",
  "power_long",
  "hw",
  "man"
]

Attempts to call the reset API with the sw reset method (used by soft which is the default) fail with the above 400 error. Changing the default reset method to hw (hard) resolves the issue:

diff --git a/hetzner/reset.py b/hetzner/reset.py
index 4afc310..873ad9f 100644
--- a/hetzner/reset.py
+++ b/hetzner/reset.py
@@ -77,7 +77,7 @@ class Reset(object):
         is_down = False
 
         if tries is None:
-            tries = ['soft', 'hard']
+            tries = ['hard']
 
         for mode in tries:
             self.server.logger.info("Trying to reboot using the %r method.",
@@ -110,7 +110,7 @@ class Reset(object):
         else:
             raise ConnectError("Server keeps playing dead after reboot :-(")
 
-    def reboot(self, mode='soft'):
+    def reboot(self, mode='hard'):
         """
         Reboot the server, modes are "soft" for reboot by triggering Ctrl-Alt-
         Del, "hard" for triggering a hardware reset and "manual" for requesting
@@ -124,6 +124,6 @@ class Reset(object):
             'power': 'power',
         }
 
-        modekey = modes.get(mode, modes['soft'])
+        modekey = modes.get(mode, modes['hard'])
         return self.conn.post('/reset/{0}'.format(self.server.number),
                               {'type': modekey})
@aszlig
Copy link
Owner

aszlig commented May 8, 2023

Maybe power is a better substitute for that, since it's more related to the old sw method.

edit: actually, not really, the power and power_long methods are available only for AX servers it seems, but older machines still have sw.

@aszlig
Copy link
Owner

aszlig commented May 8, 2023

I think the proper fix for this would be to use sw and fall back to power if sw is not available when using soft. Since we already query the available reset types from the robot, we already should have that information prior to sending the actual reset request.

@halmartin halmartin changed the title Reset method "soft" is deprecated and does not work Reset method "soft" is deprecated and does not work on AX servers May 8, 2023
@halmartin halmartin changed the title Reset method "soft" is deprecated and does not work on AX servers Reset method "soft" does not work on AX servers May 8, 2023
@shlevy
Copy link

shlevy commented Mar 29, 2024

@aszlig Can we get a patch for this? As far as I can tell hetznerctl rescue is unusable for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants