Skip to content
This repository has been archived by the owner on Dec 7, 2022. It is now read-only.
/ pulp Public archive

Align importer models and serializers with MVP #3117

Merged
merged 1 commit into from
Sep 15, 2017

Conversation

asmacdo
Copy link
Contributor

@asmacdo asmacdo commented Aug 9, 2017

closes #2818
re #2817
closes #2816

This commit aligns the Importer model and serializer with the MVP
document for Pulp 3. The model docstrings are redundant with the
serializer help_text. The help_text will eventually become the
documentation, so removing using it exclusively will be the best way to
keep the code, comments, and documentation up to date.

@asmacdo asmacdo changed the title Align importers with Align importer models and serializers with MVP Aug 9, 2017
(BACKGROUND, 'Download In Background'))
(IMMEDIATE, 'Sync task is not complete until downloading is finished.'),
(ON_DEMAND, 'Sync task updates metadata but does not download content until requested.'),
(BACKGROUND, 'Sync task updates metadata and completes. Downloads complete in background.'))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest something more like:

IMMEDIATE: Update the repository content and ensures all artifacts are downloaded.

ON_DEMAND: Update the repository content but no artifacts are downloaded.

BACKGROUND: Update the repository content and downloads artifacts in the background.

The tasking seems irrelevant to the definition.


Relations:

scratchpad (GenericKeyValueRelation): Arbitrary information stashed by the importer.
Copy link
Contributor

@jortel jortel Aug 15, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sold on removing the docstrings. Also, it seems outside the scope of this issue.

MIRROR = 'mirror'
SYNC_MODES = (
(ADDITIVE, 'Add new content, keep content that was removed upstream.'),
(MIRROR, 'Add new content, remove content was removed upstream.'))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest something like:

ADDITIVE: Add new content.

MIRROR: Add new content and remove content that is no longer in the remote repository.

For additive, some content could still be removed from the repository in cases such as RPM only keeping X versions of RPMs.

choices=models.Importer.DOWNLOAD_POLICIES,
)
sync_mode = serializers.ChoiceField(
help_text='How the importer should sync from the upstream repository.',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I quess I lost the battle on pulp-dev for sync vs synchronize but really don't see value in using this abbreviation. Is it really that long a word to type?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sync vs synchronize is often the difference between 1 and 2 lines. Obviously, this is a minor concern, but single lines are much easier to scan visually, and I think it has a noticeable impact on readability. As it turns out, sync is actually a real word, [informal]. http://www.dictionary.com/browse/sync

validate = serializers.BooleanField(
help_text='Whether to validate imported content.',
help_text='If True, the plugin will validate imported content.',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be clear, the content is not validated, the downloaded artifacts are.

required=False,
)

ssl_ca_certificate = FileField(
help_text='A PEM encoded CA certificate used to validate the server '
'certificate presented by the external source.',
Copy link
Contributor

@jortel jortel Aug 15, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest removing: presented by the external source and say remote server instead.

last_sync = serializers.DateTimeField(
help_text='Timestamp of the most recent successful sync.',
read_only=True
)
last_updated = serializers.DateTimeField(
help_text='Timestamp of the most recent update of the importer configuration.',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The importer fields are the configuration. Suggest removing: configuration.

'ssl_client_certificate', 'ssl_client_key', 'ssl_validation', 'proxy_url',
'basic_auth_user', 'basic_auth_password', 'download_policy', 'last_sync', 'repository',
'username', 'password', 'last_sync', 'last_updated', 'repository',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Large paragraph style lists are, IMHO, less readable. consider:

...Meta.fields + (
    'name',
    'feed_url',
    ...
)

Also, easier to keep alphabetized (if so inclined).

Sorry, in the mood to be pedantic.

@jortel jortel added the 3.0 label Aug 16, 2017
@jortel
Copy link
Contributor

jortel commented Aug 22, 2017

@asmacdo: These changes will likely break the FileImporter. Please ensure a file plugin PR can be merged at the same time.

@asmacdo asmacdo force-pushed the align-importer branch 4 times, most recently from 8b3fa0e to 1dac3c3 Compare September 14, 2017 21:27
@@ -97,23 +97,24 @@ class Importer(ContentAdaptor):
Fields:

feed_url (models.TextField): The URL of an external content source.
validate (models.BooleanField): Validate the imported context.
validate (models.BooleanField): If True, the plugin will validate imported files.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/imported/downloaded/ might be clearer.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this also used for uploads?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dunno

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dkliban, I am going to leave this for today and merge. If uploads don't use this field, maybe we should specify that it is only for downloads.


download_policy = models.TextField(choices=DOWNLOAD_POLICIES)
last_sync = models.DateTimeField(blank=True, null=True)
sync_mode = models.TextField(choices=SYNC_MODES)
last_synced = models.DateTimeField(blank=True, null=True)
Copy link
Contributor

@jortel jortel Sep 14, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the task is not updating last_synced. I'll write an issue.

validate = serializers.BooleanField(
help_text='Whether to validate imported content.',
help_text='If True, the plugin will validate imported artifacts.',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/imported/downloaded/

Copy link
Contributor

@jortel jortel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a few more minor suggestions.

@asmacdo asmacdo merged commit af0cc71 into pulp:3.0-dev Sep 15, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants