mirror of
https://github.com/netbirdio/netbird.git
synced 2026-04-16 15:26:40 +00:00
actually commit my changes this time...
This commit is contained in:
@@ -61,6 +61,9 @@ type UpdateManager struct {
|
||||
|
||||
// updateMutex protect update and expectedVersion fields
|
||||
updateMutex sync.Mutex
|
||||
|
||||
// updateFunc is used for testing to mock the triggerUpdate behavior
|
||||
updateFunc func(ctx context.Context, targetVersion string) error
|
||||
}
|
||||
|
||||
func NewUpdateManager(statusRecorder *peer.Status, stateManager *statemanager.Manager) *UpdateManager {
|
||||
@@ -79,7 +82,6 @@ func NewUpdateManager(statusRecorder *peer.Status, stateManager *statemanager.Ma
|
||||
// CheckUpdateSuccess checks if the update was successful. It works without to start the update manager.
|
||||
func (u *UpdateManager) CheckUpdateSuccess(ctx context.Context) {
|
||||
u.updateStateManager(ctx)
|
||||
return
|
||||
}
|
||||
|
||||
func (u *UpdateManager) Start(ctx context.Context) {
|
||||
|
||||
@@ -18,6 +18,11 @@ const (
|
||||
)
|
||||
|
||||
func (u *UpdateManager) triggerUpdate(ctx context.Context, targetVersion string) error {
|
||||
// Use test function if set (for testing only)
|
||||
if u.updateFunc != nil {
|
||||
return u.updateFunc(ctx, targetVersion)
|
||||
}
|
||||
|
||||
cmd := exec.CommandContext(ctx, "pkgutil", "--pkg-info", "io.netbird.client")
|
||||
outBytes, err := cmd.Output()
|
||||
if err != nil && cmd.ProcessState.ExitCode() == 1 {
|
||||
|
||||
@@ -5,6 +5,11 @@ package updatemanager
|
||||
import "context"
|
||||
|
||||
func (u *UpdateManager) triggerUpdate(ctx context.Context, targetVersion string) error {
|
||||
// Use test function if set (for testing purposes)
|
||||
if u.updateFunc != nil {
|
||||
return u.updateFunc(ctx, targetVersion)
|
||||
}
|
||||
|
||||
// TODO: Implement
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -5,6 +5,11 @@ package updatemanager
|
||||
import "context"
|
||||
|
||||
func (u *UpdateManager) triggerUpdate(ctx context.Context, targetVersion string) error {
|
||||
// Use test function if set (for testing purposes)
|
||||
if u.updateFunc != nil {
|
||||
return u.updateFunc(ctx, targetVersion)
|
||||
}
|
||||
|
||||
// TODO: Implement
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -5,6 +5,11 @@ package updatemanager
|
||||
import "context"
|
||||
|
||||
func (u *UpdateManager) triggerUpdate(ctx context.Context, targetVersion string) error {
|
||||
// Use test function if set (for testing purposes)
|
||||
if u.updateFunc != nil {
|
||||
return u.updateFunc(ctx, targetVersion)
|
||||
}
|
||||
|
||||
// TODO: Implement
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -26,6 +26,11 @@ const (
|
||||
type installerType string
|
||||
|
||||
func (u *UpdateManager) triggerUpdate(ctx context.Context, targetVersion string) error {
|
||||
// Use test function if set (for testing purposes)
|
||||
if u.updateFunc != nil {
|
||||
return u.updateFunc(ctx, targetVersion)
|
||||
}
|
||||
|
||||
method := installation()
|
||||
return install(ctx, method, targetVersion)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user