diff options
author | Claire McQuin <claire@opscode.com> | 2013-09-11 19:30:52 -0700 |
---|---|---|
committer | Claire McQuin <claire@opscode.com> | 2013-09-11 19:30:52 -0700 |
commit | 65d41edd4108622b836917580ab515b978c76562 (patch) | |
tree | deb84371468596f4bcd0788ff8ec811cd3293d04 /lib | |
parent | 0b933d21bb54bdd3a2c1932db8089decd23a8ba8 (diff) | |
parent | 15db840588d341812f6a97d3c12a02579fe79e9a (diff) | |
download | ohai-65d41edd4108622b836917580ab515b978c76562.tar.gz |
Merge pull request #198 from opscode/cycle-detection
Fix: cycle detection
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ohai/runner.rb | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/ohai/runner.rb b/lib/ohai/runner.rb index 287cb0da..73e0ddce 100644 --- a/lib/ohai/runner.rb +++ b/lib/ohai/runner.rb @@ -41,12 +41,11 @@ module Ohai visited = [plugin] while !visited.empty? p = visited.pop - unless force - next if p.has_run? - end + + next if p.has_run? unless force if visited.include?(p) - raise DependencyCycleError, "Dependency cycle detected. Please examine the following plugin files: #{cycle_sources(visited, p).join(", ")}" + raise DependencyCycleError, "Dependency cycle detected. Please refer to the following plugin files: #{cycle_sources(visited, p).join(", ") }" end dependency_providers = fetch_providers(p.dependencies) @@ -55,8 +54,7 @@ module Ohai if dependency_providers.empty? @safe_run ? p.safe_run : p.run else - visited << p << dependency_providers - visited.flatten! + visited << p << dependency_providers.first end end end |