hashicorp / hashicorp/consul

Config test doesn't report conflicting options of bootstrap expect when server is false

Open
#2,775 0 comments 0 reactions 0 assignees View on GitHub
theme/operator-usability type/enhancement
Dominant language
Go
Stars
30.1k
Forks
4.6k
Avg merge
2d 6h
Merged PRs (30d)
43

Description

### `consul version` for both Client and Server
Client: `[client version here]`
Server: `[server version here]`

### `consul info` for both Client and Server
Client:
```
Consul v0.7.5
Protocol 2 spoken by default, understands 2 to 3 (agent will automatically use protocol >2 when speaking to compatible agents)

# consul info
agent:
check_monitors = 0
check_ttls = 0
checks = 0
services = 0
build:
prerelease =
revision = '21f2d5a
version = 0.7.5
consul:
known_servers = 3
server = false
runtime:
arch = amd64
cpu_count = 4
goroutines = 37
max_procs = 2
os = linux
version = go1.7.5
serf_lan:
encrypted = false
event_queue = 0
event_time = 3
failed = 0
health_score = 0
intent_queue = 0
left = 0
member_time = 4
members = 4
query_queue = 0
query_time = 1
```

Server:
```
N/A
```

### Operating system and Environment details
ubuntu 16.04 in lxd container, kernel 4.8
```
# uname -a
Linux vault-1 4.8.0-36-generic #36~16.04.1-Ubuntu SMP Sun Feb 5 09:39:57 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
```

### Description of the Issue (and unexpected/desired result)
```
# consul configtest -config-file /etc/consul.d/conul.json
# echo $?
0
# consul agent -config-file /etc/consul.d/conul.json
==> Expect mode cannot be enabled when server mode is not enabled
```
`configtest` should report the same error that consul `agent` does, since it is a configuration error.

### Reproduction steps
Use a config file like this:
```
{
"server": false,
"bind_addr": "0.0.0.0",
"bootstrap_expect": 3, # <-- This is the conflicting line.
"enable_debug": true,
"retry_interval": "15s",
"data_dir": "/var/lib/consul"
}
```
Run `configtest` then `agent`
### Log Fragments or Link to [gist](https://gist.github.com/)
N/A

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.