Skip to content

Commit

Permalink
Fix configuration file mode. Add --sentinel to service command. Use s…
Browse files Browse the repository at this point in the history
…ame template version handling as redis_instance
  • Loading branch information
Miika Kankare committed May 30, 2017
1 parent 6fab2ea commit 8ccb1a3
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions libraries/redis_sentinel.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class RedisSentinel < Chef::Resource
attribute(:config_path, kind_of: String, default: '/etc/redis-sentinel.conf')
# @!attribute config_mode
# @return [String]
attribute(:config_mode, kind_of: String, default: '0440')
attribute(:config_mode, kind_of: String, default: '0740')

# @see: https://github.com/antirez/redis/blob/3.2/sentinel.conf
attribute(:sentinel_port, kind_of: Integer, default: 26_379)
Expand All @@ -62,10 +62,10 @@ class RedisSentinel < Chef::Resource
attribute(:sentinel_client_reconfig, kind_of: [String, NilClass], default: nil)

def default_config_source
if parent.version
"#{parent.version.match(/\d\.\d/).first}/sentinel.conf.erb"
if matches = parent.options.fetch('version', '').match(/\d\.\d/)
"#{matches.first}/sentinel.conf.erb"
else
'sentinel.conf.erb'
'3.2/sentinel.conf.erb'
end
end
end
Expand Down Expand Up @@ -112,7 +112,7 @@ def action_disable

# @api private
def service_options(service)
service.command("#{new_resource.program} #{new_resource.config_path}")
service.command("#{new_resource.program} #{new_resource.config_path} --sentinel")
service.directory(new_resource.directory)
service.user(new_resource.user)
end
Expand Down

0 comments on commit 8ccb1a3

Please sign in to comment.