Skip to content

Commit

Permalink
Fix a few things after converging with kitchen.
Browse files Browse the repository at this point in the history
  • Loading branch information
John Bellone committed Feb 24, 2015
1 parent a90ceea commit 5b8b84c
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 18 deletions.
4 changes: 2 additions & 2 deletions attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
default['consul']['servers'] = []
default['consul']['init_style'] = 'init' # 'init', 'runit'

default['consul']['run_user'] = 'consul'
default['consul']['run_group'] = 'consul'
default['consul']['service_user'] = 'consul'
default['consul']['service_group'] = 'consul'

default['consul']['ports'] = {
'dns' => 8600,
Expand Down
6 changes: 3 additions & 3 deletions libraries/encrypt.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
# Copyright 2014, 2015 Bloomberg Finance L.P.
#
module Consul
module ConsulCookbook
module Encrypt
# TODO: (jbellone) Revisit implementation of these bits prior to
# 1.0 release. Not sure exactly what this is used for.
Expand All @@ -28,5 +28,5 @@ def consul_dbi_key_with_node_default(dbi, key)
end
end

class Chef::Recipe; include Consul::Encrypt; end
class Chef::Resource; include Consul::Encrypt; end
class Chef::Recipe; include ConsulCookbook::Encrypt; end
class Chef::Resource; include ConsulCookbook::Encrypt; end
4 changes: 2 additions & 2 deletions libraries/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ def consul_name
new_resource.instance
end

def parsed_run_group
def self.parsed_run_group
return new_resource.run_group if new_resource.run_group
node['consul']['run_group']
end

def parsed_run_user
def self.parsed_run_user
return new_resource.run_user if new_resource.run_user
node['consul']['run_user']
end
Expand Down
3 changes: 3 additions & 0 deletions libraries/provider_consul_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@
#
# Copyright 2014, 2015 Bloomberg Finance L.P.
#
require_relative 'helpers'

class Chef::Provider::ConsulClient < Chef::Provider::LWRPBase
include ConsulCookbook::Helpers

use_inline_resources if defined?(use_inline_resources)

def whyrun_supported?
Expand Down
2 changes: 1 addition & 1 deletion libraries/provider_consul_client_source.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# Copyright 2014, 2015 Bloomberg Finance L.P.
#

class Chef::Provider::ConsulServiceSource < Chef::Provider::ConsulService
class Chef::Provider::ConsulClientSource < Chef::Provider::ConsulClient
action :create do
include_recipe 'golang::default'

Expand Down
3 changes: 3 additions & 0 deletions libraries/provider_consul_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@
#
# Copyright 2014, 2015 Bloomberg Finance L.P.
#
require_relative 'helpers'

class Chef::Provider::ConsulConfig < Chef::Provider::LWRPBase
include ConsulCookbook::Helpers

use_inline_resources if defined?(use_inline_resources)

def whyrun_supported?
Expand Down
3 changes: 3 additions & 0 deletions libraries/provider_consul_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@
#
# Copyright 2014, 2015 Bloomberg Finance L.P.
#
require_relative 'helpers'

class Chef::Provider::ConsulService < Chef::Provider::LWRPBase
include ConsulCookbook::Helpers

use_inline_resources if defined?(use_inline_resources)

def whyrun_supported?
Expand Down
6 changes: 3 additions & 3 deletions libraries/resource_consul_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class Chef::Resource::ConsulConfig < Chef::Resource::LWRPBase
actions :create, :delete
default_action :create

attribute :config_name, kind_of: String, required: true, name_attribute: true
attribute :path, kind_of: String, name_attribute: true, required: true
attribute :run_user, kind_of: String, required: true, default: nil
attribute :run_group, kind_of: String, required: true, default: nil

Expand All @@ -25,7 +25,7 @@ class Chef::Resource::ConsulConfig < Chef::Resource::LWRPBase
attribute :advertise_addr, kind_of: String, default: nil
attribute :bind_addr, kind_of: String, default: nil
attribute :bootstrap, kind_of: [TrueClass, FalseClass], default: false
attribute :bootstrap_expect, kind_of: Number, default: 3
attribute :bootstrap_expect, kind_of: Integer, default: 3
attribute :ca_file, kind_of: String, default: nil
attribute :cert_file, kind_of: String, default: nil
attribute :check_update_interval, kind_of: String, default: nil
Expand All @@ -47,7 +47,7 @@ class Chef::Resource::ConsulConfig < Chef::Resource::LWRPBase
attribute :ports, kind_of: Hash, default: nil
attribute :protocol, kind_of: String, default: nil
attribute :recursor, kind_of: String, default: nil
attribute :retry_interval, kind_of: Number, default: nil
attribute :retry_interval, kind_of: Integer, default: nil
attribute :server, kind_of: [TrueClass, FalseClass], default: true
attribute :server_name, kind_of: String, default: nil
attribute :skip_leave_on_interrupt, kind_of: [TrueClass, FalseClass], default: false
Expand Down
12 changes: 6 additions & 6 deletions libraries/resource_consul_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ class Chef::Resource::ConsulService < Chef::Resource::LWRPBase
actions :create, :delete, :start, :stop, :restart, :reload
default_action :start

attribute :instance, type: String, name_attribute: true, required: true
attribute :run_user, type: String, default: nil
attribute :run_group, type: String, default: nil
attribute :instance, kind_of: String, name_attribute: true, required: true
attribute :run_user, kind_of: String, default: nil
attribute :run_group, kind_of: String, default: nil

attribute :config_filename, type: String, required: true, default: nil
attribute :config_dir, type: String, required: true, default: nil
attribute :extra_options, type: Array, default: []
attribute :config_filename, kind_of: String, required: true, default: nil
attribute :config_dir, kind_of: String, required: true, default: nil
attribute :extra_options, kind_of: Array, default: []
end
2 changes: 1 addition & 1 deletion recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#

client = consul_client Chef::Consul.install_path(node) do
filename Chef::Consul.remote_filename(node)
path Chef::Consul.remote_filename(node)
url Chef::Consul.remote_url(node)
checksum Chef::Consul.remote_checksum(node)
version node['consul']['version']
Expand Down

0 comments on commit 5b8b84c

Please sign in to comment.