[chef] Re: Re: Re: Re: Overriding default attributes


Chronological Thread 
  • From: Leonard Messier < >
  • To:
  • Subject: [chef] Re: Re: Re: Re: Overriding default attributes
  • Date: Wed, 5 Feb 2014 18:25:36 +0100

Thanks Daniel,

I had misunderstood the term « resource ». I thought it couldn't find the needed data bag. 
I was not aware of the need to specify dependencies in the metadata file when including a recipe in another. 
I think I should run foodcritic on my cookbooks to avoid such problems in the future.




2014-02-05 Daniel DeLeo < " target="_blank"> >:

On Wednesday, February 5, 2014 at 5:08 AM, Leonard Messier wrote:


Thanks Tom,

Changing it the way you did removed this error. However, another one appeared.

When trying to create the sudoers.d directory, chef complained about insufficient permissions. Reading further in the sudo's cookbook readme, I found a mention of the « sysadmin » group not beeing created by the sudo cookbook itself. 
I thought that I would install the users community cookbook, that essentially creates the sysadmin group when the sysadmins recipe is included. I created a users in data_bags/users, belonging to a sysadmin group. I get the following error :

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

This means more or less what it says. There is no resource named `users_manage` defined. If you expect this to be provided by a LWRP, and you don’t have a typo or something, then the cookbook isn’t being loaded properly. On chef-solo, the most common cause of this is that you are using a cookbook that is not in your run_list and also not in the dependencies of any cookbooks in your run_list. Chef-solo will allow you to run recipes from such cookbooks, but the earlier stage of the chef run uses the run_list and dependency information to determine the correct order to load LWRPs, attributes files, and other non-recipe files. So a cookbook that isn’t in the run_list or reachable by dependencies won’t have its non-recipe files loaded, which will cause errors like this.

See also:


HTH,

-- 
Daniel DeLeo




--
LĂ©onard Messier
DĂ©veloppeur web PHP/_javascript_/MySQL
http://www.leonardmessier.com



Archive powered by MHonArc 2.6.16.

§