From 70e4160abd634f00c3cbe619ab5b60e2433da4fa Mon Sep 17 00:00:00 2001 From: "grace.yu" Date: Fri, 3 Oct 2014 15:56:13 -0700 Subject: [PATCH] add None check for variable node[local_repo] Change-Id: Ia8b5c6542b2ea18c888eb2d4479144cb19a7e584 --- chef/cookbooks/mysql/recipes/ruby.rb | 2 +- chef/cookbooks/openstack-image/recipes/image_upload.rb | 2 +- chef/cookbooks/yum/providers/repository.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/chef/cookbooks/mysql/recipes/ruby.rb b/chef/cookbooks/mysql/recipes/ruby.rb index b853ec3..4188ba7 100644 --- a/chef/cookbooks/mysql/recipes/ruby.rb +++ b/chef/cookbooks/mysql/recipes/ruby.rb @@ -44,7 +44,7 @@ node['mysql']['client']['packages'].each do |name| resources("package[#{name}]").run_action(:install) end -if node['local_repo'] == "" +if node['local_repo'].nil? or node['local_repo'] == "" chef_gem 'mysql' else gem_package 'mysql' do diff --git a/chef/cookbooks/openstack-image/recipes/image_upload.rb b/chef/cookbooks/openstack-image/recipes/image_upload.rb index 1211775..d6ad807 100644 --- a/chef/cookbooks/openstack-image/recipes/image_upload.rb +++ b/chef/cookbooks/openstack-image/recipes/image_upload.rb @@ -26,7 +26,7 @@ if node['openstack']['image']['syslog']['use'] include_recipe 'openstack-common::logging' end -if node['local_repo'] != "" +unless node['local_repo'].nil? or node['local_repo'] == "" node.override['openstack']['image']['upload_image']['cirros'] = "#{node['local_repo']}/cirros-0.3.2-x86_64-disk.img" end diff --git a/chef/cookbooks/yum/providers/repository.rb b/chef/cookbooks/yum/providers/repository.rb index e79dccf..7e6dbaa 100644 --- a/chef/cookbooks/yum/providers/repository.rb +++ b/chef/cookbooks/yum/providers/repository.rb @@ -31,7 +31,7 @@ def whyrun_supported? end action :create do - if node['local_repo'] == "" + if node['local_repo'].nil? or node['local_repo'] == "" # Hack around the lack of "use_inline_resources" before Chef 11 by # uniquely naming the execute[yum-makecache] resources. Set the # notifies timing to :immediately for the same reasons. Remove both