Skip to content

Commit

Permalink
Fix rubocop deprecated conf
Browse files Browse the repository at this point in the history
Fix rubocop version in Gemfile
  • Loading branch information
guilhem committed Jun 2, 2016
1 parent 9a33b15 commit 7f61b5e
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 67 deletions.
4 changes: 2 additions & 2 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ MethodLength:
Enabled: false
SignalException:
Enabled: false
TrailingComma:
Enabled: false
WordArray:
Enabled: false
Metrics/AbcSize:
Enabled: false
Metrics/PerceivedComplexity:
Enabled: false
ConditionalAssignment:
Enabled: false
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ sudo: false
cache: bundler
bundler_args: --without kitchen_common kitchen_vagrant
rvm:
- 2.0
- 2.1
- 2.2
script:
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ source 'https://rubygems.org'

group :lint do
gem 'foodcritic', '~> 4.0'
gem 'rubocop', '~> 0.33'
gem 'rubocop', '~> 0.40.0'
end

group :unit do
Expand Down
17 changes: 8 additions & 9 deletions libraries/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ def ip_address_to_ceph_address(ip, params)
elsif params['family'].eql?('inet6')
return "[#{ip}]:6789"
end
return nil
end

def mon_addresses
Expand All @@ -110,15 +111,13 @@ def mon_addresses
mons << node if node['ceph']['is_mon']

mons += mon_nodes
if crowbar?
mon_ips = mons.map { |node| Chef::Recipe::Barclamp::Inventory.get_network_by_type(node, 'admin').address }
else
if node['ceph']['config']['global'] && node['ceph']['config']['global']['public network']
mon_ips = mons.map { |nodeish| find_node_ip_in_network(node['ceph']['config']['global']['public network'], nodeish) }
else
mon_ips = mons.map { |node| node['ipaddress'] + ':6789' }
end
end
mon_ips = if crowbar?
mons.map { |node| Chef::Recipe::Barclamp::Inventory.get_network_by_type(node, 'admin').address }
elsif node['ceph']['config']['global'] && node['ceph']['config']['global']['public network']
mons.map { |nodeish| find_node_ip_in_network(node['ceph']['config']['global']['public network'], nodeish) }
else
mons.map { |node| node['ipaddress'] + ':6789' }
end
end
mon_ips.reject(&:nil?).uniq
end
Expand Down
2 changes: 1 addition & 1 deletion providers/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def load_current_resource
@current_resource.key(get_key(@current_resource.keyname))
@current_resource.caps_match = @current_resource.caps == @new_resource.caps
@current_resource.keys_match = @new_resource.key.nil? || (@current_resource.key == @new_resource.key)
@current_resource.exists = ! (@current_resource.key.nil? || @current_resource.key.empty?)
@current_resource.exists = !(@current_resource.key.nil? || @current_resource.key.empty?)
end

def file_content(keyname, key, as_keyring)
Expand Down
8 changes: 4 additions & 4 deletions recipes/apt.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
branch = node['ceph']['branch']

distribution_codename =
case node['lsb']['codename']
when 'jessie' then 'sid'
else node['lsb']['codename']
end
case node['lsb']['codename']
when 'jessie' then 'sid'
else node['lsb']['codename']
end

apt_preference 'ceph_repo' do
glob '*'
Expand Down
91 changes: 45 additions & 46 deletions recipes/osd.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
command 'udevadm trigger --subsystem-match=block --action=add'
action :nothing
end
else

# Calling ceph-disk-prepare is sufficient for deploying an OSD
# After ceph-disk-prepare finishes, the new device will be caught
# by udev which will run ceph-disk-activate on it (udev will map
Expand All @@ -91,60 +91,59 @@
# osd/$cluster-$id)
# - $cluster should always be ceph
# - The --dmcrypt option will be available starting w/ Cuttlefish
if node['ceph']['osd_devices']
devices = node['ceph']['osd_devices']
elsif node['ceph']['osd_devices']
devices = node['ceph']['osd_devices']

devices = Hash[(0...devices.size).zip devices] unless devices.is_a? Hash
devices = Hash[(0...devices.size).zip devices] unless devices.is_a? Hash

devices.each do |index, osd_device|
unless osd_device['status'].nil?
Log.info("osd: osd_device #{osd_device} has already been setup.")
next
end
devices.each do |index, osd_device|
unless osd_device['status'].nil?
Log.info("osd: osd_device #{osd_device} has already been setup.")
next
end

directory osd_device['device'] do # ~FC022
owner 'root'
group 'root'
recursive true
only_if { osd_device['type'] == 'directory' }
end
directory osd_device['device'] do # ~FC022
owner 'root'
group 'root'
recursive true
only_if { osd_device['type'] == 'directory' }
end

dmcrypt = osd_device['encrypted'] == true ? '--dmcrypt' : ''
dmcrypt = osd_device['encrypted'] == true ? '--dmcrypt' : ''

execute "ceph-disk-prepare on #{osd_device['device']}" do
command "ceph-disk-prepare #{dmcrypt} #{osd_device['device']} #{osd_device['journal']}"
action :run
notifies :create, "ruby_block[save osd_device status #{index}]", :immediately
end
execute "ceph-disk-prepare on #{osd_device['device']}" do
command "ceph-disk-prepare #{dmcrypt} #{osd_device['device']} #{osd_device['journal']}"
action :run
notifies :create, "ruby_block[save osd_device status #{index}]", :immediately
end

execute "ceph-disk-activate #{osd_device['device']}" do
only_if { osd_device['type'] == 'directory' }
end
execute "ceph-disk-activate #{osd_device['device']}" do
only_if { osd_device['type'] == 'directory' }
end

# we add this status to the node env
# so that we can implement recreate
# and/or delete functionalities in the
# future.
ruby_block "save osd_device status #{index}" do
block do
node.normal['ceph']['osd_devices'][index]['status'] = 'deployed'
node.save
end
action :nothing
# we add this status to the node env
# so that we can implement recreate
# and/or delete functionalities in the
# future.
ruby_block "save osd_device status #{index}" do
block do
node.normal['ceph']['osd_devices'][index]['status'] = 'deployed'
node.save
end
action :nothing
end
service 'ceph_osd' do
case service_type
when 'upstart'
service_name 'ceph-osd-all-starter'
provider Chef::Provider::Service::Upstart
else
service_name 'ceph'
end
action [:enable, :start]
supports :restart => true
end
service 'ceph_osd' do
case service_type
when 'upstart'
service_name 'ceph-osd-all-starter'
provider Chef::Provider::Service::Upstart
else
service_name 'ceph'
end
else
Log.info('node["ceph"]["osd_devices"] empty')
action [:enable, :start]
supports :restart => true
end
else
Log.info('node["ceph"]["osd_devices"] empty')
end
4 changes: 1 addition & 3 deletions recipes/tgt.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,8 @@
if node['platform'] == 'ubuntu'
# The ceph version of tgt does not provide an Upstart script
provider Chef::Provider::Service::Init::Debian
service_name 'tgt'
else
service_name 'tgt'
end
service_name 'tgt'
supports :restart => true
action [:enable, :start]
end

0 comments on commit 7f61b5e

Please sign in to comment.