Chef-grafana lwrp implementation feedback

Hi,
I’ve been working on an overhaul and update for the chef-grafana cookbook
to support Grafana 2. This release will introduce LWRPs and despite looking
at a handful of CHEF supported cookbooks, but I’m not sure what I’ve
written is in line with the new hotness for LWRPs.

Could someone(s) have a look and provide some feedback on the
implementation? https://github.com/JonathanTron/chef-grafana/tree/grafana-2

Thanks,
Mike

Hi guys,

I have met an issue and can’t overcome it so far.
Will be grateful to you for any advises…

Here what I have in my recipe: ruby_block “Backing up old application folders” do block do backup *apps end action :nothing end.run_action(:run) This is needed to run that block not during convergence phase but during compilation phase. So that it’s done before other resources start its run…

“backup” method is called from library.rb file in …/libraries/ folder within my cookbook: def backup *apps apps.each do |app| windows_zipfile archive_path(app) do source “#{zilliant_folder}\#{app}” action :zip only_if { !::File.exists?(archive_path(app)) } end end end So what I expect is to do folders backup during compilation phase… But…
During run (compilation phase) it finds “backup” method but it fails with finding “windows_zipfile” method. Even though I have put dependency on “windows” cookbook in my “metadata.rb” file of my cookbook. If I call that method “backup” out of “ruby_block” it works fine. But I need to call it during compile phase (so that it done its job before any other resources). Why ruby_block doesn’t work for finding “windows_zipfile” method? How can I implement what I am looking for?
I tried to use “windows_zipfile” by itself outside of ruby_block. But it doesn’t have possibility to be run during compile phase. Or I have not figured it out at least. :frowning:
Here is chef-client run-example:
At the very beginning chef-client loads all needed cookbooks dependencies and then fails with that resource from windows cookbook: PS C:\Users\tklym> chef-client Starting Chef Client, version 12.3.0 resolving cookbooks for run list: [“zFilesUpdate::Spring15-5_UP_mx”] Synchronizing Cookbooks: - artifact - windows - chef_handler - zFilesUpdate Compiling Cookbooks… Recipe: zFilesUpdate::Spring15-5_UP_mx * directory[c:\chef\cache\artifact_file] action delete - delete existing directory c:\chef\cache\artifact_file * ruby_block[Backing up old application folders] action run ================================================================================ Error executing action run on resource ‘ruby_block[Backing up old application folders]’ ================================================================================ NoMethodErro r ------------- undefined method `windows_zipfile’ for Chef::Resource::RubyBlock Thank you in advance for any of your help or advises.

Regards, Taras.

You can get rid of the ruby_block as running a ruby_block at compile time is near the same as running ruby code in the recipe itself.

I'm sure people with more knowledge will explain better than me the slight differences in term.of context between the ruby_block resource context and the recipe context in term.of DSL,helpers and so on

Le 17 juin 2015 21:38, klum_tz@ukr.net a écrit :

Hi guys,

I have met an issue and can't overcome it so far.

Will be grateful to you for any advises...

Here what I have in my recipe:

ruby_block "Backing up old application folders" do

block do

backup *apps

end

action :nothing

end.run_action(:run)

This is needed to run that block not during convergence phase but during compilation phase. So that it's done before other resources start its run...

“backup” method is called from library.rb file in …/libraries/ folder within my cookbook:

def backup *apps

apps.each do |app|

windows_zipfile archive_path(app) do

source "#{zilliant_folder}\\#{app}"

action :zip

only_if { !::File.exists?(archive_path(app)) }

end

end

end

So what I expect is to do folders backup during compilation phase... But...

During run (compilation phase) it finds “backup” method but it fails with finding “windows_zipfile” method.

Even though I have put dependency on "windows" cookbook in my "metadata.rb" file of my cookbook.

If I call that method “backup” out of “ruby_block” it works fine.

But I need to call it during compile phase (so that it done its job before any other resources).

Why ruby_block doesn’t work for finding “windows_zipfile” method?

How can I implement what I am looking for?

I tried to use "windows_zipfile" by itself outside of ruby_block. But it doesn't have possibility to be run during compile phase. Or I have not figured it out at least. :(

Here is chef-client run-example:

At the very beginning chef-client loads all needed cookbooks dependencies and then fails with that resource from windows cookbook:

PS C:\Users\tklym> chef-client

Starting Chef Client, version 12.3.0

resolving cookbooks for run list: ["zFilesUpdate::Spring15-5_UP_mx"]

Synchronizing Cookbooks:

- artifact

- windows

- chef_handler

- zFilesUpdate

Compiling Cookbooks...

Recipe: zFilesUpdate::Spring15-5_UP_mx

* directory[c:\chef\cache\artifact_file] action delete

- delete existing directory c:\chef\cache\artifact_file

* ruby_block[Backing up old application folders] action run

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

Error executing action `run` on resource 'ruby_block[Backing up old application folders]'

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

NoMethodError

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

undefined method `windows_zipfile' for Chef::Resource::RubyBlock

Thank you in advance for any of your help or advises.

Regards,

Taras.

I believe Tensibai is saying you can simple do

backup *app

in your recipe and that will run at compile time since it’s straight ruby code.

Chris

From: Tensibai Zhaoying [mailto:tensibai@iabis.net]
Sent: Wednesday, June 17, 2015 4:29 PM
To: chef@lists.opscode.com
Subject: [chef] Re: Methods call inside of “ruby_block” during chef-client’s compilation phase.

You can get rid of the ruby_block as running a ruby_block at compile time is near the same as running ruby code in the recipe itself.

I’m sure people with more knowledge will explain better than me the slight differences in term.of context between the ruby_block resource context and the recipe context in term.of DSL,helpers and so on
Le 17 juin 2015 21:38, klum_tz@ukr.netmailto:klum_tz@ukr.net a écrit :
Hi guys,

I have met an issue and can’t overcome it so far.
Will be grateful to you for any advises…

Here what I have in my recipe:

ruby_block “Backing up old application folders” do

block do

backup *apps

end

action :nothing

end.run_action(:run)

This is needed to run that block not during convergence phase but during compilation phase. So that it’s done before other resources start its run…

“backup” method is called from library.rb file in …/libraries/ folder within my cookbook:

def backup *apps

 apps.each do |app|

      windows_zipfile archive_path(app) do

            source "#{zilliant_folder}\\#{app}"

            action :zip

            only_if { !::File.exists?(archive_path(app)) }

      end

 end

end

So what I expect is to do folders backup during compilation phase… But…

During run (compilation phase) it finds “backup” method but it fails with finding “windows_zipfile” method.

Even though I have put dependency on “windows” cookbook in my “metadata.rb” file of my cookbook.

If I call that method “backup” out of “ruby_block” it works fine.

But I need to call it during compile phase (so that it done its job before any other resources).

Why ruby_block doesn’t work for finding “windows_zipfile” method?

How can I implement what I am looking for?

I tried to use “windows_zipfile” by itself outside of ruby_block. But it doesn’t have possibility to be run during compile phase. Or I have not figured it out at least. :frowning:

Here is chef-client run-example:

At the very beginning chef-client loads all needed cookbooks dependencies and then fails with that resource from windows cookbook:

PS C:\Users\tklym> chef-client

Starting Chef Client, version 12.3.0

resolving cookbooks for run list: [“zFilesUpdate::Spring15-5_UP_mx”]

Synchronizing Cookbooks:

  • artifact

  • windows

  • chef_handler

  • zFilesUpdate

Compiling Cookbooks…

Recipe: zFilesUpdate::Spring15-5_UP_mx

  • directory[c:\chef\cache\artifact_file] action delete

    • delete existing directory c:\chef\cache\artifact_file
  • ruby_block[Backing up old application folders] action run

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

    Error executing action run on resource ‘ruby_block[Backing up old application folders]’

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

    NoMethodError


    undefined method `windows_zipfile’ for Chef::Resource::RubyBlock

Thank you in advance for any of your help or advises.

Regards,

Taras.

Hi guys,
The issue is that I have two methods. 1 is for backup and another for delete.
Delete is dependent on backup. If there is not backups created yet it should not delete the folders.
Recipe flow is as follow:

  1. Check if no backups. If there is no - create. 2) If there are backups already created - delete folders. If no - nothing.
    But issue is that during compile phase, check for backup says that there is no backups yet. And this is true. And marks “delete” block for not to run. But during run(converge) phase, backups are created and delete folders will not happen. As it was marked not to run. Cuz at compile phase there were backups…
    That is why I need somehow force “windows_zip” resource from windows cookbook to run before any other stuff will take place. So that delete folders deleted one they find that backups are there already…
    Regards, Taras.

17 червня 2015, 23:41:54, від “Fouts, Chris” < Chris.Fouts@Sensus.com >:

I believe Tensibai is saying you can simple do backup *app in your recipe and that will run at compile time since it’s straight ruby code. Chris From: Tensibai Zhaoying [mailto:tensibai@iabis.net]
Sent: Wednesday, June 17, 2015 4:29 PM
To: chef@lists.opscode.com
Subject: [chef] Re: Methods call inside of “ruby_block” during chef-client’s compilation phase. You can get rid of the ruby_block as running a ruby_block at compile time is near the same as running ruby code in the recipe itself. I’m sure people with more knowledge will explain better than me the slight differences in term.of context between the ruby_block resource context and the recipe context in term.of DSL,helpers and so on Le 17 juin 2015 21:38, klum_tz@ukr.net a écrit : Hi guys,

I have met an issue and can’t overcome it so far.
Will be grateful to you for any advises… Here what I have in my recipe: ruby_block “Backing up old application folders” do block do backup *apps end action :nothing end.run_action(:run) This is needed to run that block not during convergence phase but during compilation phase. So that it’s done before other resources start its run… “backup” method is called from library.rb file in …/libraries/ folder within my cookbook: def backup *apps apps.each do |app| windows_zipfile archive_path(app) do source “#{zilliant_folder}\#{app}” action :zip only_if { !::File.exists?(archive_path(app)) } end end end So what I expect is to do folders backup during compilation phase… But… During run (compilation phase) it finds “backup” method but it fails with finding “windows_zipfile” method. Even though I have put dependency on “windows” cookbook in my “metadata.rb” file of my cookbook. If I call that method “backup” out of “ruby_block” it works fine. But I need to call it during compile phase (so that it done its job before any other resources). Why ruby_block doesn’t work for finding “windows_zipfile” method? How can I implement what I am looking for? I tried to use “windows_zipfile” by itself outside of ruby_block. But it doesn’t have possibility to be run during compile phase. Or I have not figured it out at least. :frowning: Here is chef-client run-example: At the very beginning chef-client loads all needed cookbooks dependencies and then fails with that resource from windows cookbook: PS C:\Users\tklym> chef-client Starting Chef Client, version 12.3.0 resolving cookbooks for run list: [“zFilesUpdate::Spring15-5_UP_mx”] Synchronizing Cookbooks: - artifact - windows - chef_handler - zFilesUpdate Compiling Cookbooks… Recipe: zFilesUpdate::Spring15-5_UP_mx * directory[c:\chef\cache\artifact_file] action delete - delete existing directory c:\chef\cache\artifact_file * ruby_block[Backing up old application folders] action run ================================================================================ Error executing action run on resource ‘ruby_block[Backing up old application folders]’ ================================================================================ NoMethodErro r ------------- undefined method `windows_zipfile’ for Chef::Resource::RubyBlock Thank you in advance for any of your help or advises. Regards, Taras.

Maybe this? This will zip (end.run_action()) during compile time, and do :nothing during converge time.

Chris

def backup *apps

 apps.each do |app|

      windows_zipfile archive_path(app) do

            source "#{zilliant_folder}\\#{app}"

            action :nothing

            only_if { !::File.exists?(archive_path(app)) }

      end.run_action(:zip)

 end

end

From: Taras Klym [mailto:klum_tz@ukr.net]
Sent: Thursday, June 18, 2015 4:01 AM
To: chef@lists.opscode.com
Subject: [chef] Re: RE: Re: Methods call inside of “ruby_block” during chef-client’s compilation phase.

Hi guys,

The issue is that I have two methods.
1 is for backup and another for delete.

Delete is dependent on backup. If there is not backups created yet it should not delete the folders.

Recipe flow is as follow:

  1. Check if no backups. If there is no - create.
  2. If there are backups already created - delete folders. If no - nothing.

But issue is that during compile phase, check for backup says that there is no backups yet. And this is true. And marks “delete” block for not to run.
But during run(converge) phase, backups are created and delete folders will not happen. As it was marked not to run. Cuz at compile phase there were backups…

That is why I need somehow force “windows_zip” resource from windows cookbook to run before any other stuff will take place.
So that delete folders deleted one they find that backups are there already…

Regards,
Taras.

17 червня 2015, 23:41:54, від “Fouts, Chris” <Chris.Fouts@Sensus.commailto:Chris.Fouts@Sensus.com>:

I believe Tensibai is saying you can simple do

backup *app

in your recipe and that will run at compile time since it’s straight ruby code.

Chris

From: Tensibai Zhaoying [mailto:tensibai@iabis.net]
Sent: Wednesday, June 17, 2015 4:29 PM
To: chef@lists.opscode.commailto:chef@lists.opscode.com
Subject: [chef] Re: Methods call inside of “ruby_block” during chef-client’s compilation phase.

You can get rid of the ruby_block as running a ruby_block at compile time is near the same as running ruby code in the recipe itself.

I’m sure people with more knowledge will explain better than me the slight differences in term.of context between the ruby_block resource context and the recipe context in term.of DSL,helpers and so on

Le 17 juin 2015 21:38, klum_tz@ukr.netmailto:klum_tz@ukr.net a écrit :

Hi guys,

I have met an issue and can’t overcome it so far.
Will be grateful to you for any advises…

Here what I have in my recipe:

ruby_block “Backing up old application folders” do

block do

backup *apps

end

action :nothing

end.run_action(:run)

This is needed to run that block not during convergence phase but during compilation phase. So that it’s done before other resources start its run…

“backup” method is called from library.rb file in …/libraries/ folder within my cookbook:

def backup *apps

 apps.each do |app|

      windows_zipfile archive_path(app) do

            source "#{zilliant_folder}\\#{app}"

            action :zip

            only_if { !::File.exists?(archive_path(app)) }

      end

 end

end

So what I expect is to do folders backup during compilation phase… But…

During run (compilation phase) it finds “backup” method but it fails with finding “windows_zipfile” method.

Even though I have put dependency on “windows” cookbook in my “metadata.rb” file of my cookbook.

If I call that method “backup” out of “ruby_block” it works fine.

But I need to call it during compile phase (so that it done its job before any other resources).

Why ruby_block doesn’t work for finding “windows_zipfile” method?

How can I implement what I am looking for?

I tried to use “windows_zipfile” by itself outside of ruby_block. But it doesn’t have possibility to be run during compile phase. Or I have not figured it out at least. :frowning:

Here is chef-client run-example:

At the very beginning chef-client loads all needed cookbooks dependencies and then fails with that resource from windows cookbook:

PS C:\Users\tklym> chef-client

Starting Chef Client, version 12.3.0

resolving cookbooks for run list: [“zFilesUpdate::Spring15-5_UP_mx”]

Synchronizing Cookbooks:

  • artifact

  • windows

  • chef_handler

  • zFilesUpdate

Compiling Cookbooks…

Recipe: zFilesUpdate::Spring15-5_UP_mx

  • directory[c:\chef\cache\artifact_file] action delete

    • delete existing directory c:\chef\cache\artifact_file
  • ruby_block[Backing up old application folders] action run

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

    Error executing action run on resource ‘ruby_block[Backing up old application folders]’

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

    NoMethodError


    undefined method `windows_zipfile’ for Chef::Resource::RubyBlock

Thank you in advance for any of your help or advises.

Regards,

Taras.

Why do you think you need to do this during the compilation phase?
-s

On Wed, Jun 17, 2015 at 3:38 PM, klum_tz@ukr.net wrote:

Hi guys,

I have met an issue and can't overcome it so far.
Will be grateful to you for any advises...

Here what I have in my recipe:

ruby_block "Backing up old application folders" do

block do

backup *apps

end

action :nothing

end.run_action(:run)

This is needed to run that block not during convergence phase but during
compilation phase. So that it's done before other resources start its run...

“backup” method is called from library.rb file in …/libraries/ folder
within my cookbook:

def backup *apps

 apps.each do |app|

      windows_zipfile archive_path(app) do

            source "#{zilliant_folder}\\#{app}"

            action :zip

            only_if { !::File.exists?(archive_path(app)) }

      end

 end

end

So what I expect is to do folders backup during compilation phase... But...

During run (compilation phase) it finds “backup” method but it fails with
finding “windows_zipfile” method.

Even though I have put dependency on "windows" cookbook in my
"metadata.rb" file of my cookbook.

If I call that method “backup” out of “ruby_block” it works fine.

But I need to call it during compile phase (so that it done its job before
any other resources).

Why ruby_block doesn’t work for finding “windows_zipfile” method?

How can I implement what I am looking for?

I tried to use "windows_zipfile" by itself outside of ruby_block. But it
doesn't have possibility to be run during compile phase. Or I have not
figured it out at least. :frowning:

Here is chef-client run-example:

At the very beginning chef-client loads all needed cookbooks dependencies
and then fails with that resource from windows cookbook:

PS C:\Users\tklym> chef-client

Starting Chef Client, version 12.3.0

resolving cookbooks for run list: ["zFilesUpdate::Spring15-5_UP_mx"]

Synchronizing Cookbooks:

  • artifact

  • windows

  • chef_handler

  • zFilesUpdate

Compiling Cookbooks...

Recipe: zFilesUpdate::Spring15-5_UP_mx

  • directory[c:\chef\cache\artifact_file] action delete

    • delete existing directory c:\chef\cache\artifact_file
  • ruby_block[Backing up old application folders] action run

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

Error executing action `run` on resource 'ruby_block[Backing up old

application folders]'

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

*NoMethodErro*r

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

*undefined method `windows_zipfile' *for Chef::Resource::RubyBlock

Thank you in advance for any of your help or advises.

Regards,

Taras.

Hi
Lets say I have cookbook base and 2 cookbooks child1 and child 2
In cookbook child1s recipe , I include base in the following manner:
child1/recipes/default.rb
include_recipe "base"
The same setup for child2’s default recipe
Now in base, is there a way to find out which is the calling cookbook child1 or child2?
Regards
mg

Have already figured it out.

Well. Because I have two blocks. 1) Checks if there are backups and if there are, delete some folders. It has only_if logic. 2) creates backups. only_if logic. Creates backups if there none. So first time it will definitely run. When there is no backups.
During compilation phase 1st block is marked to not run as there are no backups yet. But during convergence phase 2nd block will run, create backups, but 1st will not delete any folders as there were no backups during compile phase.
Hence I needed to backups creation during compile phase. So that 1st block deletes old folders when backups are there.
If you are interested, windows_zipfile can be used to be run during compile phase as follow:
windows_zipfile archive_path(app) do source “#{folder}\#{app}” action :nothing only_if { !::File.exists?(archive_path(app)) } end.run_action(:zip)
It will make it run during compile phase before any other stuff is run. :slight_smile:
Regards, Taras.
18 червня 2015, 17:38:40, від “Sean OMeara” < someara@chef.io >:

Why do you think you need to do this during the compilation phase? -s
On Wed, Jun 17, 2015 at 3:38 PM, < klum_tz@ukr.net > wrote:
Hi guys,

I have met an issue and can’t overcome it so far.
Will be grateful to you for any advises…

Here what I have in my recipe: ruby_block “Backing up old application folders” do block do backup *apps end action :nothing end.run_action(:run) This is needed to run that block not during convergence phase but during compilation phase. So that it’s done before other resources start its run…

“backup” method is called from library.rb file in …/libraries/ folder within my cookbook: def backup *apps apps.each do |app| windows_zipfile archive_path(app) do source “#{zilliant_folder}\#{app}” action :zip only_if { !::File.exists?(archive_path(app)) } end end end So what I expect is to do folders backup during compilation phase… But…
During run (compilation phase) it finds “backup” method but it fails with finding “windows_zipfile” method. Even though I have put dependency on “windows” cookbook in my “metadata.rb” file of my cookbook. If I call that method “backup” out of “ruby_block” it works fine. But I need to call it during compile phase (so that it done its job before any other resources). Why ruby_block doesn’t work for finding “windows_zipfile” method? How can I implement what I am looking for?
I tried to use “windows_zipfile” by itself outside of ruby_block. But it doesn’t have possibility to be run during compile phase. Or I have not figured it out at least. :frowning:
Here is chef-client run-example:
At the very beginning chef-client loads all needed cookbooks dependencies and then fails with that resource from windows cookbook: PS C:\Users\tklym> chef-client Starting Chef Client, version 12.3.0 resolving cookbooks for run list: [“zFilesUpdate::Spring15-5_UP_mx”] Synchronizing Cookbooks: - artifact - windows - chef_handler - zFilesUpdate Compiling Cookbooks… Recipe: zFilesUpdate::Spring15-5_UP_mx * directory[c:\chef\cache\artifact_file] action delete - delete existing directory c:\chef\cache\artifact_file * ruby_block[Backing up old application folders] action run ================================================================================ Error executing action run on resource ‘ruby_block[Backing up old application folders]’ ================================================================================ NoMethodErro r ------------- undefined method `windows_zipfile’ for Chef::Resource::RubyBlock Thank you in advance for any of your help or advises.

Regards, Taras.

Thank you Chris,
By the time I red this email I have already came to the same solution. :slight_smile:
But still thank you a lot. If I had not found it before, this email would have saved me a lot of time! :slight_smile:
Have a nice day ahead.
Regards, Taras.

18 червня 2015, 17:20:04, від “Fouts, Chris” < Chris.Fouts@Sensus.com >:

Maybe this? This will zip (end.run_action()) during compile time, and do :nothing during converge time. Chris def backup *apps apps.each do |app| windows_zipfile archive_path(app) do source “#{zilliant_folder}\#{app}” action :nothing only_if { !::File.exists?(archive_path(app)) } end.run_action(:zip) end end From: Taras Klym [mailto:klum_tz@ukr.net]
Sent: Thursday, June 18, 2015 4:01 AM
To: chef@lists.opscode.com
Subject: [chef] Re: RE: Re: Methods call inside of “ruby_block” during chef-client’s compilation phase. Hi guys, The issue is that I have two methods. 1 is for backup and another for delete. Delete is dependent on backup. If there is not backups created yet it should not delete the folders. Recipe flow is as follow: 1) Check if no backups. If there is no - create. 2) If there are backups already created - delete folders. If no - nothing. But issue is that during compile phase, check for backup says that there is no backups yet. And this is true. And marks “delete” block for not to run. But during run(converge) phase, backups are created and delete folders will not happen. As it was marked not to run. Cuz at compile phase there were backups… That is why I need somehow force “windows_zip” resource from windows cookbook to run before any other stuff will take place. So that delete folders deleted one they find that backups are there already… Regards, Taras. 17 червня 2015, 23:41:54, від “Fouts, Chris” < Chris.Fouts@Sensus.com >: I believe Tensibai is saying you can simple do backup *app in your recipe and that will run at compile time since it’s straight ruby code. Chris From: Tensibai Zhaoying [ mailto:tensibai@iabis.net ]
Sent: Wednesday, June 17, 2015 4:29 PM
To: chef@lists.opscode.com
Subject: [chef] Re: Methods call inside of “ruby_block” during chef-client’s compilation phase. You can get rid of the ruby_block as running a ruby_block at compile time is near the same as running ruby code in the recipe itself. I’m sure people with more knowledge will explain better than me the slight differences in term.of context between the ruby_block resource context and the recipe context in term.of DSL,helpers and so on Le 17 juin 2015 21:38, klum_tz@ukr.net a écrit : Hi guys,

I have met an issue and can’t overcome it so far.
Will be grateful to you for any advises… Here what I have in my recipe: ruby_block “Backing up old application folders” do block do backup *apps end action :nothing end.run_action(:run) This is needed to run that block not during convergence phase but during compilation phase. So that it’s done before other resources start its run… “backup” method is called from library.rb file in …/libraries/ folder within my cookbook: def backup *apps apps.each do |app| windows_zipfile archive_path(app) do source “#{zilliant_folder}\#{app}” action :zip only_if { !::File.exists?(archive_path(app)) } end end end So what I expect is to do folders backup during compilation phase… But… During run (compilation phase) it finds “backup” method but it fails with finding “windows_zipfile” method. Even though I have put dependency on “windows” cookbook in my “metadata.rb” file of my cookbook. If I call that method “backup” out of “ruby_block” it works fine. But I need to call it during compile phase (so that it done its job before any other resources). Why ruby_block doesn’t work for finding “windows_zipfile” method? How can I implement what I am looking for? I tried to use “windows_zipfile” by itself outside of ruby_block. But it doesn’t have possibility to be run during compile phase. Or I have not figured it out at least. :frowning: Here is chef-client run-example: At the very beginning chef-client loads all needed cookbooks dependencies and then fails with that resource from windows cookbook: PS C:\Users\tklym> chef-client Starting Chef Client, version 12.3.0 resolving cookbooks for run list: [“zFilesUpdate::Spring15-5_UP_mx”] Synchronizing Cookbooks: - artifact - windows - chef_handler - zFilesUpdate Compiling Cookbooks… Recipe: zFilesUpdate::Spring15-5_UP_mx * directory[c:\chef\cache\artifact_file] action delete - delete existing directory c:\chef\cache\artifact_file * ruby_block[Backing up old application folders] action run ================================================================================ Error executing action run on resource ‘ruby_block[Backing up old application folders]’ ================================================================================ NoMethodErro r ------------- undefined method `windows_zipfile’ for Chef::Resource::RubyBlock Thank you in advance for any of your help or advises. Regards, Taras.

On Thursday, June 18, 2015 at 9:20 AM, M G wrote:

Hi

Lets say I have cookbook base and 2 cookbooks child1 and child 2

In cookbook child1s recipe , I include base in the following manner:

child1/recipes/default.rb

include_recipe "base"

The same setup for child2's default recipe

Now in base, is there a way to find out which is the calling cookbook child1 or child2?
It might be possible in some terribly ugly way (like looking at caller to inspect the call stack) but you’re better off using some other mechanism (set a value in attributes or node.run_state).

Regards

mg
--
Daniel DeLeo