Normalizing this cookbook
This cookbook needed to be brought up to the standard of the other cookbooks in the repo. * Adding .gitreview * Normalizing .rubocop.yml * Normalizing Gemfile * Normalizing metadata.rb * Normalizing .gitignore * Adding specs/ directory and spec_helper.rb * Fixed all rubocop errors Change-Id: Ica7c525aae5fbd5c441ce50cff36046c678046d6 Partial-Bug: 1348243
This commit is contained in:
parent
44e536f752
commit
899ec191c9
21
.gitignore
vendored
21
.gitignore
vendored
@ -1,17 +1,8 @@
|
||||
.vagrant
|
||||
Berksfile.lock
|
||||
*~
|
||||
*#
|
||||
.#*
|
||||
\#*#
|
||||
.*.sw[a-z]
|
||||
*.un~
|
||||
/cookbooks
|
||||
|
||||
# Bundler
|
||||
Gemfile.lock
|
||||
bin/*
|
||||
.bundle/*
|
||||
|
||||
.bundle/
|
||||
.cookbooks/
|
||||
.kitchen/
|
||||
.kitchen.local.yml
|
||||
.vagrant/
|
||||
.coverage/
|
||||
Berksfile.lock
|
||||
Vagrantfile
|
||||
|
4
.gitreview
Normal file
4
.gitreview
Normal file
@ -0,0 +1,4 @@
|
||||
[gerrit]
|
||||
host=review.openstack.org
|
||||
port=29418
|
||||
project=stackforge/cookbook-ceph.git
|
36
.rubocop.yml
36
.rubocop.yml
@ -1,28 +1,24 @@
|
||||
AllCops:
|
||||
Includes:
|
||||
- Berksfile
|
||||
- metadata.rb
|
||||
- Gemfile
|
||||
- Rakefile
|
||||
- Thorfile
|
||||
- Guardfile
|
||||
Excludes:
|
||||
- vendor/**
|
||||
- attributes/**
|
||||
- libraries/**
|
||||
- providers/**
|
||||
- recipes/**
|
||||
- resources/**
|
||||
- spec/**
|
||||
|
||||
ClassLength:
|
||||
Enabled: false
|
||||
Documentation:
|
||||
Enabled: false
|
||||
Encoding:
|
||||
Exclude:
|
||||
- metadata.rb
|
||||
- Gemfile
|
||||
|
||||
NumericLiterals:
|
||||
Enabled: false
|
||||
HashSyntax:
|
||||
Enabled: false
|
||||
|
||||
LineLength:
|
||||
Enabled: false
|
||||
MethodLength:
|
||||
Enabled: false
|
||||
SignalException:
|
||||
Enabled: false
|
||||
TrailingComma:
|
||||
Enabled: false
|
||||
Enabled: False
|
||||
|
||||
WordArray:
|
||||
Enabled: false
|
||||
MinSize: 3
|
||||
|
14
Gemfile
14
Gemfile
@ -1,12 +1,12 @@
|
||||
source 'https://rubygems.org'
|
||||
|
||||
gem 'chef', '~> 11'
|
||||
gem 'berkshelf', '~> 2.0.10'
|
||||
|
||||
group :test do
|
||||
gem 'foodcritic', '~> 3.0'
|
||||
gem 'rubocop'
|
||||
end
|
||||
gem 'chef', '~> 11.8'
|
||||
gem 'berkshelf', '~> 2.0.18'
|
||||
gem 'chefspec', '~> 3.4.0'
|
||||
gem 'rspec', '~> 2.14.1'
|
||||
gem 'foodcritic', '~> 3.0.3'
|
||||
gem 'strainer'
|
||||
gem 'rubocop', '~> 0.18.1'
|
||||
|
||||
group :integration do
|
||||
gem 'test-kitchen', '~> 1.1.1'
|
||||
|
245
Gemfile.lock
Normal file
245
Gemfile.lock
Normal file
@ -0,0 +1,245 @@
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
activesupport (3.2.19)
|
||||
i18n (~> 0.6, >= 0.6.4)
|
||||
multi_json (~> 1.0)
|
||||
addressable (2.3.6)
|
||||
akami (1.2.2)
|
||||
gyoku (>= 0.4.0)
|
||||
nokogiri
|
||||
ast (2.0.0)
|
||||
berkshelf (2.0.18)
|
||||
activesupport (~> 3.2.0)
|
||||
addressable (~> 2.3.4)
|
||||
buff-shell_out (~> 0.1)
|
||||
chozo (>= 0.6.1)
|
||||
faraday (~> 0.8.5)
|
||||
hashie (~> 2.0)
|
||||
minitar (~> 0.5.4)
|
||||
rbzip2 (~> 0.2.0)
|
||||
retryable (~> 1.3.3)
|
||||
ridley (~> 1.7.0)
|
||||
solve (~> 0.8.2)
|
||||
thor (~> 0.18.0)
|
||||
buff-config (0.4.0)
|
||||
buff-extensions (~> 0.3)
|
||||
varia_model (~> 0.1)
|
||||
buff-extensions (0.5.0)
|
||||
buff-ignore (1.1.1)
|
||||
buff-platform (0.1.0)
|
||||
buff-ruby_engine (0.1.0)
|
||||
buff-shell_out (0.1.1)
|
||||
buff-ruby_engine (~> 0.1.0)
|
||||
builder (3.2.2)
|
||||
celluloid (0.15.2)
|
||||
timers (~> 1.1.0)
|
||||
celluloid-io (0.15.0)
|
||||
celluloid (>= 0.15.0)
|
||||
nio4r (>= 0.5.0)
|
||||
chef (11.12.8)
|
||||
chef-zero (>= 2.0.2, < 2.1)
|
||||
diff-lcs (~> 1.2, >= 1.2.4)
|
||||
erubis (~> 2.7)
|
||||
highline (~> 1.6, >= 1.6.9)
|
||||
json (>= 1.4.4, <= 1.8.1)
|
||||
mime-types (~> 1.16)
|
||||
mixlib-authentication (~> 1.3)
|
||||
mixlib-cli (~> 1.4)
|
||||
mixlib-config (~> 2.0)
|
||||
mixlib-log (~> 1.3)
|
||||
mixlib-shellout (~> 1.4)
|
||||
net-ssh (~> 2.6)
|
||||
net-ssh-multi (~> 1.1)
|
||||
ohai (~> 7.0.4)
|
||||
pry (~> 0.9)
|
||||
rest-client (>= 1.0.4, < 1.7.0)
|
||||
yajl-ruby (~> 1.1)
|
||||
chef-zero (2.0.2)
|
||||
hashie (~> 2.0)
|
||||
json
|
||||
mixlib-log (~> 1.3)
|
||||
rack
|
||||
chefspec (3.4.0)
|
||||
chef (~> 11.0)
|
||||
fauxhai (~> 2.0)
|
||||
rspec (~> 2.14)
|
||||
chozo (0.6.1)
|
||||
activesupport (>= 3.2.0)
|
||||
hashie (>= 2.0.2)
|
||||
multi_json (>= 1.3.0)
|
||||
coderay (1.1.0)
|
||||
diff-lcs (1.2.5)
|
||||
erubis (2.7.0)
|
||||
faraday (0.8.9)
|
||||
multipart-post (~> 1.2.0)
|
||||
fauxhai (2.2.0)
|
||||
net-ssh
|
||||
ohai
|
||||
ffi (1.9.3)
|
||||
foodcritic (3.0.3)
|
||||
erubis
|
||||
gherkin (~> 2.11.7)
|
||||
nokogiri (~> 1.5.4)
|
||||
rake
|
||||
treetop (~> 1.4.10)
|
||||
yajl-ruby (~> 1.1.0)
|
||||
gherkin (2.11.8)
|
||||
multi_json (~> 1.3)
|
||||
gssapi (1.0.3)
|
||||
ffi (>= 1.0.1)
|
||||
gyoku (1.1.1)
|
||||
builder (>= 2.1.2)
|
||||
hashie (2.1.2)
|
||||
highline (1.6.21)
|
||||
httpclient (2.4.0)
|
||||
httpi (0.9.7)
|
||||
rack
|
||||
i18n (0.6.11)
|
||||
ipaddress (0.8.0)
|
||||
json (1.8.1)
|
||||
kitchen-vagrant (0.15.0)
|
||||
test-kitchen (~> 1.0)
|
||||
little-plugger (1.1.3)
|
||||
logging (1.8.2)
|
||||
little-plugger (>= 1.1.3)
|
||||
multi_json (>= 1.8.4)
|
||||
method_source (0.8.2)
|
||||
mime-types (1.25.1)
|
||||
minitar (0.5.4)
|
||||
mixlib-authentication (1.3.0)
|
||||
mixlib-log
|
||||
mixlib-cli (1.5.0)
|
||||
mixlib-config (2.1.0)
|
||||
mixlib-log (1.6.0)
|
||||
mixlib-shellout (1.4.0)
|
||||
multi_json (1.10.1)
|
||||
multipart-post (1.2.0)
|
||||
net-http-persistent (2.9.4)
|
||||
net-scp (1.2.1)
|
||||
net-ssh (>= 2.6.5)
|
||||
net-ssh (2.9.1)
|
||||
net-ssh-gateway (1.2.0)
|
||||
net-ssh (>= 2.6.5)
|
||||
net-ssh-multi (1.2.0)
|
||||
net-ssh (>= 2.6.5)
|
||||
net-ssh-gateway (>= 1.2.0)
|
||||
nio4r (1.0.0)
|
||||
nokogiri (1.5.11)
|
||||
nori (1.1.5)
|
||||
ohai (7.0.4)
|
||||
ipaddress
|
||||
mime-types (~> 1.16)
|
||||
mixlib-cli
|
||||
mixlib-config (~> 2.0)
|
||||
mixlib-log
|
||||
mixlib-shellout (~> 1.2)
|
||||
systemu (~> 2.5.2)
|
||||
yajl-ruby
|
||||
parser (2.1.9)
|
||||
ast (>= 1.1, < 3.0)
|
||||
slop (~> 3.4, >= 3.4.5)
|
||||
polyglot (0.3.5)
|
||||
powerpack (0.0.9)
|
||||
pry (0.10.0)
|
||||
coderay (~> 1.1.0)
|
||||
method_source (~> 0.8.1)
|
||||
slop (~> 3.4)
|
||||
rack (1.5.2)
|
||||
rainbow (2.0.0)
|
||||
rake (10.3.2)
|
||||
rbzip2 (0.2.0)
|
||||
rdoc (4.1.1)
|
||||
json (~> 1.4)
|
||||
rest-client (1.6.8)
|
||||
mime-types (~> 1.16)
|
||||
rdoc (>= 2.4.2)
|
||||
retryable (1.3.5)
|
||||
ridley (1.7.1)
|
||||
addressable
|
||||
buff-config (~> 0.2)
|
||||
buff-extensions (~> 0.3)
|
||||
buff-ignore (~> 1.1)
|
||||
buff-shell_out (~> 0.1)
|
||||
celluloid (~> 0.15)
|
||||
celluloid-io (~> 0.15)
|
||||
erubis
|
||||
faraday (>= 0.8.4)
|
||||
hashie (>= 2.0.2)
|
||||
json (>= 1.7.7)
|
||||
mixlib-authentication (>= 1.3.0)
|
||||
net-http-persistent (>= 2.8)
|
||||
net-ssh
|
||||
retryable
|
||||
solve (>= 0.4.4)
|
||||
varia_model (~> 0.1)
|
||||
winrm (~> 1.1.0)
|
||||
rspec (2.14.1)
|
||||
rspec-core (~> 2.14.0)
|
||||
rspec-expectations (~> 2.14.0)
|
||||
rspec-mocks (~> 2.14.0)
|
||||
rspec-core (2.14.8)
|
||||
rspec-expectations (2.14.5)
|
||||
diff-lcs (>= 1.1.3, < 2.0)
|
||||
rspec-mocks (2.14.6)
|
||||
rubocop (0.18.1)
|
||||
json (>= 1.7.7, < 2)
|
||||
parser (~> 2.1.3)
|
||||
powerpack (~> 0.0.6)
|
||||
rainbow (>= 1.99.1, < 3.0)
|
||||
rubyntlm (0.1.1)
|
||||
safe_yaml (0.9.7)
|
||||
savon (0.9.5)
|
||||
akami (~> 1.0)
|
||||
builder (>= 2.1.2)
|
||||
gyoku (>= 0.4.0)
|
||||
httpi (~> 0.9)
|
||||
nokogiri (>= 1.4.0)
|
||||
nori (~> 1.0)
|
||||
wasabi (~> 1.0)
|
||||
slop (3.6.0)
|
||||
solve (0.8.2)
|
||||
strainer (3.4.0)
|
||||
berkshelf (>= 2.0, < 4.0)
|
||||
buff-platform (~> 0.1)
|
||||
systemu (2.5.2)
|
||||
test-kitchen (1.1.1)
|
||||
mixlib-shellout (~> 1.2)
|
||||
net-scp (~> 1.1)
|
||||
net-ssh (~> 2.7)
|
||||
safe_yaml (~> 0.9)
|
||||
thor (~> 0.18)
|
||||
thor (0.18.1)
|
||||
timers (1.1.0)
|
||||
treetop (1.4.15)
|
||||
polyglot
|
||||
polyglot (>= 0.3.1)
|
||||
uuidtools (2.1.4)
|
||||
varia_model (0.3.2)
|
||||
buff-extensions (~> 0.2)
|
||||
hashie (>= 2.0.2)
|
||||
wasabi (1.0.0)
|
||||
nokogiri (>= 1.4.0)
|
||||
winrm (1.1.3)
|
||||
gssapi (~> 1.0.0)
|
||||
httpclient (~> 2.2, >= 2.2.0.2)
|
||||
logging (~> 1.6, >= 1.6.1)
|
||||
nokogiri (~> 1.5)
|
||||
rubyntlm (~> 0.1.1)
|
||||
savon (= 0.9.5)
|
||||
uuidtools (~> 2.1.2)
|
||||
yajl-ruby (1.1.0)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
berkshelf (~> 2.0.18)
|
||||
chef (~> 11.8)
|
||||
chefspec (~> 3.4.0)
|
||||
foodcritic (~> 3.0.3)
|
||||
kitchen-vagrant (~> 0.14)
|
||||
rspec (~> 2.14.1)
|
||||
rubocop (~> 0.18.1)
|
||||
strainer
|
||||
test-kitchen (~> 1.1.1)
|
@ -1 +1,3 @@
|
||||
# encoding: UTF-8
|
||||
|
||||
default['ceph']['cephfs_mount'] = '/ceph'
|
||||
|
@ -1,2 +1,4 @@
|
||||
# encoding: UTF-8
|
||||
|
||||
default['ceph']['config'] = {}
|
||||
default['ceph']['config-sections'] = {}
|
||||
|
@ -1,2 +1,4 @@
|
||||
# encoding: UTF-8
|
||||
|
||||
default['ceph']['install_debug'] = true
|
||||
default['ceph']['encrypted_data_bags'] = false
|
||||
|
@ -1,3 +1,5 @@
|
||||
# encoding: UTF-8
|
||||
|
||||
case node['platform']
|
||||
when 'ubuntu'
|
||||
default['ceph']['mds']['init_style'] = 'upstart'
|
||||
|
@ -1,3 +1,5 @@
|
||||
# encoding: UTF-8
|
||||
|
||||
case node['platform']
|
||||
when 'ubuntu'
|
||||
default['ceph']['mon']['init_style'] = 'upstart'
|
||||
|
@ -1,3 +1,5 @@
|
||||
# encoding: UTF-8
|
||||
|
||||
case node['platform']
|
||||
when 'ubuntu'
|
||||
default['ceph']['osd']['init_style'] = 'upstart'
|
||||
|
@ -1,3 +1,4 @@
|
||||
# encoding: UTF-8
|
||||
#
|
||||
# Cookbook Name:: ceph
|
||||
# Attributes:: radosgw
|
||||
|
@ -1,3 +1,5 @@
|
||||
# encoding: UTF-8
|
||||
|
||||
default['ceph']['branch'] = 'stable' # Can be stable, testing or dev.
|
||||
# Major release version to install or gitbuilder branch
|
||||
default['ceph']['version'] = 'dumpling'
|
||||
|
@ -1,3 +1,5 @@
|
||||
# encoding: UTF-8
|
||||
|
||||
require 'ipaddr'
|
||||
require 'json'
|
||||
|
||||
@ -5,7 +7,7 @@ def crowbar?
|
||||
!defined?(Chef::Recipe::Barclamp).nil?
|
||||
end
|
||||
|
||||
def get_mon_nodes(extra_search = nil)
|
||||
def get_mon_nodes(extra_search = nil) # rubocop:disable MethodLength
|
||||
if crowbar?
|
||||
mon_roles = search(:role, 'name:crowbar-* AND run_list:role\[ceph-mon\]')
|
||||
unless mon_roles.empty?
|
||||
@ -28,7 +30,7 @@ end
|
||||
# 1. We look if the network is IPv6 or IPv4
|
||||
# 2. We look for a route matching the network
|
||||
# 3. We grab the IP and return it with the port
|
||||
def find_node_ip_in_network(network, nodeish = nil)
|
||||
def find_node_ip_in_network(network, nodeish = nil) # rubocop:disable MethodLength
|
||||
nodeish = node unless nodeish
|
||||
net = IPAddr.new(network)
|
||||
nodeish['network']['interfaces'].each do |iface, addrs|
|
||||
@ -43,7 +45,7 @@ def find_node_ip_in_network(network, nodeish = nil)
|
||||
nil
|
||||
end
|
||||
|
||||
def mon_addresses
|
||||
def mon_addresses # rubocop:disable MethodLength
|
||||
mon_ips = []
|
||||
|
||||
if File.exist?("/var/run/ceph/ceph-mon.#{node['hostname']}.asok")
|
||||
|
22
metadata.rb
22
metadata.rb
@ -1,12 +1,12 @@
|
||||
name 'ceph'
|
||||
maintainer 'Kyle Bader'
|
||||
maintainer_email 'kyle.bader@dreamhost.com'
|
||||
license 'Apache 2.0'
|
||||
description 'Installs/Configures the Ceph distributed filesystem'
|
||||
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
|
||||
version '0.2.1'
|
||||
name 'ceph'
|
||||
maintainer 'Kyle Bader'
|
||||
maintainer_email 'kyle.bader@dreamhost.com'
|
||||
license 'Apache 2.0'
|
||||
description 'Installs/Configures the Ceph distributed filesystem'
|
||||
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
|
||||
version '0.2.1'
|
||||
|
||||
depends 'apache2', '>= 1.1.12'
|
||||
depends 'apt'
|
||||
depends 'yum', '>= 3.0'
|
||||
depends 'yum-epel'
|
||||
depends 'apache2', '>= 1.1.12'
|
||||
depends 'apt'
|
||||
depends 'yum', '>= 3.0'
|
||||
depends 'yum-epel'
|
||||
|
@ -1,3 +1,5 @@
|
||||
# encoding: UTF-8
|
||||
|
||||
use_inline_resources
|
||||
|
||||
def whyrun_supported?
|
||||
@ -28,7 +30,7 @@ def load_current_resource
|
||||
@current_resource.as_keyring(@new_resource.as_keyring)
|
||||
@current_resource.keyname(@new_resource.keyname || "client.#{current_resource.name}.#{node['hostname']}")
|
||||
@current_resource.caps(get_caps(@current_resource.keyname))
|
||||
default_filename = "/etc/ceph/ceph.client.#{@new_resource.name}.#{node['hostname']}.#{@new_resource.as_keyring ? "keyring" : "secret"}"
|
||||
default_filename = "/etc/ceph/ceph.client.#{@new_resource.name}.#{node['hostname']}.#{@new_resource.as_keyring ? 'keyring' : 'secret'}"
|
||||
@current_resource.filename(@new_resource.filename || default_filename)
|
||||
@current_resource.key(get_new_key(@current_resource.keyname))
|
||||
@current_resource.caps_match = true if @current_resource.caps == @new_resource.caps
|
||||
@ -51,7 +53,7 @@ def get_caps(keyname)
|
||||
caps
|
||||
end
|
||||
|
||||
def auth_set_key(keyname, caps)
|
||||
def auth_set_key(keyname, caps) # rubocop:disable MethodLength
|
||||
# find the monitor secret
|
||||
mon_secret = ''
|
||||
mons = get_mon_nodes
|
||||
|
@ -1,3 +1,4 @@
|
||||
# encoding: UTF-8
|
||||
|
||||
include_recipe 'apt'
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
# encoding: UTF-8
|
||||
#
|
||||
# Author:: Kyle Bader <kyle.bader@dreamhost.com>
|
||||
# Cookbook Name:: ceph
|
||||
|
@ -1,3 +1,5 @@
|
||||
# encoding: UTF-8
|
||||
|
||||
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?
|
||||
|
||||
@ -11,8 +13,8 @@ end
|
||||
template '/etc/ceph/ceph.conf' do
|
||||
source 'ceph.conf.erb'
|
||||
variables(
|
||||
:mon_addresses => mon_addresses,
|
||||
:is_rgw => node['ceph']['is_radosgw']
|
||||
mon_addresses: mon_addresses,
|
||||
is_rgw: node['ceph']['is_radosgw']
|
||||
)
|
||||
mode '0644'
|
||||
end
|
||||
|
@ -1,3 +1,4 @@
|
||||
# encoding: UTF-8
|
||||
#
|
||||
# Author:: Kyle Bader <kyle.bader@dreamhost.com>
|
||||
# Cookbook Name:: ceph
|
||||
|
@ -1,3 +1,4 @@
|
||||
# encoding: UTF-8
|
||||
#
|
||||
# Author:: Kyle Bader <kyle.bader@dreamhost.com>
|
||||
# Cookbook Name:: ceph
|
||||
@ -22,7 +23,7 @@ include_recipe 'ceph::conf'
|
||||
|
||||
cluster = 'ceph'
|
||||
|
||||
directory "/var/lib/ceph/mds/#{cluster}-#{node["hostname"]}" do
|
||||
directory "/var/lib/ceph/mds/#{cluster}-#{node['hostname']}" do
|
||||
owner 'root'
|
||||
group 'root'
|
||||
mode 00755
|
||||
@ -32,7 +33,7 @@ end
|
||||
|
||||
ruby_block 'create mds client key' do
|
||||
block do
|
||||
cmd = "ceph auth get-or-create mds.#{node['hostname']} osd 'allow *' mon 'allow rwx' --name mon. --key='#{node["ceph"]["monitor-secret"]}'"
|
||||
cmd = "ceph auth get-or-create mds.#{node['hostname']} osd 'allow *' mon 'allow rwx' --name mon. --key='#{node['ceph']['monitor-secret']}'"
|
||||
keyring = Mixlib::ShellOut.new(cmd).run_command.stdout
|
||||
|
||||
keyfile = File.new("/var/lib/ceph/mds/#{cluster}-#{node['hostname']}/keyring", 'w')
|
||||
@ -41,7 +42,7 @@ ruby_block 'create mds client key' do
|
||||
end
|
||||
end
|
||||
|
||||
file "/var/lib/ceph/mds/#{cluster}-#{node["hostname"]}/done" do
|
||||
file "/var/lib/ceph/mds/#{cluster}-#{node['hostname']}/done" do
|
||||
owner 'root'
|
||||
group 'root'
|
||||
mode 00644
|
||||
@ -55,7 +56,7 @@ when 'upstart'
|
||||
else
|
||||
filename = 'sysvinit'
|
||||
end
|
||||
file "/var/lib/ceph/mds/#{cluster}-#{node["hostname"]}/#{filename}" do
|
||||
file "/var/lib/ceph/mds/#{cluster}-#{node['hostname']}/#{filename}" do
|
||||
owner 'root'
|
||||
group 'root'
|
||||
mode 00644
|
||||
@ -70,5 +71,5 @@ service 'ceph_mds' do
|
||||
service_name 'ceph'
|
||||
end
|
||||
action [:enable, :start]
|
||||
supports :restart => true
|
||||
supports restart: true
|
||||
end
|
||||
|
@ -1,3 +1,5 @@
|
||||
# encoding: UTF-8
|
||||
#
|
||||
# This recipe creates a monitor cluster
|
||||
#
|
||||
# You should never change the mon default path or
|
||||
@ -29,7 +31,7 @@ directory '/var/run/ceph' do
|
||||
action :create
|
||||
end
|
||||
|
||||
directory "/var/lib/ceph/mon/ceph-#{node["hostname"]}" do
|
||||
directory "/var/lib/ceph/mon/ceph-#{node['hostname']}" do
|
||||
owner 'root'
|
||||
group 'root'
|
||||
mode 00755
|
||||
@ -40,7 +42,7 @@ end
|
||||
# TODO: cluster name
|
||||
cluster = 'ceph'
|
||||
|
||||
unless File.exist?("/var/lib/ceph/mon/ceph-#{node["hostname"]}/done")
|
||||
unless File.exist?("/var/lib/ceph/mon/ceph-#{node['hostname']}/done")
|
||||
keyring = "#{Chef::Config[:file_cache_path]}/#{cluster}-#{node['hostname']}.mon.keyring"
|
||||
|
||||
if node['ceph']['encrypted_data_bags']
|
||||
@ -62,7 +64,7 @@ unless File.exist?("/var/lib/ceph/mon/ceph-#{node["hostname"]}/done")
|
||||
ruby_block 'finalise' do
|
||||
block do
|
||||
['done', service_type].each do |ack|
|
||||
::File.open("/var/lib/ceph/mon/ceph-#{node["hostname"]}/#{ack}", 'w').close
|
||||
::File.open("/var/lib/ceph/mon/ceph-#{node['hostname']}/#{ack}", 'w').close
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -75,7 +77,7 @@ if service_type == 'upstart'
|
||||
end
|
||||
service 'ceph-mon-all' do
|
||||
provider Chef::Provider::Service::Upstart
|
||||
supports :status => true
|
||||
supports status: true
|
||||
action [:enable, :start]
|
||||
end
|
||||
end
|
||||
@ -88,7 +90,7 @@ service 'ceph_mon' do
|
||||
else
|
||||
service_name 'ceph'
|
||||
end
|
||||
supports :restart => true, :status => true
|
||||
supports restart: true, status: true
|
||||
action [:enable, :start]
|
||||
end
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
# encoding: UTF-8
|
||||
#
|
||||
# Author:: Kyle Bader <kyle.bader@dreamhost.com>
|
||||
# Cookbook Name:: ceph
|
||||
@ -70,7 +71,7 @@ execute 'format as keyring' do
|
||||
end
|
||||
|
||||
if crowbar?
|
||||
node['crowbar']['disks'].each do |disk, data|
|
||||
node['crowbar']['disks'].each do |disk, _data|
|
||||
execute "ceph-disk-prepare #{disk}" do
|
||||
command "ceph-disk-prepare /dev/#{disk}"
|
||||
only_if { node['crowbar']['disks'][disk]['usage'] == 'Storage' }
|
||||
@ -102,7 +103,7 @@ else
|
||||
if !node['ceph']['osd_devices'].nil?
|
||||
devices = node['ceph']['osd_devices']
|
||||
|
||||
devices = Hash[(0...devices.size).zip devices] unless devices.kind_of? Hash
|
||||
devices = Hash[(0...devices.size).zip devices] unless devices.is_a? Hash
|
||||
|
||||
devices.each do |index, osd_device|
|
||||
unless osd_device['status'].nil?
|
||||
@ -150,7 +151,7 @@ else
|
||||
service_name 'ceph'
|
||||
end
|
||||
action [:enable, :start]
|
||||
supports :restart => true
|
||||
supports restart: true
|
||||
end
|
||||
else
|
||||
Log.info('node["ceph"]["osd_devices"] empty')
|
||||
|
@ -1,3 +1,4 @@
|
||||
# encoding: UTF-8
|
||||
#
|
||||
# Author:: Kyle Bader <kyle.bader@dreamhost.com>
|
||||
# Cookbook Name:: ceph
|
||||
@ -45,9 +46,9 @@ end
|
||||
|
||||
include_recipe 'ceph::conf'
|
||||
|
||||
if !::File.exists?("/var/lib/ceph/radosgw/ceph-radosgw.#{node['hostname']}/done")
|
||||
if !::File.exist?("/var/lib/ceph/radosgw/ceph-radosgw.#{node['hostname']}/done")
|
||||
if node['ceph']['radosgw']['webserver_companion']
|
||||
include_recipe "ceph::radosgw_#{node["ceph"]["radosgw"]["webserver_companion"]}"
|
||||
include_recipe "ceph::radosgw_#{node['ceph']['radosgw']['webserver_companion']}"
|
||||
end
|
||||
|
||||
ceph_client 'radosgw' do
|
||||
@ -70,7 +71,7 @@ if !::File.exists?("/var/lib/ceph/radosgw/ceph-radosgw.#{node['hostname']}/done"
|
||||
service_name 'ceph-radosgw'
|
||||
end
|
||||
end
|
||||
supports :restart => true
|
||||
supports restart: true
|
||||
action [:enable, :start]
|
||||
end
|
||||
else
|
||||
|
@ -1,3 +1,4 @@
|
||||
# encoding: UTF-8
|
||||
#
|
||||
# Author:: Kyle Bader <kyle.bader@dreamhost.com>
|
||||
# Cookbook Name:: ceph
|
||||
@ -94,6 +95,6 @@ template '/var/www/s3gw.fcgi' do
|
||||
group 'root'
|
||||
mode '0755'
|
||||
variables(
|
||||
:ceph_rgw_client => "client.radosgw.#{node['hostname']}"
|
||||
ceph_rgw_client: "client.radosgw.#{node['hostname']}"
|
||||
)
|
||||
end
|
||||
|
@ -1,3 +1,5 @@
|
||||
# encoding: UTF-8
|
||||
|
||||
case node['platform_family']
|
||||
when 'debian'
|
||||
include_recipe 'ceph::apt'
|
||||
|
@ -1,3 +1,5 @@
|
||||
# encoding: UTF-8
|
||||
|
||||
platform_family = node['platform_family']
|
||||
|
||||
case platform_family
|
||||
|
@ -1,3 +1,4 @@
|
||||
# encoding: UTF-8
|
||||
#
|
||||
# Author:: Kyle Bader <kyle.bader@dreamhost.com>
|
||||
# Cookbook Name:: ceph
|
||||
@ -46,6 +47,6 @@ service 'tgt' do
|
||||
else
|
||||
service_name 'tgt'
|
||||
end
|
||||
supports :restart => true
|
||||
supports restart: true
|
||||
action [:enable, :start]
|
||||
end
|
||||
|
@ -1,19 +1,21 @@
|
||||
# encoding: UTF-8
|
||||
|
||||
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 :name, kind_of: String, name_attribute: true
|
||||
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}
|
||||
attribute :keyname, :kind_of => String
|
||||
attribute :keyname, kind_of: String
|
||||
|
||||
# where the key should be saved
|
||||
# defaults to /etc/ceph/ceph.client.#{name}.#{hostname}.keyring if as_keyring
|
||||
# defaults to /etc/ceph/ceph.client.#{name}.#{hostname}.secret if not as_keyring
|
||||
attribute :filename, :kind_of => String
|
||||
attribute :filename, kind_of: String
|
||||
|
||||
attr_accessor :key, :caps_match
|
||||
|
22
spec/spec_helper.rb
Normal file
22
spec/spec_helper.rb
Normal file
@ -0,0 +1,22 @@
|
||||
# encoding: UTF-8
|
||||
require 'chefspec'
|
||||
require 'chefspec/berkshelf'
|
||||
|
||||
ChefSpec::Coverage.start! { add_filter 'ceph' }
|
||||
|
||||
LOG_LEVEL = :fatal
|
||||
SUSE_OPTS = {
|
||||
platform: 'suse',
|
||||
version: '11.3',
|
||||
log_level: LOG_LEVEL
|
||||
}
|
||||
REDHAT_OPTS = {
|
||||
platform: 'redhat',
|
||||
version: '6.5',
|
||||
log_level: LOG_LEVEL
|
||||
}
|
||||
UBUNTU_OPTS = {
|
||||
platform: 'ubuntu',
|
||||
version: '12.04',
|
||||
log_level: LOG_LEVEL
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user