[PATCH 0/2] Fixes on Update feature

From: Aline Manera <alinefm@br.ibm.com> Aline Manera (2): bug fix: Display update progress on real time bug fix: Update progress area when an error occurs during update process src/kimchi/swupdate.py | 16 +++++++++++----- ui/js/src/kimchi.host.js | 1 + 2 files changed, 12 insertions(+), 5 deletions(-) -- 1.7.10.4

From: Aline Manera <alinefm@br.ibm.com> When updating the system, the user should be able to see the progress to know what is being done in the system. stdout.read() will wait until get the completed output to return, ie, the user will see the progress only when the update finishs. So use stdout.readline() to read line by line and display the info to the user. Signed-off-by: Aline Manera <alinefm@br.ibm.com> --- src/kimchi/swupdate.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/kimchi/swupdate.py b/src/kimchi/swupdate.py index 3238e44..356ec52 100644 --- a/src/kimchi/swupdate.py +++ b/src/kimchi/swupdate.py @@ -112,21 +112,27 @@ class SoftwareUpdate(object): """ Execute the update """ + # reset messages + cb('') + cmd = self._pkg_mnger.update_cmd proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) msgs = [] while proc.poll() is None: - msgs.append(proc.stdout.read()) - cb('\n'.join(msgs)) + msgs.append(proc.stdout.readline()) + cb(''.join(msgs)) time.sleep(0.5) + # read the final output lines + msgs.extend(proc.stdout.readlines()) + retcode = proc.poll() if retcode == 0: - return cb('\n'.join(msgs), True) + return cb(''.join(msgs), True) - msgs.append(proc.stderr.read()) - return cb('\n'.join(msgs), False) + msgs.extend(proc.stderr.readlines()) + return cb(''.join(msgs), False) class YumUpdate(object): -- 1.7.10.4

Reviewed-by: Rodrigo Trujillo <rodrigo.trujillo@linux.vnet.ibm.com> On 03/24/2014 03:33 PM, Aline Manera wrote:
From: Aline Manera <alinefm@br.ibm.com>
When updating the system, the user should be able to see the progress to know what is being done in the system.
stdout.read() will wait until get the completed output to return, ie, the user will see the progress only when the update finishs. So use stdout.readline() to read line by line and display the info to the user.
Signed-off-by: Aline Manera <alinefm@br.ibm.com> --- src/kimchi/swupdate.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/src/kimchi/swupdate.py b/src/kimchi/swupdate.py index 3238e44..356ec52 100644 --- a/src/kimchi/swupdate.py +++ b/src/kimchi/swupdate.py @@ -112,21 +112,27 @@ class SoftwareUpdate(object): """ Execute the update """ + # reset messages + cb('') + cmd = self._pkg_mnger.update_cmd proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) msgs = [] while proc.poll() is None: - msgs.append(proc.stdout.read()) - cb('\n'.join(msgs)) + msgs.append(proc.stdout.readline()) + cb(''.join(msgs)) time.sleep(0.5)
+ # read the final output lines + msgs.extend(proc.stdout.readlines()) + retcode = proc.poll() if retcode == 0: - return cb('\n'.join(msgs), True) + return cb(''.join(msgs), True)
- msgs.append(proc.stderr.read()) - return cb('\n'.join(msgs), False) + msgs.extend(proc.stderr.readlines()) + return cb(''.join(msgs), False)
class YumUpdate(object):

From: Aline Manera <alinefm@br.ibm.com> When an error occurs during an update the user should know the error to report or solve it. So properly update the progress area with task information when an update fails. Signed-off-by: Aline Manera <alinefm@br.ibm.com> --- ui/js/src/kimchi.host.js | 1 + 1 file changed, 1 insertion(+) diff --git a/ui/js/src/kimchi.host.js b/ui/js/src/kimchi.host.js index 5d32c4a..6fa8b8c 100644 --- a/ui/js/src/kimchi.host.js +++ b/ui/js/src/kimchi.host.js @@ -58,6 +58,7 @@ kimchi.host_main = function() { result: result }); }, function(result) { + reloadProgressArea(result); $(updateButton).text(i18n['KCHUPD6006M']).prop('disabled', false); }, reloadProgressArea); } -- 1.7.10.4

Reviewed-by: Rodrigo Trujillo <rodrigo.trujillo@linux.vnet.ibm.com> On 03/24/2014 03:33 PM, Aline Manera wrote:
From: Aline Manera <alinefm@br.ibm.com>
When an error occurs during an update the user should know the error to report or solve it. So properly update the progress area with task information when an update fails.
Signed-off-by: Aline Manera <alinefm@br.ibm.com> --- ui/js/src/kimchi.host.js | 1 + 1 file changed, 1 insertion(+)
diff --git a/ui/js/src/kimchi.host.js b/ui/js/src/kimchi.host.js index 5d32c4a..6fa8b8c 100644 --- a/ui/js/src/kimchi.host.js +++ b/ui/js/src/kimchi.host.js @@ -58,6 +58,7 @@ kimchi.host_main = function() { result: result }); }, function(result) { + reloadProgressArea(result); $(updateButton).text(i18n['KCHUPD6006M']).prop('disabled', false); }, reloadProgressArea); }
participants (3)
-
Aline Manera
-
Ramon Medeiros
-
Rodrigo Trujillo