Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ###
- # copy this gist to /usr/lib/python2.7/site-packages/pulp_rpm/882.patch
- # patch -p3 < 882.patch
- # sudo -u apache pulp-manage-db
- # satellite-installer --upgrade
- From 0b7636b8d905840bac715ccb34050a782b369fe8 Mon Sep 17 00:00:00 2001
- From: Jeff Ortel <jortel@redhat.com>
- Date: Thu, 26 May 2016 15:40:33 -0500
- Subject: [PATCH] Fix storage path on ISO units. closes #1945
- ---
- .../migrations/0028_standard_storage_path.py | 50 +++++++++++++++-------
- .../migrations/test_0028_standard_storage_path.py | 33 ++++++++++++--
- 2 files changed, 65 insertions(+), 18 deletions(-)
- diff --git a/plugins/pulp_rpm/plugins/migrations/0028_standard_storage_path.py b/plugins/pulp_rpm/plugins/migrations/0028_standard_storage_path.py
- index 7727a1e..81bd40e 100644
- --- a/plugins/pulp_rpm/plugins/migrations/0028_standard_storage_path.py
- +++ b/plugins/pulp_rpm/plugins/migrations/0028_standard_storage_path.py
- @@ -13,7 +13,7 @@ def migrate(*args, **kwargs):
- migration.add(drpm_plan())
- migration.add(distribution_plan())
- migration.add(yum_metadata_plan())
- - migration.add(iso_plan())
- + migration.add(ISO())
- migration()
- @@ -112,17 +112,37 @@ def yum_metadata_plan():
- return Plan(collection, key_fields)
- -def iso_plan():
- - """
- - Factory to create an ISO migration plan.
- -
- - :return: A configured plan.
- - :rtype: Plan
- - """
- - key_fields = (
- - 'name',
- - 'checksum',
- - 'size'
- - )
- - collection = connection.get_collection('units_iso')
- - return Plan(collection, key_fields)
- +class ISO(Plan):
- + """
- + The migration plan for ISO units.
- + """
- +
- + def __init__(self):
- + """
- + Call super with collection and fields.
- + """
- + key_fields = (
- + 'name',
- + 'checksum',
- + 'size'
- + )
- + collection = connection.get_collection('units_iso')
- + super(ISO, self).__init__(collection, key_fields)
- +
- + def _new_path(self, unit):
- + """
- + Units created by 2.8.0 don't include the ISO name. This was a regression
- + that is being corrected by this additional logic. If the storage path
- + does not end with the *name* stored in the unit, it is appended.
- +
- + :param unit: The unit being migrated.
- + :type unit: pulp.plugins.migration.standard_storage_path.Unit
- + :return: The new path.
- + :rtype: str
- + """
- + name = unit.document['name']
- + path = unit.document['_storage_path']
- + if not path.endswith(name):
- + unit.document['_storage_path'] = name
- + new_path = super(ISO, self)._new_path(unit)
- + return new_path
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement