Skip to content

Commit

Permalink
Avoid node.set deprecation warnings
Browse files Browse the repository at this point in the history
Signed-off-by: Tim Smith <tsmith@chef.io>
  • Loading branch information
tas50 committed Sep 9, 2016
1 parent a592c28 commit 7d40ec8
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion libraries/supermarket_server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def merged_supermarket_config

if node['supermarket_omnibus']['custom_repo_recipe']
Chef::Log.info "Using custom repo recipe: #{node['supermarket_omnibus']['custom_repo_recipe']}"
node.set['chef-ingredient']['custom-repo-recipe'] = node['supermarket_omnibus']['custom_repo_recipe']
node.normal['chef-ingredient']['custom-repo-recipe'] = node['supermarket_omnibus']['custom_repo_recipe']
end

chef_ingredient 'supermarket' do
Expand Down
40 changes: 20 additions & 20 deletions spec/unit/libraries/supermarket_server_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
context 'When chef_server (oc-id) attributes are correctly specified' do
let(:chef_run) do
runner = ChefSpec::SoloRunner.new(platform: 'redhat', version: '6.5', step_into: 'supermarket_server') do |node|
node.set['supermarket_omnibus']['chef_server_url'] = 'https://chefserver.mycorp.com'
node.set['supermarket_omnibus']['chef_oauth2_app_id'] = 'blahblah'
node.set['supermarket_omnibus']['chef_oauth2_secret'] = 'bob_lawblaw'
node.normal['supermarket_omnibus']['chef_server_url'] = 'https://chefserver.mycorp.com'
node.normal['supermarket_omnibus']['chef_oauth2_app_id'] = 'blahblah'
node.normal['supermarket_omnibus']['chef_oauth2_secret'] = 'bob_lawblaw'
end
runner.converge(described_recipe)
end
Expand All @@ -55,11 +55,11 @@
context 'When additional config is provided' do
let(:chef_run) do
runner = ChefSpec::SoloRunner.new(platform: 'redhat', version: '6.5', step_into: %w(chef_ingredient supermarket_server)) do |node|
node.set['supermarket_omnibus']['package_repo'] = 'current'
node.set['supermarket_omnibus']['chef_server_url'] = 'https://chefserver.mycorp.com'
node.set['supermarket_omnibus']['chef_oauth2_app_id'] = 'blahblah'
node.set['supermarket_omnibus']['chef_oauth2_secret'] = 'bob_lawblaw'
node.set['supermarket_omnibus']['config'] = { 'chef_oauth2_mode' => 'blah' }
node.normal['supermarket_omnibus']['package_repo'] = 'current'
node.normal['supermarket_omnibus']['chef_server_url'] = 'https://chefserver.mycorp.com'
node.normal['supermarket_omnibus']['chef_oauth2_app_id'] = 'blahblah'
node.normal['supermarket_omnibus']['chef_oauth2_secret'] = 'bob_lawblaw'
node.normal['supermarket_omnibus']['config'] = { 'chef_oauth2_mode' => 'blah' }
end
runner.converge(described_recipe)
end
Expand Down Expand Up @@ -89,10 +89,10 @@
context 'When a repository current is specified' do
let(:chef_run) do
runner = ChefSpec::SoloRunner.new(platform: 'redhat', version: '6.5', step_into: %w(chef_ingredient supermarket_server)) do |node|
node.set['supermarket_omnibus']['package_repo'] = 'current'
node.set['supermarket_omnibus']['chef_server_url'] = 'https://chefserver.mycorp.com'
node.set['supermarket_omnibus']['chef_oauth2_app_id'] = 'blahblah'
node.set['supermarket_omnibus']['chef_oauth2_secret'] = 'bob_loblaw'
node.normal['supermarket_omnibus']['package_repo'] = 'current'
node.normal['supermarket_omnibus']['chef_server_url'] = 'https://chefserver.mycorp.com'
node.normal['supermarket_omnibus']['chef_oauth2_app_id'] = 'blahblah'
node.normal['supermarket_omnibus']['chef_oauth2_secret'] = 'bob_loblaw'
end
runner.converge(described_recipe)
end
Expand Down Expand Up @@ -123,10 +123,10 @@
context 'When a package_url is specified, packages.chef.io should not be used' do
let(:chef_run) do
runner = ChefSpec::SoloRunner.new(platform: 'redhat', version: '6.5', step_into: 'supermarket_server') do |node|
node.set['supermarket_omnibus']['package_url'] = 'https://somethingelse.chef.io/stable/el/6/supermarket-1.10.1~alpha.0-1.el5.x86_64.rpm'
node.set['supermarket_omnibus']['chef_server_url'] = 'https://chefserver.mycorp.com'
node.set['supermarket_omnibus']['chef_oauth2_app_id'] = 'blahblah'
node.set['supermarket_omnibus']['chef_oauth2_secret'] = 'bob_loblaw'
node.normal['supermarket_omnibus']['package_url'] = 'https://somethingelse.chef.io/stable/el/6/supermarket-1.10.1~alpha.0-1.el5.x86_64.rpm'
node.normal['supermarket_omnibus']['chef_server_url'] = 'https://chefserver.mycorp.com'
node.normal['supermarket_omnibus']['chef_oauth2_app_id'] = 'blahblah'
node.normal['supermarket_omnibus']['chef_oauth2_secret'] = 'bob_loblaw'
end
runner.converge(described_recipe)
end
Expand All @@ -152,10 +152,10 @@
context 'When a package_url is specified, the Rpm provider should be used on RHEL systems' do
let(:chef_run) do
runner = ChefSpec::SoloRunner.new(platform: 'redhat', version: '6.5', step_into: %w(chef_ingredient supermarket_server)) do |node|
node.set['supermarket_omnibus']['package_url'] = 'https://somethingelse.chef.io/chef/stable/packages/el/6/supermarket-1.10.1~alpha.0-1.el5.x86_64.rpm'
node.set['supermarket_omnibus']['chef_server_url'] = 'https://chefserver.mycorp.com'
node.set['supermarket_omnibus']['chef_oauth2_app_id'] = 'blahblah'
node.set['supermarket_omnibus']['chef_oauth2_secret'] = 'bob_loblaw'
node.normal['supermarket_omnibus']['package_url'] = 'https://somethingelse.chef.io/chef/stable/packages/el/6/supermarket-1.10.1~alpha.0-1.el5.x86_64.rpm'
node.normal['supermarket_omnibus']['chef_server_url'] = 'https://chefserver.mycorp.com'
node.normal['supermarket_omnibus']['chef_oauth2_app_id'] = 'blahblah'
node.normal['supermarket_omnibus']['chef_oauth2_secret'] = 'bob_loblaw'
end
runner.converge(described_recipe)
end
Expand Down
6 changes: 3 additions & 3 deletions spec/unit/test_custom_repo_setup_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
context 'When a custom recipe is specified, the custom recipe should be used' do
let(:chef_run) do
runner = ChefSpec::SoloRunner.new(platform: 'redhat', version: '6.5', step_into: %w(chef_ingredient supermarket_server)) do |node|
node.set['supermarket_omnibus']['chef_server_url'] = 'https://chefserver.mycorp.com'
node.set['supermarket_omnibus']['chef_oauth2_app_id'] = 'blahblah'
node.set['supermarket_omnibus']['chef_oauth2_secret'] = 'bob_lawblaw'
node.normal['supermarket_omnibus']['chef_server_url'] = 'https://chefserver.mycorp.com'
node.normal['supermarket_omnibus']['chef_oauth2_app_id'] = 'blahblah'
node.normal['supermarket_omnibus']['chef_oauth2_secret'] = 'bob_lawblaw'
end
runner.converge(described_recipe)
end
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/cookbooks/test/recipes/custom_repo_setup.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Configure a custom repository setup recipe
node.set['supermarket_omnibus']['custom_repo_recipe'] = 'custom_repo::custom_repo_recipe'
node.normal['supermarket_omnibus']['custom_repo_recipe'] = 'custom_repo::custom_repo_recipe'

supermarket_server 'supermarket' do
chef_server_url node['supermarket_omnibus']['chef_server_url']
Expand Down

0 comments on commit 7d40ec8

Please sign in to comment.