Skip to content

Commit

Permalink
Merge pull request #242 from HewlettPackard/os_deployment_setting_fix
Browse files Browse the repository at this point in the history
Fixes #241
  • Loading branch information
tmiotto authored Jun 21, 2017
2 parents 6aa913d + 8f82814 commit 7d5e127
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## v4.5.1 (New Release)

#### Bug fixes & Enhancements
- [#241](https://github.com/HewlettPackard/oneview-sdk-ruby/issues/241) Wrong method name in Server Profile

## v4.5.0

#### New Resources:
Expand Down
2 changes: 1 addition & 1 deletion lib/oneview-sdk/resource/api300/synergy/server_profile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def self.get_sas_logical_jbod_attachment(client, name)
# The internal hashes may contain:
# - 'name' [String] name of the attribute
# - 'value' [String] value of the attribute
def set_os_deployment_setttings(os_deployment_plan, custom_attributes = [])
def set_os_deployment_settings(os_deployment_plan, custom_attributes = [])
os_deployment_plan.ensure_uri
@data['osDeploymentSettings'] ||= {}
@data['osDeploymentSettings']['osDeploymentPlanUri'] = os_deployment_plan['uri']
Expand Down
8 changes: 4 additions & 4 deletions spec/unit/resource/api300/synergy/server_profile_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -493,14 +493,14 @@
end
end

describe '#set_os_deployment_setttings' do
describe '#set_os_deployment_settings' do
let(:os_deployment_plan) { OneviewSDK::API300::Synergy::OSDeploymentPlan.new(@client_300, uri: '/os-deployment-plan/1') }

it 'should pupulate osDeploymentSettings attribute correctly' do
custom_attrs = [{ name: 'field.one', value: 'value1' }, { name: 'field.two', value: 'value2' }]
expect(@item['osDeploymentSettings']).not_to be

@item.set_os_deployment_setttings(os_deployment_plan, custom_attrs)
@item.set_os_deployment_settings(os_deployment_plan, custom_attrs)

expected_settings = { 'osDeploymentPlanUri' => '/os-deployment-plan/1', 'osCustomAttributes' => custom_attrs }
expect(@item['osDeploymentSettings']).to eq(expected_settings)
Expand All @@ -512,7 +512,7 @@
settings = { 'osDeploymentPlanUri' => '/fake/uri', 'osCustomAttributes' => custom_attrs }
@item['osDeploymentSettings'] = settings

@item.set_os_deployment_setttings(os_deployment_plan, [{ name: 'new_name', value: 'new_value' }])
@item.set_os_deployment_settings(os_deployment_plan, [{ name: 'new_name', value: 'new_value' }])

expected_settings = { 'osDeploymentPlanUri' => '/os-deployment-plan/1', 'osCustomAttributes' => [{ name: 'new_name', value: 'new_value' }] }
expect(@item['osDeploymentSettings']).to eq(expected_settings)
Expand All @@ -522,7 +522,7 @@
context 'when os_deployment_plan has not URI' do
it 'should throw IncompleteResource error' do
wrong_os_deployment_plan = OneviewSDK::API300::Synergy::OSDeploymentPlan.new(@client_300)
expect { @item.set_os_deployment_setttings(wrong_os_deployment_plan) }
expect { @item.set_os_deployment_settings(wrong_os_deployment_plan) }
.to raise_error(OneviewSDK::IncompleteResource, /Please set uri attribute*/)
end
end
Expand Down

0 comments on commit 7d5e127

Please sign in to comment.