Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resque / resque-scheduler recipes "install resque gem" check not_if always return true, fail to execute the command #150

Open
oscarcck opened this issue Feb 27, 2014 · 0 comments

Comments

@oscarcck
Copy link

cookbooks/resque/recipes/default.rb:9

not_if { "gem list | grep resque" }

cookbooks/resque-scheduler/recipes/default.rb:8

not_if { "gem list | grep resque" }

I find the above 2 lines will always return true.

According to http://docs.opscode.com/resource_common.html#guards

  • A string is executed as a shell command. If the command returns 0, the guard is applied. If the command returns any other value, then the guard is not applied.
  • A block is executed as Ruby code that must return either true or false. If the block returns true, the the guard is applied. If the block returns false, the guard is not applied.

I guess it is because "{}" interpret as a Ruby code block in chef. The "gem list | grep resque" will become string inside the {}, thus it will always return true.

The fix should be remove the {} block.
i.e.
not_if { "gem list | grep resque" }

not_if "gem list | grep resque"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant