Skip to content
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

Add Domain support. #3106

Merged
merged 1 commit into from
May 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ if [ "$TEST" = "azure" ]; then
- ./azurite:/etc/pulp\
command: "azurite-blob --blobHost 0.0.0.0 --cert /etc/pulp/azcert.pem --key /etc/pulp/azkey.pem"' vars/main.yaml
sed -i -e '$a azure_test: true\
pulp_scenario_settings: null\
pulp_scenario_settings: {"domain_enabled": true}\
' vars/main.yaml
fi

Expand Down
1 change: 1 addition & 0 deletions CHANGES/3008.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added support for Domains.
1 change: 1 addition & 0 deletions pulp_rpm/app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ class PulpRpmPluginAppConfig(PulpPluginAppConfig):
label = "rpm"
version = "3.21.0.dev"
python_package_name = "pulp-rpm"
domain_compatible = True
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
# Generated by Django 4.2.1 on 2023-05-15 16:51

from django.db import migrations, models
import django.db.models.deletion
import pulpcore.app.util


class Migration(migrations.Migration):

dependencies = [
('core', '0106_alter_artifactdistribution_distribution_ptr_and_more'),
('rpm', '0050_alter_addon_pulp_id_alter_checksum_pulp_id_and_more'),
]

operations = [
migrations.AlterUniqueTogether(
name='distributiontree',
unique_together=set(),
),
migrations.AlterUniqueTogether(
name='modulemd',
unique_together=set(),
),
migrations.AlterUniqueTogether(
name='modulemdobsolete',
unique_together=set(),
),
migrations.AlterUniqueTogether(
name='package',
unique_together=set(),
),
migrations.AlterUniqueTogether(
name='repometadatafile',
unique_together=set(),
),
migrations.AddField(
model_name='distributiontree',
name='_pulp_domain',
field=models.ForeignKey(default=pulpcore.app.util.get_domain_pk, on_delete=django.db.models.deletion.PROTECT, to='core.domain'),
),
migrations.AddField(
model_name='modulemd',
name='_pulp_domain',
field=models.ForeignKey(default=pulpcore.app.util.get_domain_pk, on_delete=django.db.models.deletion.PROTECT, to='core.domain'),
),
migrations.AddField(
model_name='modulemddefaults',
name='_pulp_domain',
field=models.ForeignKey(default=pulpcore.app.util.get_domain_pk, on_delete=django.db.models.deletion.PROTECT, to='core.domain'),
),
migrations.AddField(
model_name='modulemdobsolete',
name='_pulp_domain',
field=models.ForeignKey(default=pulpcore.app.util.get_domain_pk, on_delete=django.db.models.deletion.PROTECT, to='core.domain'),
),
migrations.AddField(
model_name='package',
name='_pulp_domain',
field=models.ForeignKey(default=pulpcore.app.util.get_domain_pk, on_delete=django.db.models.deletion.PROTECT, to='core.domain'),
),
migrations.AddField(
model_name='packagecategory',
name='_pulp_domain',
field=models.ForeignKey(default=pulpcore.app.util.get_domain_pk, on_delete=django.db.models.deletion.PROTECT, to='core.domain'),
),
migrations.AddField(
model_name='packageenvironment',
name='_pulp_domain',
field=models.ForeignKey(default=pulpcore.app.util.get_domain_pk, on_delete=django.db.models.deletion.PROTECT, to='core.domain'),
),
migrations.AddField(
model_name='packagegroup',
name='_pulp_domain',
field=models.ForeignKey(default=pulpcore.app.util.get_domain_pk, on_delete=django.db.models.deletion.PROTECT, to='core.domain'),
),
migrations.AddField(
model_name='packagelangpacks',
name='_pulp_domain',
field=models.ForeignKey(default=pulpcore.app.util.get_domain_pk, on_delete=django.db.models.deletion.PROTECT, to='core.domain'),
),
migrations.AddField(
model_name='repometadatafile',
name='_pulp_domain',
field=models.ForeignKey(default=pulpcore.app.util.get_domain_pk, on_delete=django.db.models.deletion.PROTECT, to='core.domain'),
),
migrations.AddField(
model_name='updaterecord',
name='_pulp_domain',
field=models.ForeignKey(default=pulpcore.app.util.get_domain_pk, on_delete=django.db.models.deletion.PROTECT, to='core.domain'),
),
migrations.AlterField(
model_name='modulemddefaults',
name='digest',
field=models.TextField(db_index=True),
),
migrations.AlterField(
model_name='package',
name='pkgId',
field=models.TextField(db_index=True),
),
migrations.AlterField(
model_name='packagecategory',
name='digest',
field=models.TextField(db_index=True),
),
migrations.AlterField(
model_name='packageenvironment',
name='digest',
field=models.TextField(db_index=True),
),
migrations.AlterField(
model_name='packagegroup',
name='digest',
field=models.TextField(db_index=True),
),
migrations.AlterField(
model_name='packagelangpacks',
name='digest',
field=models.TextField(db_index=True),
),
migrations.AlterField(
model_name='updaterecord',
name='digest',
field=models.TextField(db_index=True),
),
migrations.AlterUniqueTogether(
name='distributiontree',
unique_together={('_pulp_domain', 'digest')},
),
migrations.AlterUniqueTogether(
name='modulemd',
unique_together={('_pulp_domain', 'name', 'stream', 'version', 'context', 'arch')},
),
migrations.AlterUniqueTogether(
name='modulemddefaults',
unique_together={('_pulp_domain', 'digest')},
),
migrations.AlterUniqueTogether(
name='modulemdobsolete',
unique_together={('_pulp_domain', 'modified', 'module_name', 'module_stream')},
),
migrations.AlterUniqueTogether(
name='package',
unique_together={('_pulp_domain', 'name', 'epoch', 'version', 'release', 'arch', 'checksum_type', 'pkgId')},
),
migrations.AlterUniqueTogether(
name='packagecategory',
unique_together={('_pulp_domain', 'digest')},
),
migrations.AlterUniqueTogether(
name='packageenvironment',
unique_together={('_pulp_domain', 'digest')},
),
migrations.AlterUniqueTogether(
name='packagegroup',
unique_together={('_pulp_domain', 'digest')},
),
migrations.AlterUniqueTogether(
name='packagelangpacks',
unique_together={('_pulp_domain', 'digest')},
),
migrations.AlterUniqueTogether(
name='repometadatafile',
unique_together={('_pulp_domain', 'data_type', 'checksum', 'relative_path')},
),
migrations.AlterUniqueTogether(
name='updaterecord',
unique_together={('_pulp_domain', 'digest')},
),
]
11 changes: 4 additions & 7 deletions pulp_rpm/app/models/advisory.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
BaseModel,
Content,
)
from pulpcore.plugin.util import get_domain_pk

from pulp_rpm.app.constants import (
CR_UPDATE_COLLECTION_ATTRS,
Expand Down Expand Up @@ -100,14 +101,9 @@ class UpdateRecord(Content):
# A field that represents the hash digest of the update record. Used to track differences
# between two UpdateRecord objects without having to examine the associations like
# UpdateCollection or UpdateCollectionPackage.
digest = models.TextField(unique=True)
digest = models.TextField(db_index=True)

@classmethod
def natural_key_fields(cls):
"""
Digest is used as a natural key for UpdateRecords.
"""
return ("digest",)
_pulp_domain = models.ForeignKey("core.Domain", default=get_domain_pk, on_delete=models.PROTECT)
ggainey marked this conversation as resolved.
Show resolved Hide resolved

@classmethod
def createrepo_to_dict(cls, update):
Expand Down Expand Up @@ -228,6 +224,7 @@ def get_module_list(self):

class Meta:
default_related_name = "%(app_label)s_%(model_name)s"
unique_together = ("_pulp_domain", "digest")


class UpdateCollection(BaseModel):
Expand Down
49 changes: 17 additions & 32 deletions pulp_rpm/app/models/comps.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from django.db import models

from pulpcore.plugin.models import Content
from pulpcore.plugin.util import get_domain_pk

from pulp_rpm.app.constants import (
LIBCOMPS_CATEGORY_ATTRS,
Expand Down Expand Up @@ -73,19 +74,15 @@ class PackageGroup(Content):
desc_by_lang = models.JSONField(default=dict)
name_by_lang = models.JSONField(default=dict)

digest = models.TextField(unique=True)
digest = models.TextField(db_index=True)

repo_key_fields = ("id",)

_pulp_domain = models.ForeignKey("core.Domain", default=get_domain_pk, on_delete=models.PROTECT)

class Meta:
default_related_name = "%(app_label)s_%(model_name)s"

@classmethod
def natural_key_fields(cls):
"""
Digest is used as a natural key for PackageGroups.
"""
return ("digest",)
unique_together = ("_pulp_domain", "digest")

@classmethod
def pkglist_to_list(cls, value):
Expand Down Expand Up @@ -230,19 +227,15 @@ class PackageCategory(Content):
desc_by_lang = models.JSONField(default=dict)
name_by_lang = models.JSONField(default=dict)

digest = models.TextField(unique=True)
digest = models.TextField(db_index=True)

repo_key_fields = ("id",)

_pulp_domain = models.ForeignKey("core.Domain", default=get_domain_pk, on_delete=models.PROTECT)

class Meta:
default_related_name = "%(app_label)s_%(model_name)s"

@classmethod
def natural_key_fields(cls):
"""
Digest is used as a natural key for PackageCategory.
"""
return ("digest",)
unique_together = ("_pulp_domain", "digest")

@classmethod
def grplist_to_lst(cls, value):
Expand Down Expand Up @@ -357,19 +350,15 @@ class PackageEnvironment(Content):
desc_by_lang = models.JSONField(default=dict)
name_by_lang = models.JSONField(default=dict)

digest = models.TextField(unique=True)
digest = models.TextField(db_index=True)

repo_key_fields = ("id",)

_pulp_domain = models.ForeignKey("core.Domain", default=get_domain_pk, on_delete=models.PROTECT)

class Meta:
default_related_name = "%(app_label)s_%(model_name)s"

@classmethod
def natural_key_fields(cls):
"""
Digest is used as a natural key for PackageEnvironment.
"""
return ("digest",)
unique_together = ("_pulp_domain", "digest")

@classmethod
def grplist_to_lst(cls, value):
Expand Down Expand Up @@ -463,17 +452,13 @@ class PackageLangpacks(Content):

matches = models.JSONField(default=dict)

digest = models.TextField(unique=True)
digest = models.TextField(db_index=True)

_pulp_domain = models.ForeignKey("core.Domain", default=get_domain_pk, on_delete=models.PROTECT)

class Meta:
default_related_name = "%(app_label)s_%(model_name)s"

@classmethod
def natural_key_fields(cls):
"""
Digest is used as a natural key for PackageLangpacks.
"""
return ("digest",)
unique_together = ("_pulp_domain", "digest")

@classmethod
def libcomps_to_dict(cls, langpacks):
Expand Down
5 changes: 4 additions & 1 deletion pulp_rpm/app/models/custom_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from django.db import models

from pulpcore.plugin.models import Content
from pulpcore.plugin.util import get_domain_pk
from pulp_rpm.app.constants import CHECKSUM_CHOICES

log = getLogger(__name__)
Expand Down Expand Up @@ -32,9 +33,11 @@ class RepoMetadataFile(Content):

repo_key_fields = ("data_type",)

_pulp_domain = models.ForeignKey("core.Domain", default=get_domain_pk, on_delete=models.PROTECT)

class Meta:
default_related_name = "%(app_label)s_%(model_name)s"
unique_together = ("data_type", "checksum", "relative_path")
unique_together = ("_pulp_domain", "data_type", "checksum", "relative_path")

@property
def unsupported_metadata_type(self):
Expand Down
5 changes: 4 additions & 1 deletion pulp_rpm/app/models/distribution.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
ContentArtifact,
Repository,
)
from pulpcore.plugin.util import get_domain_pk

log = getLogger(__name__)

Expand Down Expand Up @@ -94,6 +95,8 @@ class DistributionTree(Content):

digest = models.TextField(null=False)

_pulp_domain = models.ForeignKey("core.Domain", default=get_domain_pk, on_delete=models.PROTECT)

def repositories(self):
"""
Return the subrepos in this DistributionTree.
Expand Down Expand Up @@ -134,7 +137,7 @@ def artifacts(self):

class Meta:
default_related_name = "%(app_label)s_%(model_name)s"
unique_together = ("digest",)
unique_together = ("_pulp_domain", "digest")


class Checksum(BaseModel):
Expand Down
Loading