From 3fcd7bc948a2edbd17c449ec8fbdc4f8e8bbb5e0 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 1 Dec 2021 16:48:24 +0300 Subject: [PATCH] [#979] adm/subnet: Always set group ID parameter in client cmds Signed-off-by: Leonard Lyubich --- .../internal/modules/morph/subnet.go | 29 +++++++++---------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/cmd/neofs-adm/internal/modules/morph/subnet.go b/cmd/neofs-adm/internal/modules/morph/subnet.go index c02e08b4a..7eada053d 100644 --- a/cmd/neofs-adm/internal/modules/morph/subnet.go +++ b/cmd/neofs-adm/internal/modules/morph/subnet.go @@ -585,25 +585,22 @@ func manageSubnetClients(cmd *cobra.Command, rm bool) error { return fmt.Errorf("marshal client ID: %w", err) } - var prm morphsubnet.ManageClientsPrm + // read group ID and encode it + var groupID internal.SubnetClientGroupID - if viper.GetBool(flagSubnetAdminClient) { - // read group ID and encode it - var groupID internal.SubnetClientGroupID - - err = groupID.UnmarshalText([]byte(viper.GetString(flagSubnetAdminAddGroup))) - if err != nil { - return fmt.Errorf("decode group ID text: %w", err) - } - - binGroupID, err := groupID.Marshal() - if err != nil { - return fmt.Errorf("marshal group ID: %w", err) - } - - prm.SetGroup(binGroupID) + err = groupID.UnmarshalText([]byte(viper.GetString(flagSubnetAdminAddGroup))) + if err != nil { + return fmt.Errorf("decode group ID text: %w", err) } + binGroupID, err := groupID.Marshal() + if err != nil { + return fmt.Errorf("marshal group ID: %w", err) + } + + var prm morphsubnet.ManageClientsPrm + + prm.SetGroup(binGroupID) prm.SetSubnet(binID) prm.SetClient(binClientID)