SENTINEL SET [ ...] */
| 3987 | |
| 3988 | /* SENTINEL SET <mastername> [<option> <value> ...] */ |
| 3989 | void sentinelSetCommand(client *c) { |
| 3990 | sentinelRedisInstance *ri; |
| 3991 | int j, changes = 0; |
| 3992 | int badarg = 0; /* Bad argument position for error reporting. */ |
| 3993 | char *option; |
| 3994 | |
| 3995 | if ((ri = sentinelGetMasterByNameOrReplyError(c,c->argv[2])) |
| 3996 | == NULL) return; |
| 3997 | |
| 3998 | /* Process option - value pairs. */ |
| 3999 | for (j = 3; j < c->argc; j++) { |
| 4000 | int moreargs = (c->argc-1) - j; |
| 4001 | option = c->argv[j]->ptr; |
| 4002 | long long ll; |
| 4003 | int old_j = j; /* Used to know what to log as an event. */ |
| 4004 | |
| 4005 | if (!strcasecmp(option,"down-after-milliseconds") && moreargs > 0) { |
| 4006 | /* down-after-millisecodns <milliseconds> */ |
| 4007 | robj *o = c->argv[++j]; |
| 4008 | if (getLongLongFromObject(o,&ll) == C_ERR || ll <= 0) { |
| 4009 | badarg = j; |
| 4010 | goto badfmt; |
| 4011 | } |
| 4012 | ri->down_after_period = ll; |
| 4013 | sentinelPropagateDownAfterPeriod(ri); |
| 4014 | changes++; |
| 4015 | } else if (!strcasecmp(option,"failover-timeout") && moreargs > 0) { |
| 4016 | /* failover-timeout <milliseconds> */ |
| 4017 | robj *o = c->argv[++j]; |
| 4018 | if (getLongLongFromObject(o,&ll) == C_ERR || ll <= 0) { |
| 4019 | badarg = j; |
| 4020 | goto badfmt; |
| 4021 | } |
| 4022 | ri->failover_timeout = ll; |
| 4023 | changes++; |
| 4024 | } else if (!strcasecmp(option,"parallel-syncs") && moreargs > 0) { |
| 4025 | /* parallel-syncs <milliseconds> */ |
| 4026 | robj *o = c->argv[++j]; |
| 4027 | if (getLongLongFromObject(o,&ll) == C_ERR || ll <= 0) { |
| 4028 | badarg = j; |
| 4029 | goto badfmt; |
| 4030 | } |
| 4031 | ri->parallel_syncs = ll; |
| 4032 | changes++; |
| 4033 | } else if (!strcasecmp(option,"notification-script") && moreargs > 0) { |
| 4034 | /* notification-script <path> */ |
| 4035 | char *value = c->argv[++j]->ptr; |
| 4036 | if (sentinel.deny_scripts_reconfig) { |
| 4037 | addReplyError(c, |
| 4038 | "Reconfiguration of scripts path is denied for " |
| 4039 | "security reasons. Check the deny-scripts-reconfig " |
| 4040 | "configuration directive in your Sentinel configuration"); |
| 4041 | goto seterr; |
| 4042 | } |
| 4043 | |
| 4044 | if (strlen(value) && access(value,X_OK) == -1) { |
| 4045 | addReplyError(c, |
| 4046 | "Notification script seems non existing or non executable"); |
no test coverage detected