Skip to content

Commit 26385a6

Browse files
authored
fix patch err not Get API (#6245)
Signed-off-by: clyi <clyi@alauda.io>
1 parent 4309d76 commit 26385a6

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

pkg/ovs/ovs-vsctl.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,20 @@ func ovsClear(table, record string, columns ...string) error {
158158
return err
159159
}
160160

161+
func Get(table, record, column, key string, ifExists bool) (string, error) {
162+
var columnVal string
163+
if key == "" {
164+
columnVal = column
165+
} else {
166+
columnVal = column + ":" + key
167+
}
168+
args := []string{"get", table, record, columnVal}
169+
if ifExists {
170+
args = append([]string{"--if-exists"}, args...)
171+
}
172+
return Exec(args...)
173+
}
174+
161175
func ovsGet(table, record, column, key string) (string, error) {
162176
var columnVal string
163177
if key == "" {

0 commit comments

Comments
 (0)