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

Updater: mirrors configuration tweaks #1079

Closed
jku opened this issue Jul 16, 2020 · 3 comments · Fixed by #1153
Closed

Updater: mirrors configuration tweaks #1079

jku opened this issue Jul 16, 2020 · 3 comments · Fixed by #1153

Comments

@jku
Copy link
Member

jku commented Jul 16, 2020

For the Warehouse/pip use case we are not so much interested multiple actual mirrors but separating the target and metadata hosting to two hosts.

Current Updater mirror configuration is close but not quite up to the task:

mirrors = {
    'mirror1': {
        'url_prefix': 'https://hostname/basedir/',
        'metadata_path': 'metadata',
        'targets_path': 'targets',
        'confined_target_dirs': ['']
    },
}

I would like to have a way of signaling that a particular mirror should not be used for metadata or should not be used for targets ('confined_target_dirs': [] does offer that, but only for targets). There's multiple ways to solve this: I'm open to suggestions.

The mirrors role (which is unrelated to this but deals with the same problem) solves the issue by having PATH_PATTERNS for both metadata and targets, but for this specific use case it would be enough if metadata_path and targets_path could be set to None. Then I could do this in pip:

mirrors = {
    'metadata': {
        'url_prefix': 'https://pypi.org/',
        'metadata_path': 'tuf',
        'targets_path': None,
        'confined_target_dirs': []
    },
    'targets': {
        'url_prefix': 'https://files.pythonhosted.org/',
        'metadata_path': None,
        'targets_path': 'packages',
        'confined_target_dirs': ['']
    },
}

This would probably be a trivial change in mirrors.py and should not break any existing users

@jku
Copy link
Member Author

jku commented Jul 16, 2020

maybe look at #1077 at the same time?

@joshuagl
Copy link
Member

Agreed, changing tuf.mirrors.get_list_of_mirrors to look for a dictionary field like the proposed metadata_path would be a small change and could be implemented in such a way as to not break existing users (i.e. using get() or catching a KeyError).

@jku
Copy link
Member Author

jku commented Sep 23, 2020

Actually the schema system does not make None an option very easily I guess... but the whole key could be made optional.

jku pushed a commit to jku/python-tuf that referenced this issue Sep 25, 2020
Now clients can leave out targets_path or metadata_path if the
client knows the mirror does not have that type of targets.

This is backwards compatible: old mirror configs continue to work.

Fixes theupdateframework#1079

Signed-off-by: Jussi Kukkonen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants