Re: Re: Roles fail to load in chef-solo run_list

Tom,

I don't know if you ever solved this, but I ran across the same thing and
opened a bug about it.

http://tickets.opscode.com/browse/CHEF-3918

TL;DR; -- if your roles file doesn't have the right json_class attribute
then I believe Chef tries to interpret it as a regular Hash and explodes.

  • Julian

On Tue, Sep 25, 2012 at 9:49 AM, Tom tom.ashley@gmail.com wrote:

I only include one role in the other. I don't see how that makes an
infinite/dead loop. I don't include each role in each other.

Take the roles out of the run list so they are only recipes. Everything
runs ok. Include one role in the other and run one role, I get the hash
error.

It seems more like chef cannot handle loading a sub-role.

On 25 September 2012 14:29, William Herry WilliamHerryChina@gmail.comwrote:

seem like a dead loop, role[minidnsmaster] included a role[yum-server]
which included role[minidnsmaster] again

On Tue, Sep 25, 2012 at 9:23 PM, Tom tom.ashley@gmail.com wrote:

I'm trying to add an existing role to the run list of another role using
chef-solo
Both roles run independently alone, but when I add one role to the
run_list of the other I receive a Hash error.

roles:

{
"name": "yum-server",
"chef_type": "role",

"default_attributes": {
"apache2": {
"listen_ports": ["80", "443"],
"default_site_enabled": false
}
},
"run_list": [ "recipe[apache2]",
"recipe[apache2::mod_ssl]",
"recipe[apache2::yum-website]",
"role[minidnsmaster]"
]
}

{
"name": "minidnsmaster",
"chef_type": "role",

"default_attributes": {
"bind": {
"slaves": [ "10.39.102.20", "10.31.157.234" ]
}
},

"run_list": [ "recipe[build-essential]",
"recipe[sudo::bind]",
"recipe[bind]",
"recipe[bind::master]",
"recipe[yum-server]",
"recipe[yum-server::repos]",
"recipe[yum-server::build_alfresco]",
"recipe[yum-server::build_cloudportal]"
]
}

role[yum-server] fails to run as it is calling role[minidnsmaster] with
this error:

2012-09-25T14:17:22+01:00] INFO: *** Chef 10.14.2 ***
[2012-09-25T14:17:23+01:00] INFO: Setting the run_list to
["recipe[apache2]", "recipe[apache2::mod_ssl]",
"recipe[apache2::yum-website]", "role[minidnsmaster]"] from JSON

================================================================================
Error expanding the run_list:

================================================================================

Unexpected Error:

NoMethodError: undefined method `run_list_for' for
#Hash:0x0000000287f4e0

[2012-09-25T14:17:23+01:00] FATAL: Stacktrace dumped to
/var/cache/chef-solo/chef-stacktrace.out
[2012-09-25T14:17:23+01:00] FATAL: NoMethodError: undefined method
`run_list_for' for #Hash:0x0000000287f4e0

I can see somewhere combining the JSON hashes is failing.

Any ideas?

Thanks

Tom

--
[ Julian C. Dunn jdunn@aquezada.com * Sorry, I'm ]
[ WWW: Julian Dunn's Blog - Commentary on media, technology, and everything in between. * only Web 1.0 ]
[ gopher://sdf.org/1/users/keymaker/ * compliant! ]
[ PGP: 91B3 7A9D 683C 7C16 715F 442C 6065 D533 FDC2 05B9 ]