ohai 7.0.0 → 7.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/ohai/system.rb +11 -0
- data/lib/ohai/version.rb +1 -1
- data/spec/unit/system_spec.rb +23 -0
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: d5000ad010af950e34ca83e38bc47a3ea02b15c5
         | 
| 4 | 
            +
              data.tar.gz: 9b606e4475a7a3fcdd35d315fa121a19f1df43f5
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 6a070ccd2fe321b8fdc9f76fbea5917dc77262d959c8e44ac911bafa7170a95282e0d11af545e1a16d813460323dbf6f4829af93cbb4e4197fc65637f4acf319
         | 
| 7 | 
            +
              data.tar.gz: 58dfa08849444ad98bea48f0172c9082237017406ec41466b556e278f915c50c2f5df7d3032df3e06e42b318eaf23da552147585e001560319a11d83c177b869
         | 
    
        data/lib/ohai/system.rb
    CHANGED
    
    | @@ -83,6 +83,13 @@ module Ohai | |
| 83 83 | 
             
                    @runner.run_plugin(v6plugin)
         | 
| 84 84 | 
             
                  end
         | 
| 85 85 |  | 
| 86 | 
            +
                  # Users who are migrating from ohai 6 may give one or more Ohai 6 plugin
         | 
| 87 | 
            +
                  # names as the +attribute_filter+. In this case we return early because
         | 
| 88 | 
            +
                  # the v7 plugin provides map will not have an entry for this plugin.
         | 
| 89 | 
            +
                  if attribute_filter and Array(attribute_filter).all? {|filter_item| have_v6_plugin?(filter_item) }
         | 
| 90 | 
            +
                    return true
         | 
| 91 | 
            +
                  end
         | 
| 92 | 
            +
             | 
| 86 93 | 
             
                  # Then run all the version 7 plugins
         | 
| 87 94 | 
             
                  begin
         | 
| 88 95 | 
             
                    @provides_map.all_plugins(attribute_filter).each { |plugin|
         | 
| @@ -94,6 +101,10 @@ module Ohai | |
| 94 101 | 
             
                  end
         | 
| 95 102 | 
             
                end
         | 
| 96 103 |  | 
| 104 | 
            +
                def have_v6_plugin?(name)
         | 
| 105 | 
            +
                  @v6_dependency_solver.values.any? {|v6plugin| v6plugin.name == name }
         | 
| 106 | 
            +
                end
         | 
| 107 | 
            +
             | 
| 97 108 | 
             
                def pathify_v6_plugin(plugin_name)
         | 
| 98 109 | 
             
                  path_components = plugin_name.split("::")
         | 
| 99 110 | 
             
                  File.join(path_components) + ".rb"
         | 
    
        data/lib/ohai/version.rb
    CHANGED
    
    
    
        data/spec/unit/system_spec.rb
    CHANGED
    
    | @@ -517,6 +517,29 @@ EOF | |
| 517 517 | 
             
              end
         | 
| 518 518 |  | 
| 519 519 | 
             
              describe "when Chef OHAI resource executes :reload action" do
         | 
| 520 | 
            +
             | 
| 521 | 
            +
                when_plugins_directory "contains a v6 plugin" do
         | 
| 522 | 
            +
                  with_plugin("a_v6plugin.rb", <<-E)
         | 
| 523 | 
            +
                    plugin_data Mash.new
         | 
| 524 | 
            +
                    plugin_data[:foo] = :bar
         | 
| 525 | 
            +
                  E
         | 
| 526 | 
            +
             | 
| 527 | 
            +
                  before do
         | 
| 528 | 
            +
                    @original_config = Ohai::Config[:plugin_path]
         | 
| 529 | 
            +
                    Ohai::Config[:plugin_path] = [ path_to(".") ]
         | 
| 530 | 
            +
                  end
         | 
| 531 | 
            +
             | 
| 532 | 
            +
                  after do
         | 
| 533 | 
            +
                    Ohai::Config[:plugin_path] = @original_config
         | 
| 534 | 
            +
                  end
         | 
| 535 | 
            +
             | 
| 536 | 
            +
                  it "reloads only the v6 plugin when given a specific plugin to load" do
         | 
| 537 | 
            +
                    ohai.all_plugins
         | 
| 538 | 
            +
                    lambda { ohai.all_plugins("a_v6plugin") }.should_not raise_error
         | 
| 539 | 
            +
                  end
         | 
| 540 | 
            +
             | 
| 541 | 
            +
                end
         | 
| 542 | 
            +
             | 
| 520 543 | 
             
                when_plugins_directory "contains a random plugin" do
         | 
| 521 544 | 
             
                  with_plugin("random.rb", <<-E)
         | 
| 522 545 | 
             
                    Ohai.plugin(:Random) do
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: ohai
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 7.0. | 
| 4 | 
            +
              version: 7.0.2
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Adam Jacob
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2014-04- | 
| 11 | 
            +
            date: 2014-04-09 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: mime-types
         |