diff --git a/Berksfile.lock b/Berksfile.lock index 3e01407..a8106e7 100644 --- a/Berksfile.lock +++ b/Berksfile.lock @@ -9,28 +9,28 @@ "ref": "f759cd013c0a836f2acb219b3e006ff0a1308878" }, "memcached": { - "locked_version": "1.6.2" + "locked_version": "1.6.4" }, "runit": { - "locked_version": "1.3.0" + "locked_version": "1.4.0" }, "build-essential": { "locked_version": "1.4.2" }, "yum": { - "locked_version": "2.4.0" + "locked_version": "2.4.4" }, "sysctl": { - "locked_version": "0.3.3" + "locked_version": "0.3.5" }, "apt": { "locked_version": "2.3.0" }, "git": { - "locked_version": "2.7.0" + "locked_version": "2.8.1" }, "dmg": { - "locked_version": "2.0.4" + "locked_version": "2.0.8" }, "windows": { "locked_version": "1.11.0" diff --git a/CHANGELOG.md b/CHANGELOG.md index c5eac8e..c994176 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ This file is used to list changes made in each version of cookbook-openstack-object-storage. +## 8.0.0 +### New version +* Upgrade to upstream Havana release + ## 7.1.0: * Update apt sources to grizzly to prepare for grizzly and havana branches diff --git a/Gemfile b/Gemfile index d592402..c4e9cab 100644 --- a/Gemfile +++ b/Gemfile @@ -2,8 +2,8 @@ source "https://rubygems.org" gem "chef", "~> 11.4.4" gem "json", "<= 1.7.7" # chef 11 dependency -gem "berkshelf", "~> 2.0.8" -gem "chefspec", "~> 1.3.0" -gem "foodcritic" +gem "berkshelf", "~> 2.0.10" +gem "chefspec", "~> 3.0.2" +gem "foodcritic", "~> 3.0.3" gem "strainer" gem "webmock", "~> 1.11.0" diff --git a/Gemfile.lock b/Gemfile.lock index f69004d..71daac6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,30 +1,34 @@ GEM remote: https://rubygems.org/ specs: - activesupport (3.2.14) + activesupport (3.2.16) i18n (~> 0.6, >= 0.6.4) multi_json (~> 1.0) addressable (2.3.5) akami (1.2.0) gyoku (>= 0.4.0) nokogiri (>= 1.4.0) - berkshelf (2.0.8) + berkshelf (2.0.10) activesupport (~> 3.2.0) addressable (~> 2.3.4) buff-shell_out (~> 0.1) - celluloid (>= 0.14.0) chozo (>= 0.6.1) faraday (>= 0.8.5) hashie (>= 2.0.2) minitar (~> 0.5.4) rbzip2 (~> 0.2.0) retryable (~> 1.3.3) - ridley (~> 1.2.1) + ridley (~> 1.5.0) solve (>= 0.5.0) 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.0) + buff-shell_out (0.1.1) buff-ruby_engine (~> 0.1.0) builder (3.2.2) celluloid (0.14.1) @@ -46,33 +50,29 @@ GEM ohai (>= 0.6.0) rest-client (>= 1.0.4, < 1.7.0) yajl-ruby (~> 1.1) - chefspec (1.3.1) - chef (>= 10.0) - erubis - fauxhai (>= 0.1.1, < 2.0) - minitest-chef-handler (>= 0.6.0) - rspec (~> 2.0) + chefspec (3.0.2) + 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) - ci_reporter (1.9.0) - builder (>= 2.1.2) crack (0.4.1) safe_yaml (~> 0.9.0) - diff-lcs (1.2.4) + diff-lcs (1.2.5) erubis (2.7.0) faraday (0.8.8) multipart-post (~> 1.2.0) - fauxhai (1.1.1) - httparty + fauxhai (2.0.1) net-ssh ohai - ffi (1.9.0) - foodcritic (2.2.0) + 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) @@ -82,37 +82,29 @@ GEM gyoku (1.1.0) builder (>= 2.1.2) hashie (2.0.5) - highline (1.6.19) - httparty (0.11.0) - multi_json (~> 1.0) - multi_xml (>= 0.5.2) - httpclient (2.2.0.2) + highline (1.6.20) + httpclient (2.3.4.1) httpi (0.9.7) rack - i18n (0.6.5) + i18n (0.6.9) ipaddress (0.8.0) json (1.7.7) little-plugger (1.1.3) - logging (1.6.2) + logging (1.8.1) little-plugger (>= 1.1.3) - mime-types (1.24) + multi_json (>= 1.3.6) + mime-types (2.0) minitar (0.5.4) - minitest (4.7.5) - minitest-chef-handler (1.0.1) - chef - ci_reporter - minitest (~> 4.7.3) mixlib-authentication (1.3.0) mixlib-log mixlib-cli (1.3.0) - mixlib-config (1.1.2) + mixlib-config (2.1.0) mixlib-log (1.6.0) - mixlib-shellout (1.2.0) - multi_json (1.7.9) - multi_xml (0.5.5) + mixlib-shellout (1.3.0) + multi_json (1.8.2) multipart-post (1.2.0) net-http-persistent (2.9) - net-ssh (2.6.8) + net-ssh (2.7.0) net-ssh-gateway (1.2.0) net-ssh (>= 2.6.5) net-ssh-multi (1.1) @@ -121,23 +113,26 @@ GEM nio4r (0.5.0) nokogiri (1.5.10) nori (1.1.5) - ohai (6.18.0) + ohai (6.20.0) ipaddress mixlib-cli mixlib-config mixlib-log mixlib-shellout - systemu + systemu (~> 2.5.2) yajl-ruby polyglot (0.3.3) rack (1.5.2) + rake (10.1.0) rbzip2 (0.2.0) rest-client (1.6.7) mime-types (>= 1.16) retryable (1.3.3) - ridley (1.2.5) + ridley (1.5.3) addressable + buff-config (~> 0.2) buff-extensions (~> 0.3) + buff-ignore (~> 1.1) buff-shell_out (~> 0.1) celluloid (~> 0.14.0) celluloid-io (~> 0.14.0) @@ -148,6 +143,7 @@ GEM mixlib-authentication (>= 1.3.0) net-http-persistent (>= 2.8) net-ssh + nio4r (>= 0.5.0) retryable solve (>= 0.4.4) varia_model (~> 0.1) @@ -156,12 +152,12 @@ GEM rspec-core (~> 2.14.0) rspec-expectations (~> 2.14.0) rspec-mocks (~> 2.14.0) - rspec-core (2.14.5) - rspec-expectations (2.14.2) + rspec-core (2.14.7) + rspec-expectations (2.14.4) diff-lcs (>= 1.1.3, < 2.0) - rspec-mocks (2.14.3) + rspec-mocks (2.14.4) rubyntlm (0.1.1) - safe_yaml (0.9.5) + safe_yaml (0.9.7) savon (0.9.5) akami (~> 1.0) builder (>= 2.1.2) @@ -170,13 +166,14 @@ GEM nokogiri (>= 1.4.0) nori (~> 1.0) wasabi (~> 1.0) - solve (0.8.0) - strainer (3.2.2) + solve (0.8.2) + strainer (3.3.0) berkshelf (~> 2.0) + buff-platform (~> 0.1) systemu (2.5.2) thor (0.18.1) timers (1.1.0) - treetop (1.4.14) + treetop (1.4.15) polyglot polyglot (>= 0.3.1) uuidtools (2.1.4) @@ -188,11 +185,11 @@ GEM webmock (1.11.0) addressable (>= 2.2.7) crack (>= 0.3.2) - winrm (1.1.2) + winrm (1.1.3) gssapi (~> 1.0.0) - httpclient (~> 2.2.0.2) - logging (~> 1.6.1) - nokogiri (~> 1.5.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) @@ -202,10 +199,10 @@ PLATFORMS ruby DEPENDENCIES - berkshelf (~> 2.0.8) + berkshelf (~> 2.0.10) chef (~> 11.4.4) - chefspec (~> 1.3.0) - foodcritic + chefspec (~> 3.0.2) + foodcritic (~> 3.0.3) json (<= 1.7.7) strainer webmock (~> 1.11.0) diff --git a/README.md b/README.md index 25f202e..0efd7c3 100644 --- a/README.md +++ b/README.md @@ -256,13 +256,15 @@ License and Author | | | |:---------------------|:---------------------------------------------------| -| **Authors** | Alan Meadows () | -| | Oisin Feeley () | -| | Ron Pedde () | -| | Will Kelly () | +| **Author** | Alan Meadows () | +| **Author** | Oisin Feeley () | +| **Author** | Ron Pedde () | +| **Author** | Will Kelly () | +| **Author** | Chen Zhiwei () | | | | | **Copyright** | Copyright (c) 2013, AT&T, Inc. | -| | Copyright (c) 2012, Rackspace US, Inc. | +| **Copyright** | Copyright (c) 2012, Rackspace US, Inc. | +| **Copyright** | Copyright (c) 2013, IBM, Corp. | Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/attributes/default.rb b/attributes/default.rb index fbe7772..8fa2d02 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -11,7 +11,7 @@ default["swift"]["git_builder_ip"] = "127.0.0.1" # the release only has any effect on ubuntu, and must be # a valid release on http://ubuntu-cloud.archive.canonical.com/ubuntu -default["swift"]["release"] = "grizzly" +default["swift"]["release"] = "havana" # we support an optional secret databag where we will retrieve the # following attributes overriding any default attributes here diff --git a/metadata.rb b/metadata.rb index fdbff00..b2ba681 100644 --- a/metadata.rb +++ b/metadata.rb @@ -3,7 +3,7 @@ maintainer "ATT, Inc." license "Apache 2.0" description "Installs and configures Openstack Swift" long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version "7.1.0" +version "8.0.0" recipe "openstack-object-storage::setup", "Does initial setup of a swift cluster" recipe "openstack-object-storage::account-server", "Installs the swift account server" recipe "openstack-object-storage::object-server", "Installs the swift object server" diff --git a/providers/disk.rb b/providers/disk.rb index d20193f..58cb62b 100644 --- a/providers/disk.rb +++ b/providers/disk.rb @@ -58,7 +58,7 @@ sample output /dev/sdb: 261 cylinders, 255 heads, 63 sectors/track =end def sfdisk_get_size(dev_name) - out = %x{sfdisk #{dev_name} -s} + out = Mixlib::ShellOut.new("sfdisk #{dev_name} -s").run_command.stdout Chef::Log.info("updating geo using sfdisk: #{out}") # sfdisk sees the world as 1k blocks @@ -123,6 +123,7 @@ end action :list do Chef::Log.info("at some point there'll be a list") + new_resource.updated_by_last_action(update) end #### @@ -247,12 +248,12 @@ action :ensure_exists do case params[:type] when "xfs" - if not system("xfs_admin -l #{device}") + if not Mixlib::ShellOut.new("xfs_admin -l #{device}").run_command.status Mixlib::ShellOut.new("mkfs.xfs -f -i size=512 #{device}").run_command update = true end when "ext4" - if not system("tune2fs -l #{device} | grep \"Filesystem volume name:\" | awk \'{print $4}\' | grep -v \"\"") + if not Mixlib::ShellOut.new("tune2fs -l #{device} | grep \"Filesystem volume name:\" | awk \'{print $4}\' | grep -v \"\"").run_command.status Mixlib::ShellOut.new("mkfs.ext4 #{device}").run_command update = true end diff --git a/providers/mounts.rb b/providers/mounts.rb index bf2ed22..b09f48c 100644 --- a/providers/mounts.rb +++ b/providers/mounts.rb @@ -38,10 +38,10 @@ action :ensure_exists do info["device"] = device info["ip"] = @new_resource.ip info["format"] = @new_resource.format - info["uuid"] = `blkid /dev/#{device} -s UUID -o value`.strip + info["uuid"] = Mixlib::ShellOut.new("blkid /dev/#{device} -s UUID -o value").run_command.stdout.strip info["mountpoint"] = info["uuid"].split("-").join("") - info["mounted"] = system("mount | grep '#{path}/#{info["mountpoint"]}\'") - info["size"] = `sfdisk -s /dev/#{device}`.to_i / 1024 + info["mounted"] = Mixlib::ShellOut.new("mount | grep '#{path}/#{info["mountpoint"]}\'").run_command.status + info["size"] = Mixlib::ShellOut.new("sfdisk -s /dev/#{device}").run_command.stdout.to_i / 1024 next if (info["uuid"] == '') @@ -79,7 +79,7 @@ action :ensure_exists do # mounts in /srv/node that shouldn't be there (mounts.keys.select{|x| x and x[/^#{path}/]} - valid_mounts).each do |dev| Chef::Log.info("Unmounting #{dev}") - system("umount #{dev}") if system("mount | grep '#{dev}'") + Mixlib::ShellOut.new("umount #{dev}").run_command if Mixlib::ShellOut.new("mount | grep '#{dev}'").run_command.status new_resource.updated_by_last_action(true) end @@ -148,7 +148,7 @@ action :ensure_exists do end dev_info.reject { |k,v| v["mounted"] }.keys.each do |uuid| - dev_info[uuid]["mounted"] = system("mount | grep '#{path}/#{dev_info[uuid]["mountpoint"]}\'") + dev_info[uuid]["mounted"] = Mixlib::ShellOut.new("mount | grep '#{path}/#{dev_info[uuid]["mountpoint"]}\'").run_command.status end if @new_resource.publish_attributes and dev_info != {} diff --git a/recipes/disks.rb b/recipes/disks.rb index 89c573f..c75229b 100644 --- a/recipes/disks.rb +++ b/recipes/disks.rb @@ -21,6 +21,7 @@ class Chef::Recipe include IPUtils + include DriveUtils end diff --git a/spec/account_spec.rb b/spec/account_spec.rb index 6a796a5..b7b3eda 100644 --- a/spec/account_spec.rb +++ b/spec/account_spec.rb @@ -1,4 +1,4 @@ -require 'spec_helper' +require_relative 'spec_helper' describe 'openstack-object-storage::account-server' do @@ -10,7 +10,7 @@ describe 'openstack-object-storage::account-server' do before do swift_stubs - @chef_run = ::ChefSpec::ChefRunner.new ::UBUNTU_OPTS + @chef_run = ::ChefSpec::Runner.new ::UBUNTU_OPTS @node = @chef_run.node @node.set['lsb']['code'] = 'precise' @node.set['swift']['authmode'] = 'swauth' @@ -38,7 +38,7 @@ describe 'openstack-object-storage::account-server' do it "starts swift account services on boot" do %w{swift-account swift-account-auditor swift-account-reaper swift-account-replicator}.each do |svc| - expect(@chef_run).to set_service_to_start_on_boot svc + expect(@chef_run).to enable_service(svc) end end @@ -49,7 +49,8 @@ describe 'openstack-object-storage::account-server' do end it "has proper owner" do - expect(@file).to be_owned_by "swift", "swift" + expect(@file.owner).to eq("swift") + expect(@file.group).to eq("swift") end it "has proper modes" do diff --git a/spec/common_spec.rb b/spec/common_spec.rb index 6a1277f..0bdb758 100644 --- a/spec/common_spec.rb +++ b/spec/common_spec.rb @@ -1,4 +1,4 @@ -require 'spec_helper' +require_relative 'spec_helper' describe 'openstack-object-storage::common' do @@ -10,16 +10,16 @@ describe 'openstack-object-storage::common' do before do swift_stubs - @chef_run = ::ChefSpec::ChefRunner.new ::UBUNTU_OPTS + @chef_run = ::ChefSpec::Runner.new ::UBUNTU_OPTS @node = @chef_run.node @node.set['platform_family'] = "debian" @node.set['lsb']['codename'] = "precise" - @node.set['swift']['release'] = "grizzly" + @node.set['swift']['release'] = "havana" @node.set['swift']['authmode'] = 'swauth' @node.set['swift']['git_builder_ip'] = '10.0.0.10' # TODO: this does not work - # ::Chef::Log.should_receive(:info).with("chefspec: precise-updates/grizzly") + # ::Chef::Log.should_receive(:info).with("chefspec: precise-updates/havana") @chef_run.converge "openstack-object-storage::common" end @@ -41,7 +41,8 @@ describe 'openstack-object-storage::common' do end it "has proper owner" do - expect(@file).to be_owned_by "swift", "swift" + expect(@file.owner).to eq("swift") + expect(@file.group).to eq("swift") end it "has proper modes" do @@ -57,7 +58,8 @@ describe 'openstack-object-storage::common' do end it "has proper owner" do - expect(@file).to be_owned_by "swift", "swift" + expect(@file.owner).to eq("swift") + expect(@file.group).to eq("swift") end it "has proper modes" do @@ -73,7 +75,8 @@ describe 'openstack-object-storage::common' do end it "has proper owner" do - expect(@file).to be_owned_by "swift", "swift" + expect(@file.owner).to eq("swift") + expect(@file.group).to eq("swift") end it "has proper modes" do diff --git a/spec/container_spec.rb b/spec/container_spec.rb index 8f3d129..c2d0820 100644 --- a/spec/container_spec.rb +++ b/spec/container_spec.rb @@ -1,4 +1,4 @@ -require 'spec_helper' +require_relative 'spec_helper' describe 'openstack-object-storage::container-server' do @@ -10,7 +10,7 @@ describe 'openstack-object-storage::container-server' do before do swift_stubs - @chef_run = ::ChefSpec::ChefRunner.new ::UBUNTU_OPTS + @chef_run = ::ChefSpec::Runner.new ::UBUNTU_OPTS @node = @chef_run.node @node.set['lsb']['code'] = 'precise' @node.set['swift']['authmode'] = 'swauth' @@ -36,7 +36,7 @@ describe 'openstack-object-storage::container-server' do it "starts swift container services on boot" do %w{swift-container swift-container-auditor swift-container-replicator swift-container-updater swift-container-sync}.each do |svc| - expect(@chef_run).to set_service_to_start_on_boot svc + expect(@chef_run).to enable_service(svc) end end @@ -47,7 +47,8 @@ describe 'openstack-object-storage::container-server' do end it "has proper owner" do - expect(@file).to be_owned_by "swift", "swift" + expect(@file.owner).to eq("swift") + expect(@file.group).to eq("swift") end it "has proper modes" do @@ -55,8 +56,7 @@ describe 'openstack-object-storage::container-server' do end it "has allowed sync hosts" do - expect(@chef_run).to create_file_with_content @file.name, - "allowed_sync_hosts = host1,host2,host3" + expect(@chef_run).to render_file(@file.name).with_content("allowed_sync_hosts = host1,host2,host3") end end @@ -79,8 +79,7 @@ describe 'openstack-object-storage::container-server' do end it "has no allowed_sync_hosts on empty lists" do - expect(@chef_run).not_to create_file_with_content @file.name, - /^allowed_sync_hots =/ + expect(@chef_run).not_to render_file(@file.name).with_content(/^allowed_sync_hots =/) end end end diff --git a/spec/disks_spec.rb b/spec/disks_spec.rb index f30c88b..c6c1ee4 100644 --- a/spec/disks_spec.rb +++ b/spec/disks_spec.rb @@ -1,4 +1,4 @@ -require 'spec_helper' +require_relative 'spec_helper' describe 'openstack-object-storage::disks' do @@ -10,11 +10,11 @@ describe 'openstack-object-storage::disks' do before do swift_stubs - @chef_run = ::ChefSpec::ChefRunner.new ::UBUNTU_OPTS + @chef_run = ::ChefSpec::Runner.new ::UBUNTU_OPTS @node = @chef_run.node @node.set['platform_family'] = "debian" @node.set['lsb']['codename'] = "precise" - @node.set['swift']['release'] = "grizzly" + @node.set['swift']['release'] = "havana" @node.set['swift']['authmode'] = 'swauth' @node.set['swift']['git_builder_ip'] = '10.0.0.10' @node.set['swift']['disk_enum_expr'] = "[{ 'sda' => {}}]" @@ -39,5 +39,4 @@ describe 'openstack-object-storage::disks' do end - end diff --git a/spec/management_spec.rb b/spec/management_spec.rb index 9404211..b27f1fe 100644 --- a/spec/management_spec.rb +++ b/spec/management_spec.rb @@ -1,4 +1,4 @@ -require 'spec_helper' +require_relative 'spec_helper' describe 'openstack-object-storage::management-server' do @@ -10,7 +10,7 @@ describe 'openstack-object-storage::management-server' do before do swift_stubs - @chef_run = ::ChefSpec::ChefRunner.new ::UBUNTU_OPTS + @chef_run = ::ChefSpec::Runner.new ::UBUNTU_OPTS @node = @chef_run.node @node.set['lsb']['code'] = 'precise' @node.set['swift']['authmode'] = 'swauth' @@ -32,7 +32,8 @@ describe 'openstack-object-storage::management-server' do end it "has proper owner" do - expect(@file).to be_owned_by "swift", "swift" + expect(@file.owner).to eq("swift") + expect(@file.group).to eq("swift") end it "has proper modes" do @@ -52,7 +53,8 @@ describe 'openstack-object-storage::management-server' do end it "has proper owner" do - expect(@file).to be_owned_by "root", "root" + expect(@file.owner).to eq("root") + expect(@file.group).to eq("root") end it "has proper modes" do @@ -60,8 +62,7 @@ describe 'openstack-object-storage::management-server' do end it "has expected statsd host" do - expect(@chef_run).to create_file_with_content @file.name, - "self.statsd_host = '127.0.0.1'" + expect(@chef_run).to render_file(@file.name).with_content("self.statsd_host = '127.0.0.1'") end end diff --git a/spec/object_spec.rb b/spec/object_spec.rb index b7c75a3..426e6c1 100644 --- a/spec/object_spec.rb +++ b/spec/object_spec.rb @@ -1,4 +1,4 @@ -require 'spec_helper' +require_relative 'spec_helper' describe 'openstack-object-storage::object-server' do @@ -10,7 +10,7 @@ describe 'openstack-object-storage::object-server' do before do swift_stubs - @chef_run = ::ChefSpec::ChefRunner.new ::UBUNTU_OPTS + @chef_run = ::ChefSpec::Runner.new ::UBUNTU_OPTS @node = @chef_run.node @node.set['lsb']['code'] = 'precise' @node.set['swift']['authmode'] = 'swauth' @@ -34,7 +34,7 @@ describe 'openstack-object-storage::object-server' do it "starts swift object services on boot" do %w{swift-object swift-object-replicator swift-object-auditor swift-object-updater}.each do |svc| - expect(@chef_run).to set_service_to_start_on_boot svc + expect(@chef_run).to enable_service(svc) end end @@ -53,7 +53,8 @@ describe 'openstack-object-storage::object-server' do end it "has proper owner" do - expect(@file).to be_owned_by "swift", "swift" + expect(@file.owner).to eq("swift") + expect(@file.group).to eq("swift") end it "has proper modes" do diff --git a/spec/proxy_spec.rb b/spec/proxy_spec.rb index 33a4337..125b7b3 100644 --- a/spec/proxy_spec.rb +++ b/spec/proxy_spec.rb @@ -1,4 +1,4 @@ -require 'spec_helper' +require_relative 'spec_helper' describe 'openstack-object-storage::proxy-server' do @@ -10,7 +10,7 @@ describe 'openstack-object-storage::proxy-server' do before do swift_stubs - @chef_run = ::ChefSpec::ChefRunner.new ::UBUNTU_OPTS + @chef_run = ::ChefSpec::Runner.new ::UBUNTU_OPTS @node = @chef_run.node @node.set['lsb']['code'] = 'precise' @node.set['swift']['authmode'] = 'swauth' @@ -34,7 +34,7 @@ describe 'openstack-object-storage::proxy-server' do end it "starts swift-proxy on boot" do - expect(@chef_run).to set_service_to_start_on_boot "swift-proxy" + expect(@chef_run).to enable_service("swift-proxy") end describe "/etc/swift/proxy-server.conf" do @@ -44,7 +44,8 @@ describe 'openstack-object-storage::proxy-server' do end it "has proper owner" do - expect(@file).to be_owned_by "swift", "swift" + expect(@file.owner).to eq("swift") + expect(@file.group).to eq("swift") end it "has proper modes" do diff --git a/spec/ring-repo_spec.rb b/spec/ring-repo_spec.rb index 34e96d7..44f3431 100644 --- a/spec/ring-repo_spec.rb +++ b/spec/ring-repo_spec.rb @@ -1,4 +1,4 @@ -require 'spec_helper' +require_relative 'spec_helper' describe 'openstack-object-storage::ring-repo' do @@ -10,11 +10,11 @@ describe 'openstack-object-storage::ring-repo' do before do swift_stubs - @chef_run = ::ChefSpec::ChefRunner.new ::UBUNTU_OPTS + @chef_run = ::ChefSpec::Runner.new ::UBUNTU_OPTS @node = @chef_run.node @node.set['platform_family'] = "debian" @node.set['lsb']['codename'] = "precise" - @node.set['swift']['release'] = "grizzly" + @node.set['swift']['release'] = "havana" @node.set['swift']['authmode'] = 'swauth' @node.set['swift']['git_builder_ip'] = '10.0.0.10' @chef_run.converge "openstack-object-storage::ring-repo" @@ -24,9 +24,9 @@ describe 'openstack-object-storage::ring-repo' do expect(@chef_run).to install_package "git-daemon-sysvinit" end - it "starts xinetd services on boot" do + it "should not start xinetd services on boot" do %w{xinetd}.each do |svc| - expect(@chef_run).to set_service_to_start_on_boot svc + expect(@chef_run).not_to enable_service(svc) end end diff --git a/spec/rsync_spec.rb b/spec/rsync_spec.rb index e3be5e3..56dbab4 100644 --- a/spec/rsync_spec.rb +++ b/spec/rsync_spec.rb @@ -1,4 +1,4 @@ -require 'spec_helper' +require_relative 'spec_helper' describe 'openstack-object-storage::rsync' do @@ -10,11 +10,11 @@ describe 'openstack-object-storage::rsync' do before do swift_stubs - @chef_run = ::ChefSpec::ChefRunner.new ::UBUNTU_OPTS + @chef_run = ::ChefSpec::Runner.new ::UBUNTU_OPTS @node = @chef_run.node @node.set['platform_family'] = "debian" @node.set['lsb']['codename'] = "precise" - @node.set['swift']['release'] = "grizzly" + @node.set['swift']['release'] = "havana" @node.set['swift']['authmode'] = 'swauth' @node.set['swift']['git_builder_ip'] = '10.0.0.10' @chef_run.converge "openstack-object-storage::rsync" @@ -26,7 +26,7 @@ describe 'openstack-object-storage::rsync' do it "starts rsync service on boot" do %w{rsync}.each do |svc| - expect(@chef_run).to set_service_to_start_on_boot svc + expect(@chef_run).to enable_service(svc) end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index a70cbcc..2bd3e33 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -37,13 +37,25 @@ MOCK_NODE_NETWORK_DATA = } def swift_stubs - # create mock cluster - n = Chef::Node.new() - n.name('manager') - n.default_attrs = { - "swift" => { - "service_pass" => "foobar" - } - } + + stub_command("/usr/bin/id swift").and_return(true) + stub_command("[ -x /etc/swift/pull-rings.sh ]").and_return(true) + stub_command("[ -f /etc/rsyncd.conf ]").and_return(true) + stub_command("grep -q 'RSYNC_ENABLE=false' /etc/default/rsync").and_return(true) + stub_command("[ -e /etc/swift/account-server.conf ] && [ -e /etc/swift/account.ring.gz ]").and_return(true) + stub_command("[ -e /etc/swift/container-server.conf ] && [ -e /etc/swift/container.ring.gz ]").and_return(true) + stub_command("[ -e /etc/init/swift-container-sync.conf ]").and_return(false) + stub_command("[ -e /etc/init.d/swift-container-sync ]").and_return(false) + stub_command("[ -e /etc/swift/object-server.conf ] && [ -e /etc/swift/object.ring.gz ]").and_return(true) + stub_command("[ -e /etc/swift/proxy-server.conf ] && [ -e /etc/swift/object.ring.gz ]").and_return(true) + + # create mock cluster + n = Chef::Node.new() + n.name('manager') + n.default_attrs = { + "swift" => { + "service_pass" => "foobar" + } + } Chef::Recipe.any_instance.stub(:search).with(:node, 'chef_environment:_default AND roles:swift-setup').and_return([n]) end diff --git a/spec/storage-common_spec.rb b/spec/storage-common_spec.rb index 50a3ef8..9fe6d32 100644 --- a/spec/storage-common_spec.rb +++ b/spec/storage-common_spec.rb @@ -1,4 +1,4 @@ -require 'spec_helper' +require_relative 'spec_helper' describe 'openstack-object-storage::storage-common' do @@ -10,7 +10,7 @@ describe 'openstack-object-storage::storage-common' do before do swift_stubs - @chef_run = ::ChefSpec::ChefRunner.new ::UBUNTU_OPTS + @chef_run = ::ChefSpec::Runner.new ::UBUNTU_OPTS @node = @chef_run.node @node.set['lsb']['code'] = 'precise' @node.set['swift']['authmode'] = 'swauth' @@ -24,7 +24,8 @@ describe 'openstack-object-storage::storage-common' do end it "has proper owner" do - expect(@file).to be_owned_by "swift", "swift" + expect(@file.owner).to eq("swift") + expect(@file.group).to eq("swift") end it "has proper modes" do @@ -40,7 +41,8 @@ describe 'openstack-object-storage::storage-common' do end it "has proper owner" do - expect(@file).to be_owned_by "swift", "swift" + expect(@file.owner).to eq("swift") + expect(@file.group).to eq("swift") end it "has proper modes" do