Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.10.0-rc Collected Fixes #48

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
4 changes: 1 addition & 3 deletions subsystem.go
Original file line number Diff line number Diff line change
Expand Up @@ -345,16 +345,14 @@ func (s *AgentSubsystem) Update(ctx context.Context, cfg *pb.DeviceSubsystemConf
}

// update current and previous versions
var previousVersion string
if s.CacheData.CurrentVersion != s.CacheData.PreviousVersion {
previousVersion = s.CacheData.PreviousVersion
s.CacheData.PreviousVersion = s.CacheData.CurrentVersion
}
s.CacheData.CurrentVersion = updateInfo.GetVersion()
verData.Installed = time.Now()

// if we made it here we performed an update and need to restart
s.logger.Infof("%s updated from %s to %s", s.name, previousVersion, verData.Version)
s.logger.Infof("%s updated from %s to %s", s.name, s.CacheData.PreviousVersion, s.CacheData.CurrentVersion)
needRestart = true

// record the cache
Expand Down
9 changes: 7 additions & 2 deletions subsystems/viamserver/viamserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,9 +313,9 @@ func (s *viamServer) isRestartAllowed(ctx context.Context) (bool, error) {
ctx, cancelFunc := context.WithTimeout(ctx, time.Second*10)
defer cancelFunc()

url += "/restart_status"
restartURL := url + "/restart_status"

req, err := http.NewRequestWithContext(ctx, http.MethodGet, url, nil)
req, err := http.NewRequestWithContext(ctx, http.MethodGet, restartURL, nil)
if err != nil {
return false, errw.Wrapf(err, "checking whether %s allows restart", SubsysName)
}
Expand All @@ -326,6 +326,11 @@ func (s *viamServer) isRestartAllowed(ctx context.Context) (bool, error) {

resp, err := client.Do(req)
if err != nil {
if url == s.checkURL {
// if this is only the first URL, we want to continue, not return, so log the error
s.logger.Warn(errw.Wrapf(err, "checking whether %s allows restart", SubsysName))
continue
}
return false, errw.Wrapf(err, "checking whether %s allows restart", SubsysName)
}

Expand Down