Issue with adding role to a node

346 views
Skip to first unread message

Durai Sundarackannan

unread,
Sep 24, 2014, 12:37:37 PM9/24/14
to learnchef-funda...@googlegroups.com
  1. I am currently taking Module3 webinar trainging (http://learn.getchef.com/fundamentals-series/week-3/) and experiencing an issue.  After defining the role “webserver”, tried adding that role.  But it added it as “recipe[roles]”.  What could be the issue? 

------------------------------------------------------------ 

C:\chef-repo>knife role show webserver

chef_type:           role

default_attributes:

  apache:

    greeting: webminar

description:

env_run_lists:

json_class:          Chef::Role

name:                webserver

override_attributes:

run_list:            recipe[apache]

 

C:\chef-repo>knife node run_list add module3 "role[webserver]"

module3:

  run_list: recipe[roles]

C:\chef-repo>knife node show module3

Node Name:   module3

Environment: _default

FQDN:        centos63.example.com

IP:          10.160.201.90

Run List:    recipe[roles]

Roles:

Recipes:     apache, apache::default

Platform:    centos 6.4

Tags:

-------------------------------------------------------------  

Elon Bar-Evan

unread,
Sep 24, 2014, 6:51:48 PM9/24/14
to learnchef-funda...@googlegroups.com
This is a known bug, and the problem comes from including the letter 's' in the role name. This only affects Windows workstations.

So, the options for now are:

a) rename the role so it doesn't have a letter 's' in to (like "webhead" instead of "webserver")
b) escape the role name using backticks and single quotes.  The backtick is on the same key as the tilde ~ on the top left of your keyboard.
This would look like:   
C:\chef-repo>knife node run_list add module3 `'role[webserver]`'     I am using backtick single-quote at the beginning and backtick single quote at the end of the role declaration.

Let me know if this doesn't solve it for you.

-Elon

Elon Bar-Evan

unread,
Sep 24, 2014, 6:52:44 PM9/24/14
to learnchef-funda...@googlegroups.com
Also, make sure to remove the bogus recipe[roles] 
> knife node run_list remove module3 "recipe[roles]"

Durai Sundarackannan

unread,
Sep 24, 2014, 10:03:25 PM9/24/14
to learnchef-funda...@googlegroups.com
Thanks Elon for your response.  I have tried with "escape the role name using backticks and single quotes."  But it did not help and produced the following error.

               ERROR: ArgumentError: Unable to create Chef::RunList::RunListItem from String:"`role[webserver]`": must be recipe[] or role[]

Any way, I have corrected it through Chef Manager Web GUI by editing the node Run List.  Thanks again.
Reply all
Reply to author
Forward
0 new messages