Skip to content

Commit

Permalink
Adapt callers to new config function signatures
Browse files Browse the repository at this point in the history
  • Loading branch information
EduardGomezEscandell committed Oct 26, 2023
1 parent 685f7ab commit a34cf14
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions windows-agent/internal/proservices/landscape/landscape.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ type connection struct {

// Config is a configuration provider for ProToken and the Landscape URL.
type Config interface {
LandscapeClientConfig(context.Context) (string, error)
LandscapeClientConfig(context.Context) (string, config.ConfigSource, error)

Subscription(context.Context) (string, config.ConfigSource, error)

Expand Down Expand Up @@ -97,7 +97,7 @@ func NewClient(conf Config, db *database.DistroDB, args ...Option) (*Client, err

// hostagentURL parses the landscape config file to find the hostagent URL.
func (c *Client) hostagentURL(ctx context.Context) (string, error) {
config, err := c.conf.LandscapeClientConfig(ctx)
config, _, err := c.conf.LandscapeClientConfig(ctx)
if err != nil {
return "", err
}
Expand Down Expand Up @@ -370,7 +370,7 @@ func (conn *connection) connected() bool {
func (c *Client) transportCredentials(ctx context.Context) (cred credentials.TransportCredentials, err error) {
defer decorate.OnError(&err, "Landscape credentials")

conf, err := c.conf.LandscapeClientConfig(ctx)
conf, _, err := c.conf.LandscapeClientConfig(ctx)
if err != nil {
return nil, fmt.Errorf("could not obtain Landscape config: %v", err)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -798,14 +798,14 @@ type mockConfig struct {
mu sync.Mutex
}

func (m *mockConfig) LandscapeClientConfig(ctx context.Context) (string, error) {
func (m *mockConfig) LandscapeClientConfig(ctx context.Context) (string, config.ConfigSource, error) {
m.mu.Lock()
defer m.mu.Unlock()

if m.landscapeConfigErr {
return "", errors.New("Mock error")
return "", config.SourceNone, errors.New("Mock error")
}
return m.landscapeClientConfig, nil
return m.landscapeClientConfig, config.SourceGUI, nil
}

func (m *mockConfig) ProvisioningTasks(ctx context.Context, distroName string) ([]task.Task, error) {
Expand Down
4 changes: 2 additions & 2 deletions windows-agent/internal/proservices/proservices.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func New(ctx context.Context, args ...Option) (s Manager, err error) {
return s, err
}

conf := config.New(ctx, config.WithRegistry(opts.registry))
conf := config.New(ctx, opts.cacheDir, config.WithRegistry(opts.registry))
if err := conf.FetchMicrosoftStoreSubscription(ctx); err != nil {
log.Warningf(ctx, "%v", err)
}
Expand All @@ -92,7 +92,7 @@ func New(ctx context.Context, args ...Option) (s Manager, err error) {
}
defer db.Close(ctx)

if err := conf.UpdateRegistrySettings(ctx, opts.cacheDir, db); err != nil {
if err := conf.UpdateRegistrySettings(ctx, db); err != nil {
log.Warningf(ctx, "Could not update registry settings: %v", err)
}

Expand Down

0 comments on commit a34cf14

Please sign in to comment.