I'm trying to use a LWRP to just add a check to a server. The documentation has examples of how to do this with services and checks, but not just the consul_check
provider.
Here is the consul_service_def
that works
consul_service_def 'influx web interface 8083' do
check(
id: 'Web interface',
name: 'Web interface on port 8083',
http: 'http://localhost:8083',
interval: '10s',
timeout: '1s'
)
notifies :reload, 'service[consul]'
end
Which succesfully translates to
{
"service": {
"name": "influx web interface 8083",
"check": {
"id": "Web interface",
"name": "Web interface on port 8083",
"http": "http://localhost:8083",
"interval": "10s",
"timeout": "1s"
}
}
}
However, this is what I am trying to do with the check_def provider
consul_check_def 'server1' do
id 'Web interface'
name 'Web interface on port 8083'
http 'http://localhost:80'
interval '10s'
timeout '1s'
notifies :reload, 'service[consul]'
end
This errors out
================================================================================
Recipe Compile Error in /var/chef/cache/cookbooks/ND-consul-agent/recipes/influxdb.rb
================================================================================
NoMethodError
-------------
undefined method `zero?' for "1s":String
Cookbook Trace:
---------------
/var/chef/cache/cookbooks/ND-consul-agent/recipes/influxdb.rb:15:in `block in from_file'
/var/chef/cache/cookbooks/ND-consul-agent/recipes/influxdb.rb:10:in `from_file'
Relevant File Content:
----------------------
/var/chef/cache/cookbooks/ND-consul-agent/recipes/influxdb.rb:
8: # end
9:
10: consul_check_def 'server1' do
11: id 'Web interface'
12: name 'Web interface on port 8083'
13: http 'http://localhost:80'
14: interval '10s'
15>> timeout '1s'
16: notifies :reload, 'service[consul]'
17: end
18:
19: # {
20: # "check": {
21: # "id": "Web Interface ",
22: # "name": "Web Interface on port 8083",
23: # "http": "http://localhost:8083",
24: # "interval": "10s",
Running handlers:
[2015-05-26T15:46:04-06:00] ERROR: Running exception handlers
Running handlers complete
[2015-05-26T15:46:04-06:00] ERROR: Exception handlers complete
[2015-05-26T15:46:04-06:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
Chef Client failed. 0 resources updated in 3.5705527 seconds
[2015-05-26T15:46:04-06:00] ERROR: undefined method `zero?' for "1s":String
[2015-05-26T15:46:04-06:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
I've also tried the following syntaxes:
consul_check_def 'foobar' do
id: 'Web interface',
name: 'Web interface on port 8083',
http: 'http://localhost:8083',
interval: '10s',
timeout: '1s'
notifies :reload, 'service[consul]'
end
consul_check_def 'foobar' do
check(
id: 'Web interface',
name: 'Web interface on port 8083',
http: 'http://localhost:8083',
interval: '10s',
timeout: '1s'
)
notifies :reload, 'service[consul]'
end
Whats the proper way to use the consul_check lwrp?