Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions agentconfig/agentconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ var (
capabilities = []string{"PATCH_GA", "GUEST_POLICY_BETA", "CONFIG_V1"}

osConfigWatchConfigTimeout = 10 * time.Minute
watchConfigRetryInterval = 5 * time.Second

defaultClient = &http.Client{
Transport: &http.Transport{
Expand All @@ -116,6 +117,8 @@ var (

freeOSMemory = strings.ToLower(os.Getenv("OSCONFIG_FREE_OS_MEMORY"))
disableInventoryWrite = strings.ToLower(os.Getenv("OSCONFIG_DISABLE_INVENTORY_WRITE"))

goos = runtime.GOOS
)

type config struct {
Expand Down Expand Up @@ -487,7 +490,7 @@ func WatchConfig(ctx context.Context) error {
// Max watch time, after this WatchConfig will return.
timeout := time.After(osConfigWatchConfigTimeout)
// Min watch loop time.
loopTicker := time.NewTicker(5 * time.Second)
loopTicker := time.NewTicker(watchConfigRetryInterval)
defer loopTicker.Stop()
eTag := lEtag.get()
webErrorCount := 0
Expand Down Expand Up @@ -561,7 +564,7 @@ func SvcPollInterval() time.Duration {

// SerialLogPort is the serial port to log to.
func SerialLogPort() string {
if runtime.GOOS == "windows" {
if goos == "windows" {
return "COM1"
}
// Don't write directly to the serial port on Linux as syslog already writes there.
Expand Down Expand Up @@ -767,7 +770,7 @@ func Capabilities() []string {

// TaskStateFile is the location of the task state file.
func TaskStateFile() string {
if runtime.GOOS == "windows" {
if goos == "windows" {
return filepath.Join(GetCacheDirWindows(), "osconfig_task.state")
}

Expand All @@ -776,15 +779,15 @@ func TaskStateFile() string {

// OldTaskStateFile is the location of the task state file.
func OldTaskStateFile() string {
if runtime.GOOS == "windows" {
if goos == "windows" {
return oldTaskStateFileWindows
}
return oldTaskStateFileLinux
}

// RestartFile is the location of the restart required file.
func RestartFile() string {
if runtime.GOOS == "windows" {
if goos == "windows" {
return filepath.Join(
GetCacheDirWindows(), "osconfig_agent_restart_required")
}
Expand All @@ -799,7 +802,7 @@ func OldRestartFile() string {

// CacheDir is the location of the cache directory.
func CacheDir() string {
if runtime.GOOS == "windows" {
if goos == "windows" {
return GetCacheDirWindows()
}

Expand Down
Loading