Skip to content

Commit 6f4fdb5

Browse files
committed
feat: ccontrol show query for multiple specified licenses.
1 parent 53a76a7 commit 6f4fdb5

File tree

4 files changed

+19
-19
lines changed

4 files changed

+19
-19
lines changed

internal/cbatch/CmdArgParser.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ var (
7575
if err := ParseCbatchScript(args[0], &pArgs, &pSh); err != util.ErrorSuccess {
7676
os.Exit(err)
7777
}
78-
// TODO: 阻止使用module但没申请license的任务
7978

8079
ok, task := ProcessCbatchArgs(cmd, pArgs)
8180
if !ok {

internal/ccontrol/CmdArgParser.go

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,19 @@ import (
2828
)
2929

3030
var (
31-
FlagNodeName string
32-
FlagState string
33-
FlagReason string
34-
FlagPartitionName string
35-
FlagLicenseName string
36-
FlagTaskId uint32
37-
FlagTaskIds string
38-
FlagQueryAll bool
39-
FlagTimeLimit string
40-
FlagPriority float64
41-
FlagHoldTime string
42-
FlagConfigFilePath string
43-
FlagJson bool
31+
FlagNodeName string
32+
FlagState string
33+
FlagReason string
34+
FlagPartitionName string
35+
FlagLicenseNameList string
36+
FlagTaskId uint32
37+
FlagTaskIds string
38+
FlagQueryAll bool
39+
FlagTimeLimit string
40+
FlagPriority float64
41+
FlagHoldTime string
42+
FlagConfigFilePath string
43+
FlagJson bool
4444

4545
RootCmd = &cobra.Command{
4646
Use: "ccontrol",
@@ -101,13 +101,13 @@ var (
101101
Args: cobra.MaximumNArgs(1),
102102
Run: func(cmd *cobra.Command, args []string) {
103103
if len(args) == 0 {
104-
FlagLicenseName = ""
104+
FlagLicenseNameList = ""
105105
FlagQueryAll = true
106106
} else {
107-
FlagLicenseName = args[0]
107+
FlagLicenseNameList = args[0]
108108
FlagQueryAll = false
109109
}
110-
if err := ShowLicenses(FlagLicenseName, FlagQueryAll); err != util.ErrorSuccess {
110+
if err := ShowLicenses(FlagLicenseNameList, FlagQueryAll); err != util.ErrorSuccess {
111111
os.Exit(err)
112112
}
113113
},

internal/ccontrol/ccontrol.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,8 @@ func ShowPartitions(partitionName string, queryAll bool) util.CraneCmdError {
230230
}
231231

232232
func ShowLicenses(licenseName string, queryAll bool) util.CraneCmdError {
233-
req := &protos.QueryLicensesInfoRequest{LicenseName: licenseName}
233+
licenseNameList := strings.Split(licenseName, ",")
234+
req := &protos.QueryLicensesInfoRequest{LicenseNameList: licenseNameList}
234235
reply, err := stub.QueryLicensesInfo(context.Background(), req)
235236
if err != nil {
236237
util.GrpcErrorPrintf(err, "Failed to show license")

protos/Crane.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ message QueryPartitionInfoReply {
195195
}
196196

197197
message QueryLicensesInfoRequest {
198-
string license_name = 1;
198+
repeated string license_name_list = 1;
199199
}
200200

201201
message QueryLicensesInfoReply {

0 commit comments

Comments
 (0)