Bug 786762 - Re-running the cancelled sync on completion, should change the status from 'cancelled" to 'sync complete'
Summary: Re-running the cancelled sync on completion, should change the status from 'c...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: WebUI
Version: 6.0.1
Hardware: Unspecified
OS: Unspecified
unspecified
medium vote
Target Milestone: Unspecified
Assignee: Eric Helms
QA Contact: Katello QA List
URL:
Whiteboard:
Depends On:
Blocks: 786376
TreeView+ depends on / blocked
 
Reported: 2012-02-02 10:46 UTC by Sachin Ghai
Modified: 2019-09-26 13:29 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-08-22 18:24:36 UTC
Target Upstream Version:


Attachments (Terms of Use)
status remains cencelled on sync completion (36.47 KB, image/png)
2012-02-02 10:50 UTC, Sachin Ghai
no flags Details

Description Sachin Ghai 2012-02-02 10:46:55 UTC
Description of problem:
I was trying different sync scenarios. So I cancelled the running sync. The status immediately changed to 'cancelled' on UI.

However after few minutes, I re-sync the same repo and on completion sync status remains 'cancelled'. However this should be changed to 'Sync complete'

Version-Release number of selected component (if applicable):
katello-0.1.211-1.el6.noarch
pulp-0.0.264-1.el6.noarch

How reproducible:
always

Steps to Reproduce:
1. sync a repo
2. cancel the sync 
3. Re-sync the same repo
  
Actual results:
On re-sync completion, sync status remains cancelled

Expected results:
Re-running the cancelled sync on completion, should change the status from 'cancelled" to 'sync complete' 

Additional info:

Comment 1 Sachin Ghai 2012-02-02 10:50:35 UTC
Created attachment 559031 [details]
status remains cencelled on sync completion

Comment 2 Mike McCune 2012-02-09 01:27:12 UTC
starting a sync should clear the previous status....

Comment 3 Shannon Hughes 2012-02-13 16:25:38 UTC
very good catch on this one. this was a bit tricky. there were two issues which made this a bit confusing since i could not always duplicate. 

1) we can't rely on order for the sync history objects that come back from pulp. we need to order them
2) we were accidentally popping the stack in our lower api layers and therefore losing the 'finished' data when the pulp list was not in order

working on a fix

Comment 4 Shannon Hughes 2012-02-13 21:26:35 UTC
c611fda..54db6b5  master -> master

Comment 5 Jeff Weiss 2012-02-14 17:14:40 UTC
Had to revert since fix seems to have caused 790246

Comment 6 Shannon Hughes 2012-02-16 17:44:26 UTC
tried sorting the sync status history based on finish time. that seemed to fix this problem but also introduced other problems that were worse so backed it out. moving on to other bugs for now and will revisit. 

diff --git a/src/app/models/glue/pulp/repo.rb b/src/app/models/glue/pulp/repo.rb
index 2cd8856..573fa59 100644
--- a/src/app/models/glue/pulp/repo.rb
+++ b/src/app/models/glue/pulp/repo.rb
 -422,7 +422,7 @@ module Glue::Pulp::Repo
 
   def sync_statuses
     @sync_status = self._get_most_recent_sync_status() if @sync_status.nil?
-    @sync_status
+    @sync_status.sort_by{|item| item.finish_time}.reverse 
   end
 
   def sync_state
diff --git a/src/lib/resources/pulp.rb b/src/lib/resources/pulp.rb
index f714b64..035b2d6 100644
--- a/src/lib/resources/pulp.rb
+++ b/src/lib/resources/pulp.rb
 -284,7 +284,7 @@ module Pulp
         response = get(path, self.default_headers)
         parsed = JSON.parse(response.body)
         return parsed if parsed.empty?
-        return parsed.first.with_indifferent_access
+        return parsed.with_indifferent_access 
       end

Comment 7 Shannon Hughes 2012-02-17 15:56:38 UTC
problem with above is active syncs will have a finish_time of nil so we can blindly sort just on finish_time. explains why it fixes original issue but erratically busts active syncs.

Comment 8 Jason E. Rist 2012-03-01 21:21:18 UTC
Assigning to jsherrill since Shannon is no longer on the team.

Comment 10 Mike McCune 2012-03-07 23:44:15 UTC
mass move ON_QA after brewing

Comment 11 Corey Welton 2012-03-08 20:52:31 UTC
QA Verified: 0.1.303-1.el6

Comment 13 Mike McCune 2013-08-16 17:57:11 UTC
getting rid of 6.0.0 version since that doesn't exist


Note You need to log in before you can comment on or make changes to this bug.