Fix usage of rescue system

This commit is contained in:
Lukas Kämmerling 2019-03-07 07:24:22 +01:00
parent b6ee0ea736
commit cc2267fd2a
No known key found for this signature in database
GPG Key ID: AA5C71B0F2BF3DB2
1 changed files with 15 additions and 0 deletions

View File

@ -87,6 +87,7 @@ func (s *stepCreateServer) Run(ctx context.Context, state multistep.StateBag) mu
}
if c.RescueMode != "" {
ui.Say("Enabling Rescue Mode...")
rootPassword, err := setRescue(context.TODO(), client, serverCreateResult.Server, c.RescueMode, sshKeys)
if err != nil {
err := fmt.Errorf("Error enabling rescue mode: %s", err)
@ -94,6 +95,20 @@ func (s *stepCreateServer) Run(ctx context.Context, state multistep.StateBag) mu
ui.Error(err.Error())
return multistep.ActionHalt
}
ui.Say("Reboot server...")
action, _, err := client.Server.Reset(context.TODO(), serverCreateResult.Server)
if err != nil {
err := fmt.Errorf("Error rebooting server: %s", err)
state.Put("error", err)
ui.Error(err.Error())
return multistep.ActionHalt
}
if err := waitForAction(context.TODO(), client, action); err != nil {
err := fmt.Errorf("Error rebooting server: %s", err)
state.Put("error", err)
ui.Error(err.Error())
return multistep.ActionHalt
}
if c.RescueMode == "freebsd64" {
// We will set this only on freebsd
ui.Say("Using Root Password instead of SSH Keys...")