Starting Chef Client, version 11.4.4
Compiling Cookbooks...
================================================================================
Recipe Compile Error in /home/virtualeo/.oh-my-chef/cookbooks/system/recipes/default.rb
================================================================================
NameError
---------
Cannot find a resource for users_manage on ubuntu version 13.04
Cookbook Trace:
---------------
/home/virtualeo/.oh-my-chef/vendor/cookbooks/users/recipes/sysadmins.rb:23:in `from_file'
/home/virtualeo/.oh-my-chef/cookbooks/system/recipes/default.rb:1:in `from_file'
Relevant File Content:
----------------------
/home/virtualeo/.oh-my-chef/vendor/cookbooks/users/recipes/sysadmins.rb:
16: # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17: # See the License for the specific language governing permissions and
18: # limitations under the License.
19: #
20:
21: # Searches data bag "users" for groups attribute "sysadmin".
22: # Places returned users in Unix group "sysadmin" with GID 2300.
23>> users_manage "sysadmin" do
24: group_id 2300
25: action [ :remove, :create ]
26: end
27:
[2014-02-05T13:54:52+01:00] ERROR: Running exception handlers
[2014-02-05T13:54:52+01:00] ERROR: Exception handlers complete
Chef Client failed. 0 resources updated
[2014-02-05T13:54:53+01:00] FATAL: Stacktrace dumped to /home/virtualeo/.chef/state/cache/chef-stacktrace.out
[2014-02-05T13:54:53+01:00] FATAL: NameError: Cannot find a resource for users_manage on ubuntu version 13.04
The reason your bit is failing is that the precedence for attributes specified via the -j flag is normal. If you get rid of the “override_attributes” level of your hash and bring authorization to the top level it should work.On February 3, 2014 at 7:08:39 AM, Leonard Messier ( " target="_blank"> ) wrote:
Ohai there,I'm quite new to chef, sorry for the noobish question. Here is my problem :I had a set of recipes for my developpment machine that I used to run with sudo like this :sudo chef-solo -c config/solo.rb -j config/system.json
At some point, I decided to rework it from the ground up with chefspec testing which lead me to understand that using sudo was a very bad idea.I included the community sudo cookbook in my kitchen, but I don't have a clue on how to override the default attributes being set on it. This is the last content of my system.json file.{"run_list": [ "system::default" ],"override_attributes": {"authorization": {"sudo": {"prefix": "/etc","groups": [ "virtualeo" ],"users": [ "virtualeo" ],"passwordless": "true","include_sudoers_d": "true"}}}}Launching the command in a ubuntu 13.04 that I virtualized for testing, I get the following result :Starting Chef Client, version 11.4.4
Compiling Cookbooks...
================================================================================
Recipe Compile Error in /home/virtualeo/.oh-my-chef/cookbooks/system/recipes/default.rb
================================================================================
NoMethodError
-------------
undefined method `[]' for nil:NilClass
Cookbook Trace:
---------------
/home/virtualeo/.oh-my-chef/vendor/cookbooks/sudo/recipes/default.rb:20:in `from_file'
/home/virtualeo/.oh-my-chef/cookbooks/system/recipes/default.rb:1:in `from_file'
Relevant File Content:
----------------------
/home/virtualeo/.oh-my-chef/vendor/cookbooks/sudo/recipes/default.rb:
13: # Unless required by applicable law or agreed to in writing, software
14: # distributed under the License is distributed on an "AS IS" BASIS,
15: # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16: # See the License for the specific language governing permissions and
17: # limitations under the License.
18: #
19:
20>> prefix = node['authorization']['sudo']['prefix']
21:
22: package 'sudo' do
23: not_if 'sudo -V'
24: end
25:
26: if node['authorization']['sudo']['include_sudoers_d']
27: directory "#{prefix}/sudoers.d" do
28: mode '0755'
29: owner 'root'
[2014-02-03T13:54:31+01:00] ERROR: Running exception handlers
[2014-02-03T13:54:31+01:00] ERROR: Exception handlers complete
Chef Client failed. 0 resources updated
[2014-02-03T13:54:31+01:00] FATAL: Stacktrace dumped to /home/virtualeo/.chef/state/cache/chef-stacktrace.out
[2014-02-03T13:54:31+01:00] FATAL: NoMethodError: undefined method `[]' for nil:NilClassWhat I understand from this stacktrace is that « node['authorization']['sudo']['prefix'] » causes the error.I guess the solution is pretty straightforward but I'm stuck for now !Thanks in advance--
Léonard Messier
Archive powered by MHonArc 2.6.16.