Issue #2964
closedToo easy for user to create empy python repo when syncing from feed
Description
When creating a python repo with a feed, it is very easy to create a repo that syncs no content.
If a user is used to the RPM plugin, they may not understand that the --package-names
parameter is required if they want any content to sync.
The user documentation mentions this in the middle of a sentence, and in the example it is shown in code block that you must scroll in order to see the parameters.
I have not found any API documentation that indicates this required field.
Even though nothing breaks without this field, since it is required for the repo to be of any use at all, I think there should be some kind of warning or more obvious statement of this when creating a python repo with a feed but no packages specified. While clearer documentation would be great, I think this is something that pulp-admin could complain about during the sync if it notices there is no content to sync.
[admin@fedora25base pulp_smash]$ pulp-admin python repo create --repo-id pypi --feed https://pypi.python.org/ --package-names hamster-lib
Repository [pypi] successfully created
[admin@fedora25base pulp_smash]$ pulp-admin python repo create --repo-id pypi2 --feed https://pypi.python.org/
Repository [pypi2] successfully created
[admin@fedora25base pulp_smash]$ pulp-admin python repo sync run --repo-id pypi
+----------------------------------------------------------------------+
Synchronizing Repository [pypi]
+----------------------------------------------------------------------+
This command may be exited via ctrl+c without affecting the request.
Downloading Python metadata.
[\]
... completed
Copying units already in pulp
[-]
... completed
Downloading and processing Python packages.
[\]
... completed
Task Succeeded
Publishing Python Metadata.
[-]
... completed
Publishing Python Content.
[-]
... completed
Making files available via web.
[-]
... completed
Task Succeeded
[admin@fedora25base pulp_smash]$ pulp-admin python repo sync run --repo-id pypi2
+----------------------------------------------------------------------+
Synchronizing Repository [pypi2]
+----------------------------------------------------------------------+
This command may be exited via ctrl+c without affecting the request.
Downloading Python metadata.
[\]
... completed
Copying units already in pulp
[-]
... completed
Downloading and processing Python packages.
[\]
... completed
Task Succeeded
Publishing Python Metadata.
[-]
... completed
Publishing Python Content.
[-]
... completed
Making files available via web.
[-]
... completed
Task Succeeded
[admin@fedora25base pulp_smash]$ pulp-admin python repo list
+----------------------------------------------------------------------+
Python Repositories
+----------------------------------------------------------------------+
Id: pypi
Display Name: None
Description: None
Content Unit Counts:
Python Package: 12
Id: pypi2
Display Name: None
Description: None
Content Unit Counts:
Here is an example of the raw HTTP POST that will create a repo with needed "package_names" parameter filled out:
POST request to /pulp/api/v2/repositories/ with parameters
{
"display_name": null,
"description": null,
"distributors": [
{"distributor_id": "cli_python_distributor",
"auto_publish": true,
"distributor_config": {},
"distributor_type_id": "python_distributor"
}
],
"notes": {"_repo-type": "PYTHON"},
"importer_type_id": "python_importer",
"importer_config": {
"feed": "https://repos.fedorapeople.org/pulp/pulp/fixtures/python-pypi/", "package_names": 'shelf-reader',
"proxy_host": null,
"proxy_password": null,
"proxy_port": null,
"proxy_username": null,
"validate": null},
"id": "pypi"
}
Here is what I have installed on the machine I recreated this with, though I believe it has always been this way.
rpm -qa | grep pulp
python-pulp-bindings-2.14.0-0.1.beta.fc25.noarch
pulp-deb-plugins-1.5.2-0.1.beta.fc25.noarch
python-pulp-docker-common-3.0.0-0.1.beta.fc25.noarch
pulp-puppet-admin-extensions-2.14.0-0.1.beta.fc25.noarch
python-pulp-rpm-common-2.14.0-0.1.beta.fc25.noarch
pulp-docker-admin-extensions-3.0.0-0.1.beta.fc25.noarch
python-pulp-python-common-2.0.1-0.1.beta.fc25.noarch
pulp-python-plugins-2.0.1-0.1.beta.fc25.noarch
python-pulp-repoauth-2.14.0-0.1.beta.fc25.noarch
pulp-rpm-plugins-2.14.0-0.1.beta.fc25.noarch
pulp-admin-client-2.14.0-0.1.beta.fc25.noarch
pulp-deb-admin-extensions-1.5.2-0.1.beta.fc25.noarch
python-pulp-oid_validation-2.14.0-0.1.beta.fc25.noarch
pulp-puppet-plugins-2.14.0-0.1.beta.fc25.noarch
pulp-rpm-admin-extensions-2.14.0-0.1.beta.fc25.noarch
pulp-ostree-plugins-1.3.0-0.1.beta.fc25.noarch
pulp-selinux-2.14.0-0.1.beta.fc25.noarch
python-pulp-client-lib-2.14.0-0.1.beta.fc25.noarch
python-pulp-streamer-2.14.0-0.1.beta.fc25.noarch
python-pulp-deb-common-1.5.2-0.1.beta.fc25.noarch
python-pulp-common-2.14.0-0.1.beta.fc25.noarch
pulp-server-2.14.0-0.1.beta.fc25.noarch
python-pulp-puppet-common-2.14.0-0.1.beta.fc25.noarch
python-pulp-ostree-common-1.3.0-0.1.beta.fc25.noarch
pulp-python-admin-extensions-2.0.1-0.1.beta.fc25.noarch
pulp-docker-plugins-3.0.0-0.1.beta.fc25.noarch
pulp-ostree-admin-extensions-1.3.0-0.1.beta.fc25.noarch
Sync succeeds even when feed or package-names is not specified
An appropriate error message will now be displayed when a user tries to sync a python repo that is missing feed or package-names
closes #2964