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

ignore TTL & update config if app version doesn't match config version #612

Merged
merged 2 commits into from
Jul 28, 2022
Merged
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
3 changes: 2 additions & 1 deletion cmd/fastly/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ func main() {
// NOTE: We don't want to trigger a config check when the user is making an
// autocomplete request because this can add additional latency to the user's
// shell loading completely.
if check.Stale(file.CLI.LastChecked, file.CLI.TTL) && !cmd.IsCompletion(args) && !cmd.IsCompletionScript(args) {
stale := (file.CLI.Version != revision.AppVersion) || check.Stale(file.CLI.LastChecked, file.CLI.TTL)
if stale && !cmd.IsCompletion(args) && !cmd.IsCompletionScript(args) {
if verboseOutput {
text.Info(out, `
Compatibility and versioning information for the Fastly CLI is being updated in the background. The updated data will be used next time you execute a fastly command.
Expand Down
9 changes: 0 additions & 9 deletions pkg/commands/update/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,6 @@ func (c *RootCommand) Exec(in io.Reader, out io.Writer) error {
}
}

file := c.Globals.File
err = file.Load(file.CLI.RemoteConfig, config.FilePath, c.Globals.HTTPClient)
if err != nil {
return errors.RemediationError{
Inner: fmt.Errorf("error updating the versioning information for the Fastly CLI: %w", err),
Remediation: errors.UpdateRemediation,
}
}

progress.Done()

text.Success(out, "Updated %s to %s.", currentPath, latest)
Expand Down
3 changes: 0 additions & 3 deletions pkg/errors/remediation_error.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,3 @@ var ComputeTrialRemediation = "For more help with this error see fastly.help/cli

// ProfileRemediation suggests no profiles exist.
var ProfileRemediation = "Run `fastly profile create <NAME>` to create a profile, or `fastly profile list` to view available profiles (at least one profile should be set as 'default')."

// UpdateRemediation suggests no profiles exist.
var UpdateRemediation = "We'll attempt to update the Fastly CLI versioning information on the next invocation. If there are any errors, ensure `fastly config` matches https://developer.fastly.com/api/internal/cli-config"