Project

Profile

Help

Story #3802

Updated by bmbouter about 1 year ago

h3. Problem

Users performing a sync, e.g. Katello want to provide one-time options to override a Remote's configuration for that one sync.

h3. Design

h3. Core Changes

1. Have the Remote's options be added to the <code>RepositoryURLSerializer</code> via inheritnace.
2. Override <code>RemoteViewSet.get_object()</code> in core so that anytime a plugin calls it, they will receive the remote with the options already overlaid. This will log at the debug level about options that are overlaid. It's important not to log the 'password' or 'cert_key' field values for security reasons. Also the overlay needs to work generically so when plugin writers try to overlay additional, custom Remote attributes it works.
3. Have <code>RemoteViewSet.get_object()</code> remove the in-memory Remote's <code>save()</code> method. It's unsafe for this in-memory object to be accidentally saved by a plugin writer.
4. Add docs on this feature and ensure it's clear that these settings won't be saved and applied to requests that occur later via policy='streamed' or policy='on_demand'.

h3. Plugin Changes

1. Adjust the signature of your sync task to replace <code>remote_pk</code> with <code>remote</code> and have the in-memory version passed.

Plugins can additionally have the override include custom Remote fields by subclassing <code>RepositoryURLSerializer</code> similar to how <code>RepositoryURLSerializer</code> subclassed <code>RemoteSerializer</code> in core. Additionally the plugin's view will specify their subclassed serializer. It's important the get_object() method work generically so the plugin writer does not have to take an additional step to overlay custom attributes.

Back