ping: Fix ping page

Previously pinging while the network wasn't available or pinging an
unreachable host lead to problems on the ping page.
The code has now been refactored and simplified to prevent those
problems.

Change-Id: I7f3fcbb7fca8b904e3531d7b6334f3e4aa5bc918
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=980420
Signed-off-by: Fabian Deutsch <fabiand@fedoraproject.org>