Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8761825
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T15:22:45+00:00 2026-06-13T15:22:45+00:00

I am developing a cookbook to deploy a simple jekyll based blog. I use

  • 0

I am developing a cookbook to deploy a simple jekyll based blog. I use ‘application’ cookbook as a base. Everything works smoothly except chef simply ignores my defined callbacks.

Chef log contains entries about my callback, but I see no errors or outcomes of the callback execution.

Here is recipes/default.rb file:

include_recipe "git"

application "example_com" do
  path "/var/www/example.com"
  repository "git@example.org:xxx/xxx.git"
  revision "master"

  deploy_key <<EOF
-----BEGIN RSA PRIVATE KEY-----
..skip...
-----END RSA PRIVATE KEY-----
EOF

  # before_symlink "script/bootstrap"

  before_deploy do
    # raise
    # Chef::Log.info("INSANE!")
    execute "bundle exec rake generate" do
      cwd release_path
    end
  end
end

Here is the log where chef-client says it executes before_deploy callback:

[2012-10-06T10:06:20-04:00] INFO: Processing ruby_block[example_com before_deploy] action create (/var/cache/chef/cookbooks/application/providers/default.rb line 107)
[2012-10-06T10:06:20-04:00] DEBUG: Got callback before_deploy: #<Proc:0x00007f0509788088@/var/cache/chef/cookbooks/example_com/recipes/default.rb:24>
[2012-10-06T10:06:20-04:00] INFO: application[example_com] running callback before_deploy
[2012-10-06T10:06:20-04:00] INFO: ruby_block[example_com before_deploy] called
[2012-10-06T10:06:20-04:00] INFO: Processing deploy_revision[example_com] action deploy (/var/cache/chef/cookbooks/application/providers/default.rb line 122)

I also tried to define callback using string, but the result is the same. Chef shows error when there is no file with callback definition and simply ignores the file if it is in the right place.

Update 1

After digging deeper inside Chef sources I realized that callbacks are executed in separate chef runner and this happens not instantly. When code in application cookbook calls _recipe_eval_ to evaluate callback body Chef creates separate runner and the code does not executed until something call converge method.

So, I modified application cookbook a bit. I added call converge just after _recipe_eval_ and everything started to work.

I think this is a bug and I am going to create an issue in official Opscode tracker. However, any comments are very welcome!

Here is modifed version of application/libraries/default.rb:

class Chef
  class Provider
    module ApplicationBase

    # ...skip...

      def callback(what, callback_code=nil)
        Chef::Log.debug("Got callback #{what}: #{callback_code.inspect}")
        @collection = Chef::ResourceCollection.new
        case callback_code
        when Proc
          Chef::Log.info "#{@new_resource} running callback #{what}"
          # recipe_eval(&callback_code)
          recipe_eval(&callback_code)
          converge # <--- Remove this line and no callbacks will work.
        when String
          callback_file = "#{release_path}/#{callback_code}"
          unless ::File.exist?(callback_file)
            raise RuntimeError, "Can't find your callback file #{callback_file}"
          end
          run_callback_from_file(callback_file)
        when nil
          nil
        else
          raise RuntimeError, "You gave me a callback I don't know what to do with: #{callback_code.inspect}"
        end
      end
    end
  end
end
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T15:22:46+00:00Added an answer on June 13, 2026 at 3:22 pm

    Opscode just confirmed that it is a bug in Chef. If someone needs more details and status of the fix, please use these links:

    • http://tickets.opscode.com/browse/COOK-1747
    • http://tickets.opscode.com/browse/CHEF-3493
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Developing a desktop application based on Java + Swing I faced the problem of
Developing iOS5 based cocoa app, below peice of comparison works fine if localization is
When developing a Java EE application, it is possible to use EJBs as controllers?
Developing a heavily XML-based Java-application, I recently encountered an interesting problem on Ubuntu Linux.
Developing a simple application. With a webview inside a window, loading a url. This
Developing for Android 2.3, I have a question regarding layouts. I use a vertival
Developing a C# .NET 2.0 WinForm Application. Need the application to close and restart
Iam developing one application.In that iam placing the radio buttons(uiimageview) on table view and
While developing an application using gwt in ecliplse crashed. Now the server is running
When developing an RCP application against a target platform, I ( and others )

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.