Skip to content

Commit

Permalink
Merge pull request #21 from rightscale-cookbooks/ST-249_fix_rackspace…
Browse files Browse the repository at this point in the history
…_cloudname

St 249 fix rackspace cloudname
  • Loading branch information
douglaswth committed Apr 22, 2015
2 parents 756cf51 + 8c5644f commit 809a555
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 10 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ rightscale_volume Cookbook CHANGELOG

This file is used to list changes made in each version of the rightscale_volume cookbook.

v1.2.8
------

- Use correct Rackspace cloud name.

v1.2.7
------

Expand Down
6 changes: 3 additions & 3 deletions libraries/provider_rightscale_volume.rb
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def action_delete
@new_resource.updated_by_last_action(true)
Chef::Log.info " Successfully deleted volume '#{@current_resource.nickname}'"
else
if ['rackspace-ng', 'openstack'].include?(node['cloud']['provider'])
if ['rackspace', 'openstack'].include?(node['cloud']['provider'])
Chef::Log.info "Volume '#{@current_resource.nickname}' was not deleted!"
delete_device_hash
else
Expand Down Expand Up @@ -296,7 +296,7 @@ def initialize_api_client(options = {})
# @raise [Timeout::Error] if volume creation takes longer than the timeout value
#
def create_volume(name, size, description = "", snapshot_id = nil, options = {})
if (size < 100 && node['cloud']['provider'] == "rackspace-ng")
if (size < 100 && node['cloud']['provider'] == "rackspace")
raise "Minimum volume size supported by this cloud is 100 GB."
end

Expand Down Expand Up @@ -376,7 +376,7 @@ def create_volume(name, size, description = "", snapshot_id = nil, options = {})
#
def get_volume_type_href(cloud, size, options = {})
case cloud
when 'rackspace-ng'
when 'rackspace'
# Set SATA as the default volume type for Rackspace Open Cloud
options[:volume_type] = 'SATA' unless options[:volume_type]
when 'cloudstack'
Expand Down
2 changes: 1 addition & 1 deletion metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
license 'Apache 2.0'
description 'Provides a resource to manage volumes on any cloud RightScale supports.'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '1.2.7'
version '1.2.8'

depends 'build-essential'

Expand Down
8 changes: 4 additions & 4 deletions spec/unit_test/provider_rightscale_volume_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ def run_action(action_sym)

context "on Rackspace Open Cloud" do
it "should not raise execption" do
node.set['cloud']['provider'] = 'rackspace-ng'
node.set['cloud']['provider'] = 'rackspace'
expect {
run_action(:delete)
}.to_not raise_error
Expand Down Expand Up @@ -472,7 +472,7 @@ def run_action(action_sym)
end

context "given the name and size for the volume" do
context "the cloud provider is not rackspace-ng, cloudstack, or vsphere" do
context "the cloud provider is not rackspace, cloudstack, or vsphere" do
it "should create the volume" do
node.set['cloud']['provider'] = 'some_cloud'
client_stub.should_receive(:volumes).and_return(volume_resource)
Expand Down Expand Up @@ -529,8 +529,8 @@ def create_test_volume_type(name, id, size, href)
end
end

context 'when the cloud is rackspace-ng' do
let(:cloud) { 'rackspace-ng' }
context 'when the cloud is rackspace' do
let(:cloud) { 'rackspace' }
let(:sata_href) { '/api/clouds/2374/volume_types/FDQ9LAJ83V4QT' }

before(:each) do
Expand Down
4 changes: 2 additions & 2 deletions test/cookbooks/test-rightscale_volume/recipes/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class Chef::Resource
include_recipe 'rightscale_volume::default'

# Set minimum volume size to 100GB for Rackspace Open Clouds (cloud-specific feature)
volume_size = node[:cloud][:provider] == 'rackspace-ng' ? 100 : 1
volume_size = node[:cloud][:provider] == 'rackspace' ? 100 : 1

# Set the volume name with the current UNIX timestamp so that multiple test runs
# do not overlap each other in case of failures
Expand Down Expand Up @@ -234,7 +234,7 @@ class Chef::Resource
block do
if is_volume_deleted?(test_volume_2)
Chef::Log.info 'TESTING action_delete -- PASSED'
elsif ['rackspace-ng', 'openstack'].include?(node['cloud']['provider'])
elsif ['rackspace', 'openstack'].include?(node['cloud']['provider'])
Chef::Log.info 'TESTING action_delete -- SKIPPED cannot delete volume if it has dependent snapshots'
else
raise 'TESTING action_delete -- FAILED'
Expand Down

0 comments on commit 809a555

Please sign in to comment.