Ejemplo n.º 1
0
 def get_release_id(self):
     bp_dict = {}
     if self.base_product:
         bp_dict = {
             "bp_short": self.base_product.short.lower(),
             "bp_version": self.base_product.version,
             "bp_type": self.base_product.release_type.short,
         }
     return create_release_id(self.short.lower(), self.version, self.release_type.short, **bp_dict)
def set_release_id(obj):
    bp_dict = {}
    if obj.base_product:
        bp_dict = {
            "bp_short": obj.base_product.short.lower(),
            "bp_version": obj.base_product.version,
            "bp_type": obj.base_product.release_type.short,
        }
    obj.release_id = create_release_id(obj.short.lower(), obj.version, obj.release_type.short, **bp_dict)
Ejemplo n.º 3
0
def get_or_create_integrated_release(request, orig_release, release):
    """
    Given a PDC release and a release retrieved from compose info specified in
    a variant, return the release for integrated layered product. The Product,
    ProductVersion and BaseProduct instances will also be created if necessary.
    """
    integrated_base_product, _ = _logged_get_or_create(
        request, models.BaseProduct,
        name=orig_release.name,
        short=orig_release.short,
        version=orig_release.version.split('.')[0],
        release_type=orig_release.release_type
    )
    integrated_product, _ = _logged_get_or_create(
        request, models.Product,
        name=release.name,
        short=release.short.lower()
    )
    integrated_product_version, _ = _logged_get_or_create(
        request, models.ProductVersion,
        product=integrated_product,
        name=release.name,
        short=release.short.lower(),
        version=release.version.split('.')[0]
    )
    try:
        integrated_release, _ = _logged_get_or_create(
            request, models.Release,
            name=release.name,
            short=release.short.lower(),
            release_type=orig_release.release_type,
            version=release.version,
            base_product=integrated_base_product,
            integrated_with=orig_release,
            product_version=integrated_product_version
        )
    except ValidationError:
        release_id = create_release_id(
            release.short.lower(),
            release.version,
            orig_release.release_type.short,
            integrated_base_product.short,
            integrated_base_product.version,
            integrated_base_product.release_type.short,
        )
        msg = ('Failed to create release {} for integrated layered product.' +
               ' A conflicting release already exists.' +
               ' There is likely a version mismatch between the imported' +
               ' release and its layered integrated product in the composeinfo.')
        raise ValidationError(msg.format(release_id))
    return integrated_release
Ejemplo n.º 4
0
 def get_base_product_id(self):
     return create_release_id(self.short.lower(), self.version, self.release_type.short)
def set_baseproduct_id(obj):
    obj.base_product_id = create_release_id(obj.short.lower(), obj.version, obj.release_type.short)
Ejemplo n.º 6
0
 def test_create_release_id(self):
     self.assertEqual(create_release_id("f", "23", "ga"), "f-23")
     self.assertEqual(create_release_id("f", "23", "updates"), "f-23-updates")
     self.assertRaises(TypeError, create_release_id, "f", "23", None)
Ejemplo n.º 7
0
 def test_create_release_id(self):
     self.assertEqual(create_release_id("f", "23", "ga"), "f-23")
     self.assertEqual(create_release_id("f", "23", "updates"), "f-23-updates")
     self.assertRaises(ValueError, create_release_id, "f", "23", None)