forked from TrueCloudLab/frostfs-node
[#161] adm: Refactor netmap add/remove commands
Resolve funlen linter for manageSubnetAdmins function Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>support/v0.36
parent
92f8810970
commit
e1b99dacad
|
@ -307,8 +307,6 @@ const (
|
|||
)
|
||||
|
||||
// common executor cmdSubnetAdminAdd and cmdSubnetAdminRemove commands.
|
||||
//
|
||||
// nolint: funlen
|
||||
func manageSubnetAdmins(cmd *cobra.Command, rm bool) error {
|
||||
// read private key
|
||||
var key keys.PrivateKey
|
||||
|
@ -341,17 +339,19 @@ func manageSubnetAdmins(cmd *cobra.Command, rm bool) error {
|
|||
return fmt.Errorf("admin key format: %w", err)
|
||||
}
|
||||
|
||||
// prepare call parameters
|
||||
return invokeMethodWithParams(cmd, id, rm, binAdminKey, key)
|
||||
}
|
||||
|
||||
func invokeMethodWithParams(cmd *cobra.Command, id subnetid.ID, rm bool, binAdminKey []byte, key keys.PrivateKey) error {
|
||||
prm := make([]any, 0, 3)
|
||||
prm = append(prm, id.Marshal())
|
||||
|
||||
var method string
|
||||
|
||||
if viper.GetBool(flagSubnetAdminClient) {
|
||||
// read group ID and encode it
|
||||
var groupID internal.SubnetClientGroupID
|
||||
|
||||
err = groupID.UnmarshalText([]byte(viper.GetString(flagSubnetAdminAddGroup)))
|
||||
err := groupID.UnmarshalText([]byte(viper.GetString(flagSubnetAdminAddGroup)))
|
||||
if err != nil {
|
||||
return fmt.Errorf("decode group ID text: %w", err)
|
||||
}
|
||||
|
@ -378,7 +378,7 @@ func manageSubnetAdmins(cmd *cobra.Command, rm bool) error {
|
|||
|
||||
prm = append(prm, binAdminKey)
|
||||
|
||||
err = invokeMethod(key, false, method, prm...)
|
||||
err := invokeMethod(key, false, method, prm...)
|
||||
if err != nil {
|
||||
return fmt.Errorf("morph invocation: %w", err)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue