storj/cmd
Márton Elek 98921f9faa satellite/overlay: fix placement selection config parsing
When we do `satellite run api --placement '...'`, the placement rules are not parsed well.

The problem is based on `viper.AllSettings()`, and the main logic is sg. like this (from a new unit test):

```
		r := ConfigurablePlacementRule{}
		err := r.Set(p)
		require.NoError(t, err)
		serialized := r.String()

		r2 := ConfigurablePlacementRule{}
		err = r2.Set(serialized)
		require.NoError(t, err)

		require.Equal(t, p, r2.String())
```

All settings evaluates the placement rules in `ConfigurablePlacementRules` and stores the string representation.

The problem is that we don't have proper `String()` implementation (it prints out the structs instead of the original definition.

There are two main solutions for this problem:

 1. We can fix the `String()`. When we parse a placement rule, the `String()` method should print out the original definition
 2. We can switch to use pure string as configuration parameter, and parse the rules only when required.

I feel that 1 is error prone, we can do it (and in this patch I added a lot of `String()` implementations, but it's hard to be sure that our `String()` logic is inline with the parsing logic.

Therefore I decided to make the configuration value of the placements a string (or a wrapper around string).

That's the main reason why this patch seems to be big, as I updated all the usages.

But the main part is in beginning of the `placement.go` (configuration parsing is not a pflag.Value implementation any more, but a separated step).

And `filter.go`, (a few more String implementation for filters.

https://github.com/storj/storj/issues/6248

Change-Id: I47c762d3514342b76a2e85683b1c891502a0756a
2023-09-21 14:31:41 +00:00
..
certificates certificate/authorization,cmd/certificates: remove gob code 2023-02-08 15:05:40 +00:00
crashcollect crashcollect: process for receiving panics 2021-04-27 18:57:47 +03:00
identity all: fix deprecated ioutil commands 2022-10-11 15:27:29 +00:00
internal/wizard cmd/internal/asset: delete unused code 2021-05-20 18:30:19 +03:00
metric-receiver cmd/metric-receiver: restore minimal metrics server 2020-10-14 20:01:29 +03:00
multinode cmd/multinode: Removes dependency on deprecated identity-dir flag, code and documentation. (#5646) 2023-03-08 13:56:15 +01:00
satellite satellite/overlay: fix placement selection config parsing 2023-09-21 14:31:41 +00:00
storagenode cmd/storagenode: add forget-satellite subcommand 2023-09-13 19:06:55 +00:00
storagenode-updater cmd/storagenode-updater: restart storagenode after update on BSD unix derivatives 2023-01-11 12:38:26 +00:00
storj-admin all: fix linter complaints 2020-10-13 15:59:01 +03:00
storj-sim cmd,satellite: remove Graphql code and dependencies 2023-08-22 12:23:14 +00:00
tools satellite/overlay: fix placement selection config parsing 2023-09-21 14:31:41 +00:00
uplink cmd/uplink: don't output stacktrace with unknown access 2023-09-20 10:06:47 +00:00
versioncontrol Dockerfiles: switch base image from alpine to Debian 2022-04-05 11:40:44 +00:00