cli: Fix netinfo output for empty unknown parameters #1236

Closed
achuprov wants to merge 1 commit from achuprov/frostfs-node:feat/unknown_network_info_parameters into master
Showing only changes of commit afeaf01cea - Show all commits

View file

@ -50,8 +50,12 @@ var netInfoCmd = &cobra.Command{
cmd.Printf(format, "Maintenance mode allowed", netInfo.MaintenanceModeAllowed())
cmd.Println("FrostFS network configuration (other)")
netInfo.IterateRawNetworkParameters(func(name string, value []byte) {
cmd.Printf(format, name, hex.EncodeToString(value))
netInfo.IterateRawNetworkParameters(func(name string, rawValue []byte) {
Review

I personally think the perfect behaviour was fine (we expect hex, we get empty hex)

I personally think the perfect behaviour was fine (we expect hex, we get empty hex)
Review

I think we should display the empty value (just like with namespace). What do you think about nil?

I think we should display the empty value (just like with namespace). What do you think about `nil`?
Review

The same thing to me.
But if everyone agrees we need this, empty would be less Go-specific.

The same thing to me. But if everyone agrees we need this, `empty` would be less Go-specific.
Review

@aarifullin / @dstepanov-yadro / @elebedeva What do you think?

@aarifullin / @dstepanov-yadro / @elebedeva What do you think?
Review

We should keep in mind that any cli output may be parsed (like test results).

value: ""

and

value: 57277d7b

As we can see these output results are not the same format. Either we need to frame non-nil output to quotes or omit it for the first case. I think if we keep it in current format - that's OK.

We should keep in mind that any cli output *may be* parsed (like test results). ``` value: "" ``` and ``` value: 57277d7b ``` As we can see these output results are not the same format. Either we need to *frame* non-nil output to quotes or omit it for the first case. I think if we keep it in current format - that's OK.
value := hex.EncodeToString(rawValue)
if value == "" {
value = `""`
}
cmd.Printf(format, name, value)
})
},
}