Skip to content

Commit

Permalink
handle unresolvable vardefaults
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Spiers committed Feb 21, 2018
1 parent f206c0d commit 9d02598
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/ansible_viz/resolver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,14 @@ def resolve_task_include_vars(dict, task)
find_on_role(dict, task[:parent], :varfile, $1) or
mk_unresolved_varfile(dict, $1)
elsif name =~ %r!^\.\./defaults/([^/]+).yml!
find_on_role(dict, task[:parent], :vardefaults, $1)
find_on_role(dict, task[:parent], :vardefaults, $1) or
mk_unresolved_vardefaults(dict, $1)
elsif name =~ %r!^\.\./\.\./([^/]+)/vars/([^/]+).yml!
find_on_role(dict, $1, :varfile, $2) or
mk_unresolved_varfile(dict, $1)
elsif name =~ %r!^(?:\.\./\.\./|roles/)([^/]+)/defaults/([^/]+).yml!
find_on_role(dict, $1, :vardefaults, $2)
find_on_role(dict, $1, :vardefaults, $2) or
mk_unresolved_vardefaults(dict, $1)
else
raise "Unhandled include_vars: #{name}"
end
Expand All @@ -180,6 +182,10 @@ def mk_unresolved_varfile(dict, name)
thing(dict, :varfile, name, "unknown", unresolved: true, var: [])
end

def mk_unresolved_vardefaults(dict, name)
thing(dict, :vardefaults, name, "unknown", unresolved: true, var: [])
end

def resolve_args(dict, task)
task[:args] = task[:args].uniq.map {|arg|
thing(task, :var, arg, task[:path], {:defined => true})
Expand Down

0 comments on commit 9d02598

Please sign in to comment.