forked from mendersoftware/mender
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request mendersoftware#914 from kacf/MEN-5340
MEN-5340: Fix incorrect logic if `reboot` is killed before the client.
- Loading branch information
Showing
2 changed files
with
27 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
From 10eeda6a93a13b3a96c7fc2a6e4f6b4eb4690458 Mon Sep 17 00:00:00 2001 | ||
From 4b5cf8ce62086b028811617080af6689507b0334 Mon Sep 17 00:00:00 2001 | ||
From: Lluis Campos <[email protected]> | ||
Date: Tue, 30 Nov 2021 19:40:35 +0100 | ||
Subject: [PATCH] Instrument mender binary | ||
Subject: [PATCH 1/1] Instrument mender binary | ||
|
||
Changelog: None | ||
|
||
Signed-off-by: Lluis Campos <[email protected]> | ||
--- | ||
main.go | 39 ++++++++++++++++++++++++++++++++++++++- | ||
system/system.go | 13 +------------ | ||
2 files changed, 39 insertions(+), 13 deletions(-) | ||
system/system.go | 21 +-------------------- | ||
2 files changed, 39 insertions(+), 21 deletions(-) | ||
|
||
diff --git a/main.go b/main.go | ||
index 23a6f614..1195d3ab 100644 | ||
index 23a6f61..1195d3a 100644 | ||
--- a/main.go | ||
+++ b/main.go | ||
@@ -18,6 +18,8 @@ import ( | ||
|
@@ -74,7 +74,7 @@ index 23a6f614..1195d3ab 100644 | |
+ | ||
} | ||
diff --git a/system/system.go b/system/system.go | ||
index 969275ee..c4bb61c1 100644 | ||
index cc67a01..c4bb61c 100644 | ||
--- a/system/system.go | ||
+++ b/system/system.go | ||
@@ -19,9 +19,7 @@ import ( | ||
|
@@ -87,24 +87,32 @@ index 969275ee..c4bb61c1 100644 | |
log "github.com/sirupsen/logrus" | ||
) | ||
|
||
@@ -36,16 +34,7 @@ func NewSystemRebootCmd(command Commander) *SystemRebootCmd { | ||
@@ -36,24 +34,7 @@ func NewSystemRebootCmd(command Commander) *SystemRebootCmd { | ||
} | ||
|
||
func (s *SystemRebootCmd) Reboot() error { | ||
- err := s.command.Command("reboot").Run() | ||
- | ||
- // *Any* return from this function is an error. | ||
- | ||
- if err != nil { | ||
- // MEN-5340: If there's an error, it may be because systemd is | ||
- // in the process of shutting down our service, and happens to | ||
- // kill `reboot` first. Give it a few seconds to follow up with | ||
- // killing the client. | ||
- time.Sleep(10 * time.Second) | ||
- return err | ||
- } | ||
- | ||
- // Wait up to ten minutes for reboot to kill the client, otherwise the | ||
- // client may mistake a successful return code as "reboot is complete, | ||
- // continue". *Any* return from this function is an error. | ||
- // continue". | ||
- time.Sleep(10 * time.Minute) | ||
- return errors.New("System did not reboot, even though 'reboot' call succeeded.") | ||
+ panic("Client needs reboot!") | ||
} | ||
|
||
type Commander interface { | ||
-- | ||
2.30.2 | ||
2.17.1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters