Skip to content

Commit 1fe19c2

Browse files
committed
Use "fleet" instead of "team" in remaining GitOps errors
1 parent 77c9b56 commit 1fe19c2

3 files changed

Lines changed: 11 additions & 10 deletions

File tree

‎changes/57505-gitops-fleet-errors‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Updated GitOps errors for software packages, fleet names, fleet settings files, and `custom_host_vitals` to say "fleet" instead of "team".

‎pkg/spec/gitops.go‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -307,15 +307,15 @@ func (spec SoftwarePackage) HydrateToPackageLevel(packageLevel fleet.SoftwarePac
307307
if spec.InstallScript.Path != "" || spec.URL != "" || spec.SHA256 != "" ||
308308
(!isScript && (spec.UninstallScript.Path != "" || spec.PostInstallScript.Path != "" || spec.PreInstallQuery.Path != "")) {
309309
if isScript {
310-
return packageLevel, fmt.Errorf("the software package defined in %s must not have install_script, URL, or hash specified at the team level", *spec.Path)
310+
return packageLevel, fmt.Errorf("the software package defined in %s must not have install_script, URL, or hash specified at the fleet level", *spec.Path)
311311
}
312-
return packageLevel, fmt.Errorf("the software package defined in %s must not have icons, scripts, queries, URL, or hash specified at the team level", *spec.Path)
312+
return packageLevel, fmt.Errorf("the software package defined in %s must not have icons, scripts, queries, URL, or hash specified at the fleet level", *spec.Path)
313313
}
314314

315315
// Icon should be allowed at the team level yaml for script packages which must be specified as a path
316316
if spec.Icon.Path != "" {
317317
if !fleet.IsScriptPackage(ext) {
318-
return packageLevel, fmt.Errorf("the software package defined in %s must not have icons, scripts, queries, URL, or hash specified at the team level", *spec.Path)
318+
return packageLevel, fmt.Errorf("the software package defined in %s must not have icons, scripts, queries, URL, or hash specified at the fleet level", *spec.Path)
319319
}
320320
}
321321

@@ -692,7 +692,7 @@ func parseName(raw json.RawMessage, result *GitOps, filePath string, multiError
692692
*result.TeamName = strings.TrimSpace(*result.TeamName)
693693
}
694694
if result.TeamName == nil || *result.TeamName == "" {
695-
return multierror.Append(multiError, errors.New("team 'name' is required"))
695+
return multierror.Append(multiError, errors.New("fleet 'name' is required"))
696696
}
697697
// Normalize team name for full Unicode support, so that we can assume team names are unique going forward
698698
normalized := norm.NFC.String(*result.TeamName)
@@ -1013,7 +1013,7 @@ func parseTeamSettings(raw json.RawMessage, result *GitOps, baseDir string, file
10131013
fileBytes, err := os.ReadFile(resolveApplyRelativePath(baseDir, *teamSettingsTop.Path))
10141014
if err != nil {
10151015
noError = false
1016-
multiError = multierror.Append(multiError, fmt.Errorf("failed to read team settings file %s: %v", *teamSettingsTop.Path, err))
1016+
multiError = multierror.Append(multiError, fmt.Errorf("failed to read fleet settings file %s: %v", *teamSettingsTop.Path, err))
10171017
} else {
10181018
// Replace $var and ${var} with env values.
10191019
fileBytes, err = ExpandEnvBytes(fileBytes)
@@ -1259,7 +1259,7 @@ func parseCustomHostVitals(top map[string]json.RawMessage, result *GitOps, fileP
12591259
raw := top["custom_host_vitals"]
12601260

12611261
if !result.global() {
1262-
return multierror.Append(multiError, errors.New("'custom_host_vitals' cannot be set on a team file"))
1262+
return multierror.Append(multiError, errors.New("'custom_host_vitals' cannot be set on a fleet file"))
12631263
}
12641264

12651265
result.CustomHostVitals = []fleet.CustomHostVital{}

‎pkg/spec/gitops_test.go‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -840,7 +840,7 @@ func TestWhitespaceOnlyTeamName(t *testing.T) {
840840
config += `name: " "`
841841
_, err := gitOpsFromString(t, config)
842842
require.Error(t, err)
843-
require.Contains(t, err.Error(), "team 'name' is required")
843+
require.Contains(t, err.Error(), "fleet 'name' is required")
844844
}
845845

846846
func TestMissingNameErrorMessages(t *testing.T) {
@@ -2569,7 +2569,7 @@ software:
25692569
Tier: fleet.TierPremium,
25702570
}
25712571
_, err = GitOpsFromFile(path, basePath, &appConfig, nopLogf)
2572-
assert.ErrorContains(t, err, "the software package defined in software/single-package.yml must not have icons, scripts, queries, URL, or hash specified at the team level")
2572+
assert.ErrorContains(t, err, "the software package defined in software/single-package.yml must not have icons, scripts, queries, URL, or hash specified at the fleet level")
25732573
}
25742574

25752575
func TestScriptOnlyPackagesPathWithInline(t *testing.T) {
@@ -2726,7 +2726,7 @@ software:
27262726
_, err := GitOpsFromFile(path, basePath, &appConfig, nopLogf)
27272727
// The message must not claim scripts/queries are forbidden — they're allowed
27282728
// for script-only packages.
2729-
require.ErrorContains(t, err, "must not have install_script, URL, or hash specified at the team level")
2729+
require.ErrorContains(t, err, "must not have install_script, URL, or hash specified at the fleet level")
27302730
}
27312731

27322732
func TestIllegalFleetSecret(t *testing.T) {
@@ -6060,7 +6060,7 @@ custom_host_vitals:
60606060
- name: Asset tag
60616061
`)
60626062
_, err := GitOpsFromFile(path, basePath, nil, nopLogf)
6063-
require.ErrorContains(t, err, "'custom_host_vitals' cannot be set on a team file")
6063+
require.ErrorContains(t, err, "'custom_host_vitals' cannot be set on a fleet file")
60646064
})
60656065

60666066
t.Run("rejects an invalid name", func(t *testing.T) {

0 commit comments

Comments
 (0)