Skip to content

Commit b1c7914

Browse files
Kaan Yaltipchila
andcommitted
Update internal/pkg/agent/cmd/upgrade.go
Co-authored-by: Paolo Chilà <[email protected]>
1 parent 9de6bdb commit b1c7914

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

internal/pkg/agent/cmd/upgrade.go

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -92,25 +92,20 @@ func upgradeCmd(streams *cli.IOStreams, cmd *cobra.Command, args []string) error
9292
return upgradeCmdWithClient(input)
9393
}
9494

95-
func shouldUpgrade(cmd *cobra.Command, agentInfo info.Agent) (bool, error) {
95+
func checkUpgradable(force bool, agentInfo info.Agent) error {
9696
if agentInfo.IsStandalone() {
97-
return true, nil
97+
return nil
9898
}
9999

100100
if agentInfo.Unprivileged() {
101-
return false, fmt.Errorf("upgrade command needs to be executed as root for fleet managed agents")
102-
}
103-
104-
force, err := cmd.Flags().GetBool(flagForce)
105-
if err != nil {
106-
return false, fmt.Errorf("failed to retrieve command flag information while trying to upgrade the agent: %w", err)
101+
return fmt.Errorf("upgrade command needs to be executed as root for fleet managed agents")
107102
}
108103

109104
if !force {
110-
return false, unsupportedUpgrade
105+
return unsupportedUpgrade
111106
}
112107

113-
return true, nil
108+
return nil
114109
}
115110

116111
func upgradeCmdWithClient(input *upgradeInput) error {

0 commit comments

Comments
 (0)