Bug 749230

Summary: Unable to clone a repo that has distributions
Product: [Retired] Pulp Reporter: Brad Buckingham <bbuckingham>
Component: user-experienceAssignee: Pradeep Kilambi <pkilambi>
Status: CLOSED CURRENTRELEASE QA Contact: Preethi Thomas <pthomas>
Severity: high Docs Contact:
Priority: unspecified    
Version: 1.0.0CC: skarmark
Target Milestone: ---Keywords: Triaged
Target Release: Sprint 29   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-02-24 20:15:08 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Brad Buckingham 2011-10-26 14:33:32 UTC
Description of problem:

Attempting to clone a repository that has a distribution fails.  This behavior was observed while attempting to 'promote' a product (i.e. containing a repo) from the current environment to the next environment.  As part of this process, katello will 'clone' the repo being promoted.

Version-Release number of selected component (if applicable):


How reproducible:
always

Steps to Reproduce:
1. sync a repo that contains a distribution, e.g. 
   http://download.fedora.devel.redhat.com/pub/fedora/linux/releases/15/Fedora/x86_64/os)
2. clone the repo, e.g.
   POST /pulp/api/repositories/ACME_Corporation-fedora_product-f15_repo/clone/
  
Actual results:
httpd error_log:

[Wed Oct 26 08:54:45 2011] [error] 2011-10-26 08:54:45,131 pulp.server.api.repo_sync:ERROR: `/var/lib/pulp//repos/ACME_Corporation/Locker/fedora_product/f15_repo/.treeinfo` and `/var/lib/pulp//distributions/ks-Fedora-Fedora-15-x86_64/.treeinfo` are the same file
[Wed Oct 26 08:54:45 2011] [error] 2011-10-26 08:54:45,132 pulp.server.tasking.task:ERROR: Task failed: Task 1860d1a1-ffd1-11e0-b6e0-bc305ba6d5b4: _clone(ACME_Corporation-dev-fedora_product-f15_repo, feed=parent, progress_callback=<bound method RepoCloneTask.progress_callback of <pulp.server.api.repo_clone_task.RepoCloneTask object at 0x7fb5a639cb90>>, clone_name=f15_repo, relative_path=ACME_Corporation/dev/fedora_product/f15_repo, synchronizer=<pulp.server.api.synchronizers.YumSynchronizer object at 0x7fb5b8713410>, filters=[], id=ACME_Corporation-fedora_product-f15_repo, groupid=['product:1319579357065', 'env:2', 'org:1'])
[Wed Oct 26 08:54:45 2011] [error] Traceback (most recent call last):
[Wed Oct 26 08:54:45 2011] [error]   File "/usr/lib/python2.7/site-packages/pulp/server/tasking/task.py", line 404, in run
[Wed Oct 26 08:54:45 2011] [error]     result = self.callable(*self.args, **self.kwargs)
[Wed Oct 26 08:54:45 2011] [error]   File "/usr/lib/python2.7/site-packages/pulp/server/api/repo_sync.py", line 137, in _clone
[Wed Oct 26 08:54:45 2011] [error]     _sync(clone_id, progress_callback=progress_callback, synchronizer=synchronizer)
[Wed Oct 26 08:54:45 2011] [error]   File "/usr/lib/python2.7/site-packages/pulp/server/api/repo_sync.py", line 266, in _sync
[Wed Oct 26 08:54:45 2011] [error]     progress_callback, synchronizer, max_speed, threads)
[Wed Oct 26 08:54:45 2011] [error]   File "/usr/lib/python2.7/site-packages/pulp/server/api/repo_sync.py", line 344, in fetch_content
[Wed Oct 26 08:54:45 2011] [error]     progress_callback, max_speed, threads)
[Wed Oct 26 08:54:45 2011] [error]   File "/usr/lib/python2.7/site-packages/pulp/server/api/synchronizers.py", line 153, in sync
[Wed Oct 26 08:54:45 2011] [error]     max_speed=max_speed, threads=threads)
[Wed Oct 26 08:54:45 2011] [error]   File "/usr/lib/python2.7/site-packages/pulp/server/api/synchronizers.py", line 993, in local
[Wed Oct 26 08:54:45 2011] [error]     self._sync_distributions(dst_repo_dir, src_repo_dir, progress_callback)
[Wed Oct 26 08:54:45 2011] [error]   File "/usr/lib/python2.7/site-packages/pulp/server/api/synchronizers.py", line 894, in _sync_distributions
[Wed Oct 26 08:54:45 2011] [error]     shutil.copy(treecfg, dist_tree_path)
[Wed Oct 26 08:54:45 2011] [error]   File "/usr/lib64/python2.7/shutil.py", line 116, in copy
[Wed Oct 26 08:54:45 2011] [error]     copyfile(src, dst)
[Wed Oct 26 08:54:45 2011] [error]   File "/usr/lib64/python2.7/shutil.py", line 68, in copyfile
[Wed Oct 26 08:54:45 2011] [error]     raise Error("`%s` and `%s` are the same file" % (src, dst))
[Wed Oct 26 08:54:45 2011] [error] Error: `/var/lib/pulp//repos/ACME_Corporation/Locker/fedora_product/f15_repo/.treeinfo` and `/var/lib/pulp//distributions/ks-Fedora-Fedora-15-x86_64/.treeinfo` are the same file
[Wed Oct 26 08:54:45 2011] [error] 

Expected results:

Clone succeeds, resulting in 2 repos (original and clone) and the original repo has a reference to the clone. 

Additional info:

Comment 1 Pradeep Kilambi 2011-10-26 16:47:47 UTC
fixed! commit f694e93abf7d0a1ecc2749751277a081d0169bb7

Comment 2 Jeff Ortel 2011-10-27 03:22:18 UTC
build 0.242-2

Comment 3 Preethi Thomas 2011-10-27 17:08:21 UTC
verified
[root@qeblade25 ~]# rpm -q pulp
pulp-0.0.242-2.el6.noarch
[root@qeblade25 ~]# 

[root@qeblade25 ~]# pulp-admin repo clone --id=f14 --clone_id=f14-clone --feed=f14-clone -F
Repository [f14] is being cloned as [f14-clone]
Clone: Finished
Item Details: 
Tree Files: 6/6
RPMs: 2766/2766


[root@qeblade25 ~]# pulp-admin -u admin -p admin repo clone --id=f14-new  --clone_id=f14-new-clone --feed=parent -F
Repository [f14-new] is being cloned as [f14-new-clone]
Clone: Finished
Item Details: 
Tree Files: 10/10
RPMs: 2766/2766

[root@qeblade25 ~]# pulp-admin repo list
+------------------------------------------+
       List of Available Repositories
+------------------------------------------+



Id                 	f14                      
Name               	f14                      
Repo URL           	https://qeblade25.rhq.lab.eng.bos.redhat.com/pulp/repos/released/F-14/GOLD/Fedora/x86_64/os/
Feed URL           	http://download.devel.redhat.com/released/F-14/GOLD/Fedora/x86_64/os
Feed Type          	remote                   
Content Type       	yum                      
Feed Certs         	CA:No   Cert:No
Consumer Certs     	CA:No   Cert:No
Architecture       	noarch                   
Sync Schedule      	None                     
Packages           	2766                     
Files              	0                        
Distributions      	ks-Fedora-Fedora-14-x86_64
Publish            	True                     
Clones             	[u'f14-clone']           
Groups             	None                     
Filters            	[]                       
Notes              	{}                       
Preserve Metadata  	False                     


       
Id                 	f14-clone                
Name               	f14-clone                
Repo URL           	https://qeblade25.rhq.lab.eng.bos.redhat.com/pulp/repos/f14-clone/
Feed URL           	file:///var/lib/pulp//repos/released/F-14/GOLD/Fedora/x86_64/os
Feed Type          	local                    
Content Type       	yum                      
Feed Certs         	CA:No   Cert:No
Consumer Certs     	CA:No   Cert:No
Architecture       	noarch                   
Sync Schedule      	None                     
Packages           	2766                     
Files              	0                        
Distributions      	ks-Fedora-Fedora-14-x86_64
Publish            	True                     
Clones             	[]                       
Groups             	None                     
Filters            	[]                       
Notes              	{}                       
Preserve Metadata  	False                     


Id                 	f14-new                  
Name               	f14-new                  
Repo URL           	https://qeblade25.rhq.lab.eng.bos.redhat.com/pulp/repos/released/F-14/GOLD/Fedora/x86_64/os/
Feed URL           	http://download.devel.redhat.com/released/F-14/GOLD/Fedora/x86_64/os
Feed Type          	remote                   
Content Type       	yum                      
Feed Certs         	CA:No   Cert:No
Consumer Certs     	CA:No   Cert:No
Architecture       	noarch                   
Sync Schedule      	None                     
Packages           	2766                     
Files              	0                        
Distributions      	ks-Fedora-Fedora-14-x86_64
Publish            	True                     
Clones             	[u'f14-new-clone']       
Groups             	None                     
Filters            	[]                       
Notes              	{}                       
Preserve Metadata  	False                     


Id                 	f14-new-clone            
Name               	f14-new-clone            
Repo URL           	https://qeblade25.rhq.lab.eng.bos.redhat.com/pulp/repos/f14-new-clone/
Feed URL           	file:///var/lib/pulp//repos/released/F-14/GOLD/Fedora/x86_64/os
Feed Type          	local                    
Content Type       	yum                      
Feed Certs         	CA:No   Cert:No
Consumer Certs     	CA:No   Cert:No
Architecture       	noarch                   
Sync Schedule      	None                     
Packages           	2766                     
Files              	0                        
Distributions      	ks-Fedora-Fedora-14-x86_64
Publish            	True                     
Clones             	[]                       
Groups             	None                     
Filters            	[]                       
Notes              	{}                       
Preserve Metadata  	False                     

[root@qeblade25 ~]# pulp-admin distribution list
+------------------------------------------+
       List of Available Distributions
+------------------------------------------+

Id                    	ks-Fedora-Fedora-14-x86_64
Description           	ks-Fedora-Fedora-14-x86_64
Family                	Fedora                   
Variant               	Fedora                   
Version               	14                       
URL                   	https://qeblade25.rhq.lab.eng.bos.redhat.com/pulp/ks/released/F-14/GOLD/Fedora/x86_64/os/
 			https://qeblade25.rhq.lab.eng.bos.redhat.com/pulp/ks/f14-clone/
 			https://qeblade25.rhq.lab.eng.bos.redhat.com/pulp/ks/released/F-14/GOLD/Fedora/x86_64/os/
 			https://qeblade25.rhq.lab.eng.bos.redhat.com/pulp/ks/f14-new-clone/
Timestamp             	2010-10-21T14:27:17

Comment 4 Preethi Thomas 2012-02-24 20:15:08 UTC
Pulp v1.0 is released
Closed Current Release.

Comment 5 Preethi Thomas 2012-02-24 20:16:49 UTC
Pulp v1.0 is released.