-
Notifications
You must be signed in to change notification settings - Fork 168
Align importer models and serializers with MVP #3117
Conversation
(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.')) |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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.')) |
There was a problem hiding this comment.
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.', |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.', |
There was a problem hiding this comment.
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.', |
There was a problem hiding this comment.
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.', |
There was a problem hiding this comment.
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', |
There was a problem hiding this comment.
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.
@asmacdo: These changes will likely break the FileImporter. Please ensure a file plugin PR can be merged at the same time. |
8b3fa0e
to
1dac3c3
Compare
@@ -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. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dunno
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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.', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/imported/downloaded/
There was a problem hiding this 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.
1dac3c3
to
9ad9669
Compare
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.