Skip to content

Commit

Permalink
Allow register function to reboot the machine
Browse files Browse the repository at this point in the history
So we reboot to the active system after install

Signed-off-by: Itxaka <[email protected]>
  • Loading branch information
Itxaka committed Jul 12, 2023
1 parent 651b974 commit 2e3d6d0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tests/provider_install_qrcode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ var _ = Describe("kairos qr code install", Label("provider", "provider-qrcode-in
Expect(err).ToNot(HaveOccurred(), device)

By("registering with a screenshot")
err = register("fatal", fileName, "./assets/config.yaml", strings.TrimSpace(device))
err = register("fatal", fileName, "./assets/config.yaml", strings.TrimSpace(device), true)
Expect(err).ToNot(HaveOccurred())

By("waiting until it reboots to installed system")
Expand Down
6 changes: 5 additions & 1 deletion tests/tests_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ func generateToken() string {
}

// register registers a node with a qrfile
func register(loglevel, qrfile, configFile, device string) error {
func register(loglevel, qrfile, configFile, device string, reboot bool) error {
b, _ := os.ReadFile(configFile)
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
Expand All @@ -334,6 +334,10 @@ func register(loglevel, qrfile, configFile, device string) error {
"cc": string(b),
}

if reboot {
config["reboot"] = "true"
}

err := nodepair.Send(
ctx,
config,
Expand Down

0 comments on commit 2e3d6d0

Please sign in to comment.