Skip to content

Commit

Permalink
cli/object: Fix missing RPC endpoint that is set through config file
Browse files Browse the repository at this point in the history
Previously, object command that opened dynamic session with storage node
(like `put`) failed with `can't fetch current epoch: can't parse RPC
endpoint: missing port in address` error when RPC endpoint was set in
the config file and omitted in flags.

Get network endpoint from viper box which contains values from config
file.

Refs #1574.

Signed-off-by: Leonard Lyubich <[email protected]>
  • Loading branch information
cthulhu-rider committed Oct 3, 2023
1 parent 1154421 commit 9e833e3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Changelog for NeoFS Node
- `neofs-cli netmap netinfo` documentation (#2555)
- `GETRANGEHASH` to a node without an object produced `GETRANGE` or `GET` requests (#2541, #2598)
- Iteration over locally collected container estimation values (#2597)
- Error of missing network endpoint in `neofs-cli object` commands when it is set in the file config (#2608)

### Changed
- FSTree storage now uses more efficient and safe temporary files under Linux (#2566)
Expand Down
3 changes: 1 addition & 2 deletions cmd/neofs-cli/modules/object/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,7 @@ func OpenSessionViaClient(ctx context.Context, cmd *cobra.Command, dst SessionPr
const sessionLifetime = 10 // in NeoFS epochs

common.PrintVerbose(cmd, "Opening remote session with the node...")
endpoint, _ := cmd.Flags().GetString(commonflags.RPC)
currEpoch, err := internal.GetCurrentEpoch(ctx, endpoint)
currEpoch, err := internal.GetCurrentEpoch(ctx, viper.GetString(commonflags.RPC))
common.ExitOnErr(cmd, "can't fetch current epoch: %w", err)
exp := currEpoch + sessionLifetime
err = sessionCli.CreateSession(ctx, &tok, cli, *key, exp, currEpoch)
Expand Down

0 comments on commit 9e833e3

Please sign in to comment.