Skip to content

Commit 656b6fa

Browse files
committed
revised rawparams type
1 parent 5825afe commit 656b6fa

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

resource3/plugins/binary/call.go

+3
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ func (p Plugin) call(ctx context.Context, cmd string, req interface{}, resp inte
2525
return err
2626
}
2727

28+
if len(out) == 0 {
29+
return nil
30+
}
2831
return json.Unmarshal(out, resp)
2932
}
3033

resource3/plugins/storage/types/node.go

+1-4
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,7 @@ func (n *NodeResourceInfo) Validate() error {
9797
if err := n.validateStorage(); err != nil {
9898
return err
9999
}
100-
if err := n.validateDisks(); err != nil {
101-
return err
102-
}
103-
return nil
100+
return n.validateDisks()
104101
}
105102

106103
// GetAvailableResource .

types/resource.go

+7-3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ package types
33
import (
44
"fmt"
55
"strconv"
6+
7+
"github.com/mitchellh/mapstructure"
68
)
79

810
// RawParams .
@@ -86,13 +88,15 @@ func (r RawParams) Bool(key string) bool {
8688
}
8789

8890
// RawParams .
89-
func (r RawParams) RawParams(key string) map[string]interface{} {
91+
func (r RawParams) RawParams(key string) *RawParams {
9092
if r.IsSet(key) {
9193
if m, ok := r[key].(map[string]interface{}); ok {
92-
return m
94+
n := &RawParams{}
95+
_ = mapstructure.Decode(m, n)
96+
return n
9397
}
9498
}
95-
return map[string]interface{}{}
99+
return &RawParams{}
96100
}
97101

98102
// Resources all cosmos use this

0 commit comments

Comments
 (0)