Repository: redis/redis

Issue:
[BUG] sentinel option gone
**Describe the bug**
starting a sentinel using `redis-server /path/to/sentinel.conf --sentinel` fails.

**To reproduce**
```log
root@d675e5f73c51:/data# touch /etc/redis/sentinel.conf
root@d675e5f73c51:/data# redis-sentinel /etc/redis/sentinel.conf --sentinel --bind 127.0.0.1 --port 26379 --dir "/data"
--sentinel announce-ip 127.0.0.1

*** FATAL CONFIG FILE ERROR (Redis 7.0.5) ***
Reading the configuration file, at line 2
>>> 'sentinel "--bind" "127.0.0.1"'
Unrecognized sentinel configuration statement.
```

**Expected behavior**
`--sentinel` should continue to work as before.

**Additional information**
Worked in 6.x, doesn't work in redis:7.0.5 docker image



Discussion:
I suppose this will work, can you try?
redis-sentinel /etc/redis/sentinel.conf --bind 127.0.0.1 --port 26379 --dir "/data"
It sure does - but it's an unannounced change. It forces us to modify our deployments to accomodate for this...

No issue with deprecating options if they're no longer required. But please with an announcement.

Edit: And if this was a planned change, I'd expect an update in the [documentation](https://redis.io/docs/management/sentinel/#:~:text=not%20be%20used.-,Running%20Sentinel,-If%20you%20are) 😄 
Most of the time, we do have announcement. And we always try to avoid doing the breaking change.

i suppose it was an unintentional change, sorry for that. I will or others will go try trace the change. Will keep you update. And definitely will fix the doc if needed, thanks for the report
Such things happen, no worries. We worked around the issue on our end and are not blocked.

(I definitely wanted to sound less harsh than I did - sorry about that)
ok... i see, i am the one who break it, starting in #10660
and it also break
- src/redis-server sentinel.conf --sentinel --sentinel
- src/redis-sentinel sentinel.conf --sentinel --sentinel

i will try to think of a way, thanks for the report again.

@oranagra another unintentional change i made...
an easy way to fix it, is that we ignore all `--sentinel` in the options parse
i think we should handle it the same as we did for `--save` in #10866
i.e. it's a pseudo config option with no value.

Patch:
diff --git a/src/server.c b/src/server.c
index 52ce3d4d7ae..7bc3207953d 100644
--- a/src/server.c
+++ b/src/server.c
@@ -7024,6 +7024,24 @@ int main(int argc, char **argv) {
                          * so it will become `--save ""` and will follow the same reset thing. */
                         options = sdscat(options, "\"\"");
                     }
+                    else if ((j != argc-1) && argv[j+1][0] == '-' && argv[j+1][1] == '-' &&
+                        !strcasecmp(argv[j], "--sentinel"))
+                    {
+                        /* Special case: handle some things like `--sentinel --config value`.
+                         * It is a pseudo config option with no value. In this case, if next
+                         * argument starts with `--`, we will reset handled_last_config_arg flag.
+                         * We are doing it to be compatible with pre 7.0 behavior (which we
+                         * break it in #10660, 7.0.1). */
+                        options = sdscat(options, "");
+                        handled_last_config_arg = 1;
+                    }
+                    else if ((j == argc-1) && !strcasecmp(argv[j], "--sentinel")) {
+                        /* Special case: when --sentinel is the last argument.
+                         * It is a pseudo config option with no value. In this case, do nothing.
+                         * We are doing it to be compatible with pre 7.0 behavior (which we
+                         * break it in #10660, 7.0.1). */
+                        options = sdscat(options, "");
+                    }
                 } else {
                     /* Means that we are passing both config name and it's value in the same arg,
                      * like "--port 6380", so we need to reset handled_last_config_arg flag. */