Skip to content

Commit

Permalink
Raises an exception if uptime could not be determined
Browse files Browse the repository at this point in the history
  • Loading branch information
imobachgs committed Feb 25, 2016
1 parent 1fe1eb9 commit c56892e
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/clients/inst_autoconfigure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ def wait_systemd_finished(max_wait, ser_ignore)
max_wait,
ser_ignore
)
st_time = SCR.Read(path(".proc.uptime"))["uptime"]
st_time = uptime
cur_time = st_time
last_busy = st_time
cmd = "systemctl --full list-jobs"
Expand All @@ -484,7 +484,7 @@ def wait_systemd_finished(max_wait, ser_ignore)
Builtins.y2milestone("size ll=%1 ll:%2", cnt, ll)
last_busy = cur_time if Ops.greater_than(cnt, 0)
Builtins.sleep(500)
cur_time = SCR.Read(path(".proc.uptime"))["uptime"]
cur_time = uptime
Builtins.y2milestone(
"wait_systemd_finished time:%1 idle:%2",
Ops.subtract(cur_time, st_time),
Expand All @@ -498,6 +498,14 @@ def wait_systemd_finished(max_wait, ser_ignore)

nil
end

private

def uptime
proc_uptime = SCR.Read(path(".proc.uptime"))
raise "Could not determine system's uptime" unless proc_uptime && proc_uptime["uptime"]
proc_uptime["uptime"]
end
end
end

Expand Down

0 comments on commit c56892e

Please sign in to comment.