Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8080875
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T16:32:56+00:00 2026-06-05T16:32:56+00:00

Say I have the following chef role: name test description role for test run_list

  • 0

Say I have the following chef role:

name "test"
description "role for test"
run_list %w(recipe[cookbook_name])
default_attributes(
  :cookbook_name => {
    :a => 1
  }
)

And the corresponding environment:

name "test environment"
description "environment for test"
default_attributes(
  :cookbook_name => {
    :b => 2
  }
)

And then in my cookbook’s attributes I have something like:

parent = default[:cookbook_name]
parent[:c] = 3

The attribute documentation would have me believe that these would be available in the recipe context from node[:cookbook_name][:a] or node[:cookbook_name][:b]. However, when I try to access those in my actual cookbook, I get nil. What’s going on? Am I misunderstanding the role of these attributes? I think that it’s worth noting that even if I set defaults for these attributes in the attributes file, I get the same result, leading me to believe I’m accessing the attributes incorrectly.

What am I doing wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T16:32:58+00:00Added an answer on June 5, 2026 at 4:32 pm

    This is indeed how things should work. Inside the “cookbook_name” recipe you should be able to access the :cookbook_name hash with two elements :a and :b.

    Have you set the run list and environment on the node to include the role and environment you have listed? Running knife node show should show this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Say I have the following DOM element in my piece of code: <div id=test>
Lets say i have following class public class abc { int id; string name;
Lets say I have following: library(XML) my.xml <- ' <tv> <show> <name>Star Trek TNG</name>
Let's say I have following arrays: $first = [ ['id' => 5, 'name' =>
Let's say I have following data: Name Priority A 3 A 5 B 1
Say I have the following string. <description>This is the description,<strong> I want to retrieve
Let's say I have following query: SELECT Id, Name, ForeignKeyId, (SELECT TOP (1) FtName
Say I have the following form that's in classic asp: <form name=impdata id=impdata method=POST
Say I have the following: function Myobj = { name: Julia, birthdate: xxxx, genres:
Say I have the following my strings.xml file: <string name=string0>Lorem</string> <string name=string1>ipsum</string> <string name=string2>dolor</string>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.