Advertisement
Guest User

Untitled

a guest
May 27th, 2016
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.60 KB | None | 0 0
  1. ###
  2. # copy this gist to /usr/lib/python2.7/site-packages/pulp_rpm/882.patch
  3. # patch -p3 < 882.patch
  4. # sudo -u apache pulp-manage-db
  5. # satellite-installer --upgrade
  6.  
  7.  
  8. From 0b7636b8d905840bac715ccb34050a782b369fe8 Mon Sep 17 00:00:00 2001
  9. From: Jeff Ortel <jortel@redhat.com>
  10. Date: Thu, 26 May 2016 15:40:33 -0500
  11. Subject: [PATCH] Fix storage path on ISO units. closes #1945
  12.  
  13. ---
  14. .../migrations/0028_standard_storage_path.py | 50 +++++++++++++++-------
  15. .../migrations/test_0028_standard_storage_path.py | 33 ++++++++++++--
  16. 2 files changed, 65 insertions(+), 18 deletions(-)
  17.  
  18. diff --git a/plugins/pulp_rpm/plugins/migrations/0028_standard_storage_path.py b/plugins/pulp_rpm/plugins/migrations/0028_standard_storage_path.py
  19. index 7727a1e..81bd40e 100644
  20. --- a/plugins/pulp_rpm/plugins/migrations/0028_standard_storage_path.py
  21. +++ b/plugins/pulp_rpm/plugins/migrations/0028_standard_storage_path.py
  22. @@ -13,7 +13,7 @@ def migrate(*args, **kwargs):
  23. migration.add(drpm_plan())
  24. migration.add(distribution_plan())
  25. migration.add(yum_metadata_plan())
  26. - migration.add(iso_plan())
  27. + migration.add(ISO())
  28. migration()
  29.  
  30.  
  31. @@ -112,17 +112,37 @@ def yum_metadata_plan():
  32. return Plan(collection, key_fields)
  33.  
  34.  
  35. -def iso_plan():
  36. - """
  37. - Factory to create an ISO migration plan.
  38. -
  39. - :return: A configured plan.
  40. - :rtype: Plan
  41. - """
  42. - key_fields = (
  43. - 'name',
  44. - 'checksum',
  45. - 'size'
  46. - )
  47. - collection = connection.get_collection('units_iso')
  48. - return Plan(collection, key_fields)
  49. +class ISO(Plan):
  50. + """
  51. + The migration plan for ISO units.
  52. + """
  53. +
  54. + def __init__(self):
  55. + """
  56. + Call super with collection and fields.
  57. + """
  58. + key_fields = (
  59. + 'name',
  60. + 'checksum',
  61. + 'size'
  62. + )
  63. + collection = connection.get_collection('units_iso')
  64. + super(ISO, self).__init__(collection, key_fields)
  65. +
  66. + def _new_path(self, unit):
  67. + """
  68. + Units created by 2.8.0 don't include the ISO name. This was a regression
  69. + that is being corrected by this additional logic. If the storage path
  70. + does not end with the *name* stored in the unit, it is appended.
  71. +
  72. + :param unit: The unit being migrated.
  73. + :type unit: pulp.plugins.migration.standard_storage_path.Unit
  74. + :return: The new path.
  75. + :rtype: str
  76. + """
  77. + name = unit.document['name']
  78. + path = unit.document['_storage_path']
  79. + if not path.endswith(name):
  80. + unit.document['_storage_path'] = name
  81. + new_path = super(ISO, self)._new_path(unit)
  82. + return new_path
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement