-
Notifications
You must be signed in to change notification settings - Fork 180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Synchronizing rpm repositories using channel lookup #9052
Synchronizing rpm repositories using channel lookup #9052
Conversation
…rks - to be fixed later
…_parse to parse the rpm's packages metadata
…rser (both of them)
…mary.xml and inserted it to the database, after adding a new 'remote_path' column to the 'rhn_package' table
… full url to avoid rebuilding it later
rpm_repository = RPMRepo(args.name, args.cache, args.url, arch) | ||
packages = rpm_repository.get_packages_metadata() # packages is a generator | ||
failed = 0 | ||
for i, batch in enumerate(batched(packages, args.batch_size)): | ||
failed += import_package_batch(batch, i) | ||
logging.debug("Completed import with %d failed packages", failed) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can probably move this into a function to share it with the channel case.
for repo in target_repos: | ||
if repo.repo_type == "yum": | ||
rpm_repository = RPMRepo( | ||
repo.repo_label, args.cache, repo.source_url, arch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the channel arch instead of arch
here: the architecture for a channel is provided by the database.
# No url specified | ||
if args.channel: | ||
channel_id = args.channel | ||
target_repos = db_utils.get_repositories_by_channel_id(channel_id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No one knows the channel ID, you cannot ask that as a command line parameter. What users will pass here is the channel label.
@@ -78,18 +80,55 @@ def main(): | |||
type=str, | |||
) | |||
|
|||
parser.add_argument( | |||
"--channel", | |||
help="The channel id of which you want to synchronize repositories", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not the channel id, but the channel label
select s.id, s.source_url, s.metadata_signed, s.label as repo_label, cst.label as repo_type_label | ||
from rhnContentSource s, | ||
rhnChannelContentSource cs, | ||
rhnContentSourceType cst | ||
where s.id = cs.source_id | ||
and cst.id = s.type_id | ||
and cs.channel_id = :channel_id""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could join with the rhnChannel
table and get the repositories by channel label. In which case you would need to copy the channel architecture in each RepoDTO
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 10 days. |
The Code of this PR is included here, we no longer need this. |
What does this PR change?
Added the
--channel
argument, which enables the sync of the repos (currently rpms) using the channel label.The channel's and the corresponding repositories' information is fetched from the database.
GUI diff
No difference.
Documentation
No documentation needed: only internal and user invisible changes
DONE
Test coverage
No tests: In progress
DONE
Links
Issue(s): #
Port(s): # add downstream PR(s), if any
Changelogs
Make sure the changelogs entries you are adding are compliant with https://github.com/uyuni-project/uyuni/wiki/Contributing#changelogs and https://github.com/uyuni-project/uyuni/wiki/Contributing#uyuni-projectuyuni-repository
If you don't need a changelog check, please mark this checkbox:
If you uncheck the checkbox after the PR is created, you will need to re-run
changelog_test
(see below)Re-run a test
If you need to re-run a test, please mark the related checkbox, it will be unchecked automatically once it has re-run:
Before you merge
Check How to branch and merge properly!