Skip to content

Commit

Permalink
Add UI for failed hooks after installation is finished
Browse files Browse the repository at this point in the history
  • Loading branch information
Vladimir Moravec committed Dec 3, 2013
1 parent 23ba40f commit d8ad7ff
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
36 changes: 36 additions & 0 deletions src/clients/inst_finish.rb
Expand Up @@ -52,6 +52,7 @@ def main
Yast.import "SlideShow"
Yast.import "InstError"
Yast.import "PackageCallbacks"
Yast.import "Hooks"

# added for fate# 303395
Yast.import "Directory"
Expand Down Expand Up @@ -415,7 +416,11 @@ def main
)
Builtins.sleep(500)
else
Hooks.run "before_#{step['client']}"

WFM.CallFunction(Ops.get_string(step, "client", ""), ["Write"])

Hooks.run "after_#{step['client']}"
end
Progress.set(orig)
# Handle user input during client run
Expand Down Expand Up @@ -448,6 +453,16 @@ def main
SlideShow.CloseDialog
end

used_hooks = Hooks.all.select(&:used?)
failed_hooks = used_hooks.select(&:failed?)

if !failed_hooks.empty?
Builtins.y2milestone "#{failed_hooks.size} failed hooks found: " +
"#{failed_hooks.map(&:name).join(', ')}"
Builtins.y2milestone "Showing the hook list.."
show_used_hooks(used_hooks)
end

# --------------------------------------------------------------
# Check if there is a message left to display
# and display it, if necessary
Expand Down Expand Up @@ -512,6 +527,27 @@ def main
:next
end

def show_used_hooks hooks
content = Table(
Id(:hooks_table),
Opt(:notify),
Header('Hook name', 'Result', 'Output'),
hooks.map do |hook|
Item(
Id(:hook),
hook.name,
hook.failed? ? 'failure' : 'success',
hook.results.join('; ')[0..50]
)
end
)
Builtins.y2milestone "Showing the failed hooks results.."
Popup.LongText(
'Hooks results',
content,
80, hooks.size
)
end
# --> Functions

def ReportClientError(client_error_text)
Expand Down
1 change: 1 addition & 0 deletions src/clients/installation.rb
Expand Up @@ -94,6 +94,7 @@ def main

deep_copy(@ret)
end

end
end

Expand Down

0 comments on commit d8ad7ff

Please sign in to comment.