Issue #1237
closedPuppet Install Distributor does not raise exception when non-optional install_path is missing
Description
I was able to create a distributor without the required field 'distributor_config'. The documentation says it's required because it's not optional. I expect it is required because when you publish a distributor whose config is None you'll probably get an exception, so by not requiring it the user can get into a bad state.
To reproduce I did the following:
1. Create a repo named zoo-puppet
2. use httpie to create the distributor without its config by running the following:
http --json --verify no --auth admin:admin POST https://localhost/pulp/api/v2/repositories/zoo-puppet/distributors/ distributor_type_id=puppet_install_distributor
3. Now observe its output:
HTTP/1.1 201 CREATED
Connection: Keep-Alive
Content-Length: 405
Content-Type: application/json; charset=utf-8
Date: Fri, 04 Sep 2015 19:30:39 GMT
Keep-Alive: timeout=5, max=100
Location: https://localhost/pulp/api/v2/repositories/zoo-puppet/distributors/27484a4e-afd7-4cbd-ace0-fa18979ab406/
Server: Apache/2.4.16 (Fedora) OpenSSL/1.0.1k-fips PHP/5.6.12 mod_wsgi/4.4.8 Python/2.7.10
{
"_href": "/pulp/api/v2/repositories/zoo-puppet/distributors/27484a4e-afd7-4cbd-ace0-fa18979ab406/",
"_id": {
"$oid": "55e9f160549034239f55e877"
},
"_ns": "repo_distributors",
"auto_publish": false,
"config": null,
"distributor_type_id": "puppet_install_distributor",
"id": "27484a4e-afd7-4cbd-ace0-fa18979ab406",
"last_publish": null,
"repo_id": "zoo-puppet",
"scheduled_publishes": [],
"scratchpad": null
}
4. Notice the "config: null" part which will likely cause problems at publish time.
I expected a 400 response, but instead I received a 201.
Updated by mhrivnak over 7 years ago
- Triaged changed from No to Yes
- Tags Easy Fix added
Updated by mansari almost 6 years ago
- Status changed from NEW to POST
- Assignee set to mansari
https://github.com/pulp/pulp_puppet/pull/262
Issue with install_distributor
Updated by bizhang almost 6 years ago
- Project changed from Pulp to Puppet Support
- Subject changed from Distributor field 'distributor_config' shown as non-optional but no exception is raised if it is missing to Puppet Install Distributor does not raise exception when non-optional install_path is missing
The ostree distributor defaults to a relative path that does not reply on being provided anything by a distributor [5]
And python does not appear to rely on any distributor config either. [6]
Other distributors validate some field in the configuration [0][1][2][3][4]
So it appears that the only issue is with the puppet install distributor
[0] https://github.com/pulp/pulp_puppet/blob/master/pulp_puppet_plugins/pulp_puppet/plugins/distributors/filedistributor.py#L57
[1] https://github.com/pulp/pulp_puppet/blob/master/pulp_puppet_plugins/pulp_puppet/plugins/distributors/configuration.py#L18
[2] https://github.com/pulp/pulp_rpm/blob/master/plugins/pulp_rpm/plugins/distributors/export_distributor/export_utils.py#L48
[3] https://github.com/pulp/pulp_docker/blob/master/plugins/pulp_docker/plugins/distributors/configuration.py#L50
[4] https://github.com/pulp/pulp/blob/master/server/pulp/plugins/rsync/configuration.py#L137
[5] https://github.com/pulp/pulp_ostree/blob/master/plugins/pulp_ostree/plugins/distributors/configuration.py#L11
[6] https://github.com/pulp/pulp_python/blob/master/plugins/pulp_python/plugins/distributors/configuration.py#L6
Added by mansari almost 6 years ago
Updated by mansari almost 6 years ago
- Status changed from POST to MODIFIED
Applied in changeset 34e1d5bde05767902930fa71036f515297d51e4c.
Added by mansari almost 6 years ago
Update Puppet module install_distributor
Config validation was returning True instead of False when a distributor_config was not specified while associating a distributor to a repository.
Updated by mansari almost 6 years ago
Applied in changeset 0016a35580fb6cfbf3e4e9f668d55dbcf1c9f08f.
Updated by pcreech almost 6 years ago
- Status changed from 5 to CLOSED - CURRENTRELEASE
Update Puppet module install_distributor
Config validation was returning True instead of False when a distributor_config was not specified while associating a distributor to a repository.
closes #1237 https://pulp.plan.io/issues/1237