env_run_list vs run_list


#1

I’m confused regarding the env_run_lists in the following roles/base.rb. And this didn’t http://wiki.opscode.com/display/chef/Roles#Roles-envrunlists make me clear enough.

name "base"
description "Base role applied to all nodes."
run_list(
  "recipe[apt]",
  "recipe[build-essential]",
  "recipe[git]",
  "recipe[zsh]",
  "recipe[users::sysadmins]",
  "recipe[sudo]",
)

env_run_lists(
  "production" => ["recipe[chef-client]"], 
  "staging" => [])
)

When I run the knife ec2 server create -E staging ...., i.e. in the staging environment, the node’s run_list is blank.

Is this the expected behavior? I was thinking that the env_run_lists items would be added up with the items in the above run_list items, just like the rails app’s config/database.yml


@millisami
~ Sachin Sagar Rai
Ruby on Rails Developer
http://tfm.com.np
http://nepalonrails.tumblr.com
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)


#2

On Apr 20, 2012, at 12:57 PM, Sachin Sagar Rai wrote:

I’m confused regarding the env_run_lists in the following roles/base.rb. And this didn’t http://wiki.opscode.com/display/chef/Roles#Roles-envrunlists make me clear enough.

name "base"
description "Base role applied to all nodes."
run_list(
  "recipe[apt]",
  "recipe[build-essential]",
  "recipe[git]",
  "recipe[zsh]",
  "recipe[users::sysadmins]",
  "recipe[sudo]",
)

env_run_lists(
  "production" => ["recipe[chef-client]"], 
  "staging" => [])
)

When I run the knife ec2 server create -E staging ...., i.e. in the staging environment, the node’s run_list is blank.

Is this the expected behavior? I was thinking that the env_run_lists items would be added up with the items in the above run_list items, just like the rails app’s config/database.yml

As mentioned on the wiki page, the env run list is an override, so it totally replaces the default non-env run list if the env matches. Otherwise there would be no way to remove items and ordering would be much harder to grok.

–Noah


#3

Because it’s just Ruby:

name "base"
description “Base role applied to all nodes.”

all = [
“recipe[apt]”,
“recipe[build-essential]”,
“recipe[git]”,
“recipe[zsh]”,
“recipe[users::sysadmins]”,
“recipe[sudo]”,
]

run_list(all)

env_run_lists(
“production” => all + [“recipe[chef-client]”],
“staging” => all,
)

Cheers,
Jay

On Mon, Apr 23, 2012 at 2:36 PM, Noah Kantrowitz noah@coderanger.netwrote:

On Apr 20, 2012, at 12:57 PM, Sachin Sagar Rai wrote:

I’m confused regarding the env_run_lists in the following
roles/base.rb. And this didn’t
http://wiki.opscode.com/display/chef/Roles#Roles-envrunlists make me
clear enough.

name "base"
description "Base role applied to all nodes."
run_list(
  "recipe[apt]",
  "recipe[build-essential]",
  "recipe[git]",
  "recipe[zsh]",
  "recipe[users::sysadmins]",
  "recipe[sudo]",
)

env_run_lists(
  "production" => ["recipe[chef-client]"],
  "staging" => [])
)

When I run the knife ec2 server create -E staging ...., i.e. in the
staging environment, the node’s run_list is blank.

Is this the expected behavior? I was thinking that the env_run_lists
items would be added up with the items in the above run_list items, just
like the rails app’s config/database.yml

As mentioned on the wiki page, the env run list is an override, so it
totally replaces the default non-env run list if the env matches. Otherwise
there would be no way to remove items and ordering would be much harder to
grok.

–Noah


#4

@Jay, Thanks.
I’m so stupid.


@millisami
~ Sachin Sagar Rai
Ruby on Rails Developer
http://tfm.com.np
http://nepalonrails.tumblr.com
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)

On Tuesday, April 24, 2012 at 1:04 AM, Jay Feldblum wrote:

Because it’s just Ruby:

name "base"
description “Base role applied to all nodes.”

all = [
“recipe[apt]”,
“recipe[build-essential]”,
“recipe[git]”,
“recipe[zsh]”,
“recipe[users::sysadmins]”,
“recipe[sudo]”,
]

run_list(all)

env_run_lists(
“production” => all + [“recipe[chef-client]”],
“staging” => all,
)

Cheers,
Jay

On Mon, Apr 23, 2012 at 2:36 PM, Noah Kantrowitz <noah@coderanger.net (mailto:noah@coderanger.net)> wrote:

On Apr 20, 2012, at 12:57 PM, Sachin Sagar Rai wrote:

I’m confused regarding the env_run_lists in the following roles/base.rb. And this didn’t http://wiki.opscode.com/display/chef/Roles#Roles-envrunlists make me clear enough.

name "base"
description "Base role applied to all nodes."
run_list(
  "recipe[apt]",
  "recipe[build-essential]",
  "recipe[git]",
  "recipe[zsh]",
  "recipe[users::sysadmins]",
  "recipe[sudo]",
)

env_run_lists(
  "production" => ["recipe[chef-client]"],
  "staging" => [])
)

When I run the knife ec2 server create -E staging ...., i.e. in the staging environment, the node’s run_list is blank.

Is this the expected behavior? I was thinking that the env_run_lists items would be added up with the items in the above run_list items, just like the rails app’s config/database.yml

As mentioned on the wiki page, the env run list is an override, so it totally replaces the default non-env run list if the env matches. Otherwise there would be no way to remove items and ordering would be much harder to grok.

–Noah