Bug 791362

Summary: Local sync should throw an error when repodata is missing
Product: [Retired] Pulp Reporter: Sayli Karmarkar <skarmark>
Component: user-experienceAssignee: John Matthews <jmatthew>
Status: CLOSED WORKSFORME QA Contact: Preethi Thomas <pthomas>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: cperry, mhrivnak
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-09-27 14:35:31 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 Sayli Karmarkar 2012-02-16 20:25:36 UTC
Description of problem:
Local sync completes successfully, but syncs 0 packages when repodata is missing. Log shows traceback when listing repodata dir which kinda gives us a clue, but we should display a proper error message to let user know about missing repodata. 

$ pulp-admin repo sync --id foo -F
Sync for repository foo started
Sync: Finished
0/4 new items downloaded
4/4 existing items processed

Item Details: 
RPMs: 0/4


pulp.log - 


2012-02-16 12:04:39,625 17472:139792125753088: pulp.server.api.repo_sync:INFO: repo_sync:256 Sync invoked for repo <foo>
2012-02-16 12:04:39,627 17472:139792125753088: pulp.server.api.repo_sync:INFO: repo_sync:270 Sync of foo starting, skip_dict = {}
2012-02-16 12:04:39,632 17472:139792125753088: pulp.server.api.synchronizers:INFO: synchronizers:1209 sync of /home/skarmark/pulp-test/ for repo foo
2012-02-16 12:04:39,633 17472:139792125753088: pulp.server.api.synchronizers:INFO: synchronizers:853 Found 4 packages in /home/skarmark/pulp-test/
2012-02-16 12:04:39,634 17472:139792125753088: pulp.server.api.synchronizers:INFO: synchronizers:865 Found 0 delta rpm packages in /home/skarmark/pulp-test/
2012-02-16 12:04:39,637 17472:139792125753088: pulp.server.api.synchronizers:INFO: synchronizers:989 Finished copying 0 packages
2012-02-16 12:04:39,638 17472:139792125753088: pulp.server.api.synchronizers:INFO: synchronizers:865 Found 0 delta rpm packages in /home/skarmark/pulp-test/
2012-02-16 12:04:39,639 17472:139792125753088: pulp.server.api.synchronizers:INFO: synchronizers:1100 No image files to import
2012-02-16 12:04:39,639 17472:139792125753088: pulp.server.api.synchronizers:INFO: synchronizers:1267 Copying repodata from /home/skarmark/pulp-test/repodata to /var/lib/pulp//repos/foo/repodata
2012-02-16 12:04:39,641 17472:139792125753088: pulp.server.api.synchronizers:ERROR: synchronizers:1272 Traceback (most recent call last):
  File "/home/skarmark/git/pulp1/pulp/src/pulp/server/api/synchronizers.py", line 1270, in local
    shutil.copytree(src_repodata_dir, dst_repodata_dir)
  File "/usr/lib64/python2.7/shutil.py", line 168, in copytree
    names = os.listdir(src)
OSError: [Errno 2] No such file or directory: '/home/skarmark/pulp-test/repodata'

2012-02-16 12:04:39,647 17472:139792125753088: pulp.server.api.synchronizers:INFO: synchronizers:847 checksum type for repo id foo is sha256
2012-02-16 12:04:39,648 17472:139792125753088: pulp.server.api.synchronizers:INFO: synchronizers:830 Running createrepo, this may take a few minutes to complete.
2012-02-16 12:04:39,649 17472:139792125753088: pulp.server.util:INFO: util:489 started repo metadata update: ['createrepo', '--database', '--checksum', 'sha256', '--update', '/var/lib/pulp//repos/foo']
2012-02-16 12:04:41,139 17472:139792125753088: pulp.server.util:INFO: util:542 createrepo on /var/lib/pulp//repos/foo finished
2012-02-16 12:04:41,140 17472:139792125753088: pulp.server.util:INFO: util:544 Nothing further to check; we got our fresh metadata
2012-02-16 12:04:41,140 17472:139792125753088: pulp.server.api.synchronizers:INFO: synchronizers:834 Createrepo finished in 1.49131798744 seconds
2012-02-16 12:04:41,142 17472:139792125753088: pulp.server.api.synchronizers:INFO: synchronizers:441 No image files to import to repo..
2012-02-16 12:04:41,145 17472:139792125753088: pulp.server.api.synchronizers:INFO: synchronizers:421 No metadata for 'File Sync' present; no files to import to repo..
2012-02-16 12:04:41,150 17472:139792125753088: pulp.server.api.synchronizers:INFO: synchronizers:411 Skipping errata imports from sync process
2012-02-16 12:04:41,158 17472:139792125753088: pulp.server.api.repo_sync:INFO: repo_sync:277 Sync on foo returned 0 packages, 0 errata in 1.53033590317 seconds
2012-02-16 12:04:41,160 17472:139792125753088: pulp.server.api.repo_sync:INFO: repo_sync:288 0 old packages to process, 0 new packages to process
2012-02-16 12:04:41,163 17472:139792125753088: pulp.server.api.repo_sync:INFO: repo_sync:303 Examining 0 errata from repo foo
2012-02-16 12:04:41,166 17472:139792125753088: pulp.server.api.repo_sync:INFO: repo_sync:307 Removing 0 old errata from repo foo
2012-02-16 12:04:41,173 17472:139792125753088: pulp.server.api.repo_sync:INFO: repo_sync:316 Adding 0 new errata to repo foo
2012-02-16 12:04:41,178 17472:139792125753088: pulp.server.tasking.task:INFO: task:441 Task succeeded: Task 753a52f0-58d9-11e1-be14-1c659d8e492e: _sync(foo, synchronizer=<pulp.server.api.synchronizers.YumSynchronizer object at 0x7f23dc035ad0>, skip={}, max_speed=None, threads=None, progress_callback=<bound method RepoSyncTask.progress_callback of <pulp.server.api.repo_sync_task.RepoSyncTask object at 0x7f23dc035d10>>)

Comment 1 Michael Hrivnak 2013-09-27 14:35:31 UTC
this has been fixed at some point.

$ pulp-admin rpm repo create --repo-id=abc --feed=file://tmp/
Successfully created repository [abc]

$ pulp-admin rpm repo sync run --repo-id abc
+----------------------------------------------------------------------+
                     Synchronizing Repository [abc]
+----------------------------------------------------------------------+

This command may be exited by pressing ctrl+c without affecting the actual
operation on the server.

Downloading metadata...
[-]
... failed

Couldn't open file /repodata/repomd.xml