-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1b40334
commit 4034422
Showing
11 changed files
with
1,041 additions
and
12 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
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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package main | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"net/http" | ||
|
||
"github.com/kolide/launcher/ee/agent/flags/keys" | ||
"github.com/kolide/launcher/ee/agent/startupsettings" | ||
"github.com/kolide/launcher/pkg/launcher" | ||
"github.com/kolide/launcher/pkg/log/multislogger" | ||
) | ||
|
||
func runRecheck(_ *multislogger.MultiSlogger, _ []string) error { | ||
attachConsole() | ||
defer detachConsole() | ||
|
||
settingReader, err := startupsettings.OpenReader(context.TODO(), launcher.DefaultPath(launcher.RootDirectory)) | ||
if err != nil { | ||
return fmt.Errorf("opening startup settings reader to fetch desktop runner server url, is launcher daemon running?: %w", err) | ||
} | ||
defer settingReader.Close() | ||
|
||
desktopRunnerServerURL, err := settingReader.Get(keys.DesktopRunnerServerUrl.String()) | ||
if err != nil { | ||
return fmt.Errorf("getting desktop runner server url, is launcher daemon running?: %w", err) | ||
} | ||
|
||
response, err := http.Get(fmt.Sprintf("%s/recheck", desktopRunnerServerURL)) | ||
if err != nil { | ||
return fmt.Errorf("sending recheck request to desktop runner server, is launcher daemon running?: %w", err) | ||
} | ||
|
||
if response.Body != nil { | ||
defer response.Body.Close() | ||
} | ||
|
||
if response.StatusCode != http.StatusOK { | ||
return fmt.Errorf("recheck request failed with status code %d", response.StatusCode) | ||
} | ||
|
||
fmt.Print("recheck request sent successfully") | ||
|
||
return nil | ||
} |
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
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
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
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
Oops, something went wrong.