I’m failing.
How does one determine the current node’s Chef environment from within a
recipe?
node[‘environment’] and node[‘chef_environment’] do not seem to be the way.
–
Jeff Blaine
kickflop.net
PGP/GnuPG Key ID: 0x0C8EDD02
I’m failing.
How does one determine the current node’s Chef environment from within a
recipe?
node[‘environment’] and node[‘chef_environment’] do not seem to be the way.
–
Jeff Blaine
kickflop.net
PGP/GnuPG Key ID: 0x0C8EDD02
node.environment() should do it
On Fri, Nov 7, 2014 at 1:02 PM, Jeff Blaine jblaine@kickflop.net wrote:
I'm failing.
How does one determine the current node's Chef environment from within a
recipe?node['environment'] and node['chef_environment'] do not seem to be the way.
--
Jeff Blaine
kickflop.net
PGP/GnuPG Key ID: 0x0C8EDD02
node.chef_environment also works.
--
~~ StormeRider ~~
"Every world needs its heroes [...] They inspire us to be better than we
are. And they protect from the darkness that's just around the corner."
(from Smallville Season 6x1: "Zod")
On why I hate the phrase "that's so lame"... http://bit.ly/Ps3uSS
On Fri, Nov 7, 2014 at 10:07 AM, Nathen Harvey nharvey@getchef.com wrote:
node.environment() should do it
On Fri, Nov 7, 2014 at 1:02 PM, Jeff Blaine jblaine@kickflop.net wrote:
I'm failing.
How does one determine the current node's Chef environment from within a
recipe?node['environment'] and node['chef_environment'] do not seem to be the
way.--
Jeff Blaine
kickflop.net
PGP/GnuPG Key ID: 0x0C8EDD02
You can do the following on the node to get all its attributes
knife node show node_name -l -Fj (that a dash-lowercase-L)
This will show
{
"name": "london-routemanager",
"chef_environment": "arqiva-dev-nslice",
......
}
So now you know the that node.chef_environment will give you the node's environment
Chris
-----Original Message-----
From: Jeff Blaine [mailto:jblaine@kickflop.net]
Sent: Friday, November 07, 2014 1:02 PM
To: chef@lists.opscode.com
Subject: [chef] Query node's environment from recipe?
I'm failing.
How does one determine the current node's Chef environment from within a recipe?
node['environment'] and node['chef_environment'] do not seem to be the way.
--
Jeff Blaine
kickflop.net
PGP/GnuPG Key ID: 0x0C8EDD02