Obligatory first line greeting that is apparently acceptable to ignore-
I have a need to determine a Chef cookbook version at runtime, so I can
compare it with a local file but I haven’t found the secret sauce to make
that work. Since I’ve run out of time that I can work on it until later
today or tomorrow, I thought I’d put this out to the community. I thought
there was something I could do with Chef::CookbookVersion but now I think
that’s off track.
I have a hacky way that uses file system paths but that makes me kinda sad
to use.
On Thu, Apr 24, 2014 at 1:29 PM, Tucker junk@gmail.com wrote:
Obligatory first line greeting that is apparently acceptable to ignore-
I have a need to determine a Chef cookbook version at runtime, so I can
compare it with a local file but I haven't found the secret sauce to make
that work. Since I've run out of time that I can work on it until later
today or tomorrow, I thought I'd put this out to the community. I thought
there was something I could do with Chef::CookbookVersion but now I think
that's off track.
I have a hacky way that uses file system paths but that makes me kinda sad
to use.
On Thu, Apr 24, 2014 at 1:29 PM, Tucker junk@gmail.com wrote:
Obligatory first line greeting that is apparently acceptable to ignore-
I have a need to determine a Chef cookbook version at runtime, so I can
compare it with a local file but I haven't found the secret sauce to make
that work. Since I've run out of time that I can work on it until later
today or tomorrow, I thought I'd put this out to the community. I thought
there was something I could do with Chef::CookbookVersion but now I think
that's off track.
I have a hacky way that uses file system paths but that makes me kinda
sad to use.
pretty long i think. the handler uses the same api. cookbook_name and
recipe_name are two attribute present in any chef recipe, and automatically
populated with the current name while run_context is the central object
that ties together everything(including the cookbook collection) and
available from node,, recipe etc.
given we are inside the current recipe, it assumes that the current recipe
is already loaded and available in resource collection, i.e.
node.run_context.cookbook_collection[cookbook_name] is not nil. this will
fail with chef-apply but should be safe within chef-solo or client runs
On Thu, Apr 24, 2014 at 1:29 PM, Tucker junk@gmail.com wrote:
Obligatory first line greeting that is apparently acceptable to ignore-
I have a need to determine a Chef cookbook version at runtime, so I can
compare it with a local file but I haven't found the secret sauce to make
that work. Since I've run out of time that I can work on it until later
today or tomorrow, I thought I'd put this out to the community. I thought
there was something I could do with Chef::CookbookVersion but now I think
that's off track.
I have a hacky way that uses file system paths but that makes me kinda
sad to use.
Awesome. That's much simpler than what we have been doing and avoids the
issue of different version of Chef doing different things. For reference,
this is what I just scrapped:
pretty long i think. the handler uses the same api. cookbook_name and
recipe_name are two attribute present in any chef recipe, and automatically
populated with the current name while run_context is the central object
that ties together everything(including the cookbook collection) and
available from node,, recipe etc.
given we are inside the current recipe, it assumes that the current recipe
is already loaded and available in resource collection, i.e.
node.run_context.cookbook_collection[cookbook_name] is not nil. this will
fail with chef-apply but should be safe within chef-solo or client runs
On Thu, Apr 24, 2014 at 1:29 PM, Tucker junk@gmail.com wrote:
Obligatory first line greeting that is apparently acceptable to ignore-
I have a need to determine a Chef cookbook version at runtime, so I can
compare it with a local file but I haven't found the secret sauce to make
that work. Since I've run out of time that I can work on it until later
today or tomorrow, I thought I'd put this out to the community. I thought
there was something I could do with Chef::CookbookVersion but now I think
that's off track.
I have a hacky way that uses file system paths but that makes me kinda
sad to use.
Obligatory first line greeting that is apparently acceptable to
ignore-
I have a need to determine a Chef cookbook version at runtime, so
I can compare it with a local file but I haven't found the secret
sauce to make that work. Since I've run out of time that I can
work on it until later today or tomorrow, I thought I'd put this
out to the community. I thought there was something I could do
with Chef::CookbookVersion but now I think that's off track.
I have a hacky way that uses file system paths but that makes me
kinda sad to use.
--
--tucker