Skip to content

Commit

Permalink
Merge pull request #300 from shortdudey123/fix_travis
Browse files Browse the repository at this point in the history
Fix TravisCI builds
  • Loading branch information
brianbianco authored Oct 25, 2016
2 parents a80931f + 5c2b786 commit d81059b
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 22 deletions.
10 changes: 9 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
AllCops:
DisplayCopNames: true
TargetRubyVersion: 2.1
Exclude:
- '.bundle/**/*'
TargetRubyVersion: 2.3

Lint/PercentStringArray:
Enabled: false

Metrics/AbcSize:
Enabled: false

Metrics/BlockLength:
Enabled: false

Metrics/CyclomaticComplexity:
Enabled: false

Expand All @@ -30,6 +35,9 @@ Metrics/PerceivedComplexity:
Style/Documentation:
Enabled: false

Style/FrozenStringLiteralComment:
Enabled: false

Style/LeadingCommentSpace:
Enabled: true
Exclude:
Expand Down
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,7 @@ sudo: false
branches:
only:
- master
bundler_args: --without=integration
bundler_args: --without=integration --path=.bundle
script:
- bundle exec rake style
- bundle exec rake spec
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ source 'https://rubygems.org'
# end

group :testing do
gem 'berkshelf'
gem 'chefspec'
gem 'foodcritic'
gem 'rake'
gem 'rubocop'
end

group :integration do
gem 'berkshelf'
gem 'busser-serverspec'
gem 'kitchen-vagrant'
gem 'serverspec'
Expand Down
14 changes: 7 additions & 7 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,6 @@ end
desc 'Run all style checks'
task style: ['style:chef', 'style:ruby']

require 'kitchen'
desc 'Run Test Kitchen integration tests'
task :integration do
Kitchen.logger = Kitchen.default_file_logger
sh 'kitchen test -c'
end

desc 'Destroy test kitchen instances'
task :destroy do
Kitchen.logger = Kitchen.default_file_logger
Expand All @@ -59,6 +52,13 @@ task default: [:style, :spec, :integration]
begin
require 'kitchen/rake_tasks'
Kitchen::RakeTasks.new

require 'kitchen'
desc 'Run Test Kitchen integration tests'
task :integration do
Kitchen.logger = Kitchen.default_file_logger
sh 'kitchen test -c'
end
rescue LoadError
puts '>>>>> Kitchen gem not loaded, omitting tasks' unless ENV['CI']
end
2 changes: 1 addition & 1 deletion providers/configure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def configure
maxmemory = (node_memory_kb * 1024 * percent_factor / new_resource.servers.length).round.to_s
end

descriptors = if current['ulimit'] == 0
descriptors = if current['ulimit'].zero?
current['maxclients'] + 32
elsif current['ulimit'] > current['maxclients']
current['ulimit']
Expand Down
10 changes: 5 additions & 5 deletions providers/sentinel.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,10 @@ def configure
master_ip: current['master_ip'] || current[:masterip],
master_port: current['master_port'] || current[:masterport],
quorum_count: current['quorum_count'] || current[:quorum_count],
:'auth-pass' => current['auth-pass'] || current[:authpass],
:'down-after-milliseconds' => current['down-after-milliseconds'] || current[:downaftermil],
:'parallel-syncs' => current['parallel-syncs'] || current[:parallelsyncs],
:'failover-timeout' => current['failover-timeout'] || current[:failovertimeout]
auth_pass: current['auth-pass'] || current[:authpass],
down_after_milliseconds: current['down-after-milliseconds'] || current[:downaftermil],
parallel_syncs: current['parallel-syncs'] || current[:parallelsyncs],
failover_timeout: current['failover-timeout'] || current[:failovertimeout]
}
]
else
Expand All @@ -119,7 +119,7 @@ def configure
if current['data_bag_name'] && current['data_bag_item'] && current['data_bag_key']
bag = Chef::EncryptedDataBagItem.load(current['data_bag_name'], current['data_bag_item'])
masters.each do |master|
master['auth-pass'] = bag[current['data_bag_key']]
master['auth_pass'] = bag[current['data_bag_key']]
end
end

Expand Down
4 changes: 2 additions & 2 deletions resources/configure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
attribute :user, kind_of: String, default: 'redis'
attribute :group, kind_of: String, default: 'redis'

attribute :default_settings, kind_of: Hash
attribute :servers, kind_of: Array
attribute :default_settings, kind_of: Hash
attribute :servers, kind_of: Array

def initialize(name, run_context = nil)
super
Expand Down
8 changes: 4 additions & 4 deletions templates/default/sentinel.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ port <%=@sentinel_port%>
# sentinel auth-pass mymaster MySUPER--secret-0123passw0rd
<% @masters.each do |current| %>
<% calc_name = String(current['master_name'] || @name || 'master_name') %>
<%= "sentinel auth-pass #{calc_name} #{current['auth-pass']}" unless current['auth-pass'].nil? %>
<%= "sentinel auth-pass #{calc_name} #{current['auth_pass']}" unless current['auth_pass'].nil? %>
<% end %>
# sentinel down-after-milliseconds <master-name> <milliseconds>
#
Expand All @@ -83,7 +83,7 @@ port <%=@sentinel_port%>
# Default is 30 seconds.
<% @masters.each do |current| %>
<% calc_name = String(current['master_name'] || @name || 'master_name') %>
<%= "sentinel down-after-milliseconds #{calc_name} #{current['down-after-milliseconds']}" unless current['down-after-milliseconds'].nil? %>
<%= "sentinel down-after-milliseconds #{calc_name} #{current['down_after_milliseconds']}" unless current['down_after_milliseconds'].nil? %>
<% end %>
# sentinel parallel-syncs <master-name> <numslaves>
#
Expand All @@ -93,7 +93,7 @@ port <%=@sentinel_port%>
# time while performing the synchronization with the master.
<% @masters.each do |current| %>
<% calc_name = String(current['master_name'] || @name || 'master_name') %>
<%= "sentinel parallel-syncs #{calc_name} #{current['parallel-syncs']}" unless current['parallel-syncs'].nil? %>
<%= "sentinel parallel-syncs #{calc_name} #{current['parallel_syncs']}" unless current['parallel_syncs'].nil? %>
<% end %>
# sentinel failover-timeout <master-name> <milliseconds>
#
Expand All @@ -111,7 +111,7 @@ port <%=@sentinel_port%>
# Default is 15 minutes.
<% @masters.each do |current| %>
<% calc_name = String(current['master_name'] || @name || 'master_name') %>
<%= "sentinel failover-timeout #{calc_name} #{current['failover-timeout']}" unless current['failover-timeout'].nil? %>
<%= "sentinel failover-timeout #{calc_name} #{current['failover_timeout']}" unless current['failover_timeout'].nil? %>
<% end %>
# SCRIPTS EXECUTION
#
Expand Down

0 comments on commit d81059b

Please sign in to comment.