diff options
author | Claire McQuin <claire@opscode.com> | 2013-09-11 14:19:52 -0700 |
---|---|---|
committer | Claire McQuin <claire@opscode.com> | 2013-09-11 16:36:46 -0700 |
commit | 15db840588d341812f6a97d3c12a02579fe79e9a (patch) | |
tree | 99e01230bd08c71e1c6ebc0a648a4047f12e6568 /lib/ohai | |
parent | 1864fe0dd017a2a590ae1678b7b48adafbce780d (diff) | |
download | ohai-15db840588d341812f6a97d3c12a02579fe79e9a.tar.gz |
fix cycle detection
Diffstat (limited to 'lib/ohai')
-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 |