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

Load needed (dynamic) dependencies for provisioners at creation time. #358

Merged
merged 3 commits into from Feb 12, 2014

Commits on Feb 12, 2014

  1. Load needed (dynamic) dependencies for provisioners at creation time.

    The need for this change was initated with #293 which runs every
    instance action in a thread of execution, even in serial mode. The issue
    is that on the Mac platform MRI Ruby 1.9 and 2.0 (not confirmed for
    2.1), dynamic (i.e. native) code needs to be loaded in the main thread
    otherwise causing a "Trace/BPT trap: 5" crash.
    
    References:
    
    * http://stackoverflow.com/questions/9933969/matlab-ruby-gem-doesnt-work-when-called-from-thread#answer-12319780
    * https://bugs.launchpad.net/sbcl/+bug/1014409
    
    For Berkshelf 2.0.x at least, there are multiple transitive dependencies
    that *could* load native code, meaning that `require 'berkshelf'` could
    very well lead to a VM crash if performed in a thread other than main.
    
    This commit pushes library loading code ahead to Provisioner creation
    time. In other words, by the time you have a Provisioner object
    reference either Berkshelf, Librarian-Chef, or nothing has been required
    (assuming a Chef provisioner).
    
    A drawback to this approach is that these dynamic dependencies will be
    eagerly loaded when Test Kitchen is booting for trivial CLI commands
    such as `kitchen list` and `kitchen diagnose`. Further work is needed to
    ensure that `kitchen diagnose` remains viable even in the face of a
    failure to load these dependencies.
    
    Finally, the loaded version of Berkshelf or Librarian-Chef will be
    displayed to the user on INFO for converge action and DEBUG on code
    loading for troubleshooting.
    
    Closes #357
    
    /cc @reset, @ivey, @sethvargo
    fnichol committed Feb 12, 2014
    Configuration menu
    Copy the full SHA
    954a3ff View commit details
    Browse the repository at this point in the history
  2. Record failures to build instances when running kitchen diagnose.

    In resolving #357 some code loading logic needed to be moved early in
    an object's life meaning that an Instance (or a collaborator object)
    could crash before `#diagnose` was callable.
    
    A design goal for `kitchen diagnose` is that it not crash itself and to
    provide some minimum useful information in a failure scenario.
    
    This commit will return an error hash in the :instances and :loader keys
    if an exception was raised.
    fnichol committed Feb 12, 2014
    Configuration menu
    Copy the full SHA
    c8e6f12 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    42e38d0 View commit details
    Browse the repository at this point in the history