Skip to content

Commit 71a8b57

Browse files
committed
Removed useless version param on 'core uninstall'
1 parent 982a271 commit 71a8b57

File tree

5 files changed

+66
-68
lines changed

5 files changed

+66
-68
lines changed

cli/core/args.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@ type platformReferenceArg struct {
3232
Version string
3333
}
3434

35+
func (pl *platformReferenceArg) String() string {
36+
if pl.Version != "" {
37+
return pl.Package + ":" + pl.Architecture + "@" + pl.Version
38+
}
39+
return pl.Package + ":" + pl.Architecture
40+
}
41+
3542
// parsePlatformReferenceArgs parses a sequence of "packager:arch@version" tokens and
3643
// returns a platformReferenceArg slice.
3744
func parsePlatformReferenceArgs(args []string) []*platformReferenceArg {

cli/core/uninstall.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,17 @@ func runUninstallCommand(cmd *cobra.Command, args []string) {
4747

4848
platformsRefs := parsePlatformReferenceArgs(args)
4949

50+
for _, platformRef := range platformsRefs {
51+
if platformRef.Version != "" {
52+
formatter.PrintErrorMessage("Invalid parameter " + platformRef.String() + ": version not allowed")
53+
os.Exit(cli.ErrBadArgument)
54+
}
55+
}
5056
for _, platformRef := range platformsRefs {
5157
_, err := core.PlatformUninstall(context.Background(), &rpc.PlatformUninstallReq{
5258
Instance: instance,
5359
PlatformPackage: platformRef.Package,
5460
Architecture: platformRef.Architecture,
55-
Version: platformRef.Version,
5661
}, output.NewTaskProgressCB())
5762
if err != nil {
5863
formatter.PrintError(err, "Error during uninstall")

commands/core/uninstall.go

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,10 @@ func PlatformUninstall(ctx context.Context, req *rpc.PlatformUninstallReq, taskC
3434
return nil, errors.New("invalid instance")
3535
}
3636

37-
// If no version is specified consider the installed
38-
version, err := commands.ParseVersion(req)
39-
if err != nil {
40-
return nil, fmt.Errorf("invalid version: %s", err)
41-
}
42-
4337
ref := &packagemanager.PlatformReference{
4438
Package: req.PlatformPackage,
4539
PlatformArchitecture: req.Architecture,
46-
PlatformVersion: version}
40+
}
4741
if ref.PlatformVersion == nil {
4842
platform := pm.FindPlatform(ref)
4943
if platform == nil {

rpc/core.pb.go

Lines changed: 52 additions & 59 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rpc/core.proto

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ message PlatformUninstallReq {
5050
Instance instance = 1;
5151
string platform_package = 2;
5252
string architecture = 3;
53-
string version = 4;
5453
}
5554

5655
message PlatformUninstallResp {

0 commit comments

Comments
 (0)