Closed iroller closed 9 years ago
@iroller the important bit of the stacktrace is the exception thrown based on the response back from the API which is precondition failed and a message regarding a cookbook called "test". This is an issue with Chef Guard and not Ridley. I'd post this on their issue tracker and see what comes up!
@reset The exception is 100% fine and expected. It's described here:
Chef-Guard will return with a 412 Precondition Failed error and some additional details about the error.
The issue is the amount of extra output produced by ridley in this case.
When I try to pin the version in production env with knife I'm getting nice and clear output:
$ knife environment edit production
ERROR: Precondition Failed
Response:
=== Cookbook Constraints errors found ===
- test version 0.0.1 needs to be frozen
=========================================
$
Also I've just tried to run my script in pry
and it somehow suppresses the output too:
[14] pry(main)> e.save
Ridley::Errors::HTTPPreconditionFailed:
=== Cookbook Constraints errors found ===
- test version 0.0.1 needs to be frozen
=========================================
from /Users/username/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/ridley-4.1.2/lib/ridley/middleware/chef_response.rb:24:in `on_complete'
[15] pry(main)>
Ideally I'd like to find a way to make it output the same amount of information knife outputs. Or at least make it as short as the output produced in pry.
Huge output makes it impossible to do scripting using ridley when using chef-guard.
@iroller it's just a plain Ruby library so you can rescue the exception and format the output however you'd like
Oh, I need to go home and have a rest for a bit :tired_face: Thanks @reset
No problem man :smile:
When making changes to chef-server with chef-guard installed you can get "Ridley::Errors::HTTPPreconditionFailed" produced by Chef-Guard to protect the server. For example:
The issue is with useful error message I'm getting a huge traceback:
Script to reproduce (when chef-guard is installed):
It looks like setting Ridley.logger to nil here does nothing. Any other ways to reduce the output?
Versions: