diff --git a/recipes/apt.rb b/recipes/apt.rb index bc82276..67c5819 100644 --- a/recipes/apt.rb +++ b/recipes/apt.rb @@ -24,7 +24,7 @@ if node['roles'].include?("ceph-radosgw") \ && node["ceph"]["radosgw"]["webserver_companion"] == "apache2" \ && node["ceph"]["radosgw"]["use_apache_fork"] == true case node['lsb']['codename'] - when "precise","oneiric" + when "precise", "oneiric" apt_repository "ceph-apache2" do repo_name "ceph-apache2" uri "http://gitbuilder.ceph.com/apache2-deb-#{node['lsb']['codename']}-x86_64-basic/ref/master" diff --git a/recipes/cephfs.rb b/recipes/cephfs.rb index d4d5862..3bd6839 100644 --- a/recipes/cephfs.rb +++ b/recipes/cephfs.rb @@ -29,17 +29,16 @@ ceph_client name do as_keyring false end -mons = get_mon_addresses() -mons = mons.join(",") -mons = mons + ":/" -if not mons.empty? - directory node['ceph']['cephfs_mount'] - mount node['ceph']['cephfs_mount'] do - fstype "ceph" - device mons - options "_netdev,name=#{client_name},secretfile=#{filename}" - dump 0 - pass 0 - action [:mount, :enable] - end +mons = get_mon_addresses.join(",") + ":/" + +directory node['ceph']['cephfs_mount'] + +mount node['ceph']['cephfs_mount'] do + fstype "ceph" + device mons + options "_netdev,name=#{client_name},secretfile=#{filename}" + dump 0 + pass 0 + action [:mount, :enable] + not_if { mons.empty? } end diff --git a/recipes/conf.rb b/recipes/conf.rb index 0906328..e090da5 100644 --- a/recipes/conf.rb +++ b/recipes/conf.rb @@ -1,12 +1,9 @@ -raise "fsid must be set in config" if node["ceph"]["config"]['fsid'].nil? -raise "mon_initial_members must be set in config" if node["ceph"]["config"]['mon_initial_members'].nil? +fail "fsid must be set in config" if node["ceph"]["config"]['fsid'].nil? +fail "mon_initial_members must be set in config" if node["ceph"]["config"]['mon_initial_members'].nil? -mon_addresses = get_mon_addresses() +mon_addresses = get_mon_addresses -is_rgw = false -if node['roles'].include? 'ceph-radosgw' - is_rgw = true -end +is_rgw = node['roles'].include?('ceph-radosgw') directory "/etc/ceph" do owner "root" diff --git a/recipes/mds.rb b/recipes/mds.rb index 76816ba..e9a5765 100644 --- a/recipes/mds.rb +++ b/recipes/mds.rb @@ -16,5 +16,5 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - + include_recipe "ceph::default" diff --git a/recipes/osd.rb b/recipes/osd.rb index 6bd8412..e66a02a 100644 --- a/recipes/osd.rb +++ b/recipes/osd.rb @@ -20,7 +20,7 @@ # this recipe allows bootstrapping new osds, with help from mon # Sample environment: # #knife node edit ceph1 -#"osd_devices": [ +# "osd_devices": [ # { # "device": "/dev/sdc" # }, @@ -29,7 +29,7 @@ # "dmcrypt": true, # "journal": "/dev/sdd" # } -#] +# ] include_recipe "ceph::default" include_recipe "ceph::conf" @@ -38,16 +38,15 @@ package 'gdisk' do action :upgrade end -if !search(:node,"hostname:#{node['hostname']} AND dmcrypt:true").empty? - package 'cryptsetup' do - action :upgrade - end +package 'cryptsetup' do + action :upgrade + not_if { search(:node,"hostname:#{node['hostname']} AND dmcrypt:true").empty? } end service_type = node["ceph"]["osd"]["init_style"] mons = node['ceph']['encrypted_data_bags'] ? get_mon_nodes : get_mon_nodes("ceph_bootstrap_osd_key:*") -if mons.empty? then +if mons.empty? puts "No ceph-mon found." else @@ -57,7 +56,7 @@ else mode "0755" end - # TODO cluster name + # TODO: cluster name cluster = 'ceph' osd_secret = if node['ceph']['encrypted_data_bags'] diff --git a/recipes/radosgw_apache2.rb b/recipes/radosgw_apache2.rb index 080c377..53c1bcb 100644 --- a/recipes/radosgw_apache2.rb +++ b/recipes/radosgw_apache2.rb @@ -18,12 +18,12 @@ # limitations under the License. case node['platform_family'] -when "debian","suse" +when "debian", "suse" packages = %w{ apache2 libapache2-mod-fastcgi } -when "rhel","fedora" +when "rhel", "fedora" packages = %w{ httpd mod_fastcgi diff --git a/recipes/repo.rb b/recipes/repo.rb index 3f50c17..dbdf4fd 100644 --- a/recipes/repo.rb +++ b/recipes/repo.rb @@ -4,5 +4,5 @@ when "debian" when "rhel", "suse" include_recipe "ceph::rpm" else - raise "not supported" + fail "not supported" end diff --git a/resources/client.rb b/resources/client.rb index c1b2283..26d8995 100644 --- a/resources/client.rb +++ b/resources/client.rb @@ -2,10 +2,10 @@ actions :add default_action :add attribute :name, :kind_of => String, :name_attribute => true -attribute :caps, :kind_of => Hash, :default => {"mon"=>"allow r", "osd"=>"allow r"} +attribute :caps, :kind_of => Hash, :default => {"mon" => "allow r", "osd" => "allow r"} # Whether to store the secret in a keyring file or a plain secret file -attribute :as_keyring, :kind_of => [TrueClass,FalseClass], :default => true +attribute :as_keyring, :kind_of => [TrueClass, FalseClass], :default => true # what the key should be called in the ceph cluster # defaults to client.#{name}.#{hostname}