Project

Profile

Help

Issue #2071

closed

Creating yum distributor without https, http keys in config crashes

Added by rmcgover almost 8 years ago. Updated almost 4 years ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Assignee:
Sprint/Milestone:
-
Start date:
Due date:
Estimated time:
Severity:
1. Low
Version:
Master
Platform Release:
2.11.0
OS:
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Easy Fix, Pulp 2
Sprint:
Quarter:

Description

If I try to create a repository with yum distributor like this:

curl -k -u admin:admin -d '{"importer_type_id": "yum_importer", "importer_config": {}, "id": "my-test-repo", "distributors": [{"distributor_id": "yum_distributor", "distributor_type_id": "yum_distributor", "distributor_config": {"checksum_type": "sha1", "relative_rpm_path": "Packages", "relative_url": "content/my-test-repo"}, "auto_publish": false}]}' -v https://172.17.0.5:443/pulp/api/v2/repositories/

Pulp will respond with a 500 Internal Server Error with backtrace like this:

pulp.server.webservices.middleware.exception:ERROR: (903-15616)   File "/home/vagrant/devel/pulp/server/pulp/server/controllers/repository.py", line 425, in create_repo
pulp.server.webservices.middleware.exception:ERROR: (903-15616)     dist_controller.add_distributor(repo_id, type_id, plugin_config, auto_publish, dist_id)
pulp.server.webservices.middleware.exception:ERROR: (903-15616)   File "/home/vagrant/devel/pulp/server/pulp/server/controllers/distributor.py", line 67, in add_distributor
pulp.server.webservices.middleware.exception:ERROR: (903-15616)     result = distributor_instance.validate_config(transfer_repo, call_config, config_conduit)
pulp.server.webservices.middleware.exception:ERROR: (903-15616)   File "/home/vagrant/devel/pulp_rpm/plugins/pulp_rpm/plugins/distributors/yum/distributor.py", line 85, in validate_config
pulp.server.webservices.middleware.exception:ERROR: (903-15616)     return configuration.validate_config(repo, config, config_conduit)
pulp.server.webservices.middleware.exception:ERROR: (903-15616)   File "/home/vagrant/devel/pulp_rpm/plugins/pulp_rpm/plugins/distributors/yum/configuration.py", line 92, in validate_config
pulp.server.webservices.middleware.exception:ERROR: (903-15616)     if config['https'] is False and config['http'] is False:
pulp.server.webservices.middleware.exception:ERROR: (903-15616) KeyError: 'https'

I think there are two problems here:

1. If http, https are meant to be mandatory config keys in the request, then the server should provide a meaningful error message when they're not provided, rather than giving a 500 response.

2. It seems like these weren't mandatory in the request prior to commit 23d9c0934bac so this was probably an unintentional API break. We have scripts against our pulp server which expect to be able to create yum repos without providing http, https in the config (and we use yum_distributor.json on the server to control the config of these keys).

Tested with pulp f903da544d6713d782cd8d5de94ae4af5a2cba4b, pulp_rpm 7f43d66a0bd082aa43878c1e655a94cca18ff5fd.

Actions #1

Updated by amacdona@redhat.com almost 8 years ago

  • Severity changed from 2. Medium to 1. Low
  • Triaged changed from No to Yes
  • Tags Easy Fix added

When fixing, please determine whether these keys are mandatory and should be raising a 400 or if that call should work.

Added by bizhang over 7 years ago

Revision ee8eb10d | View on GitHub

default http and https config setting to False if not provided

closes #2071 https://pulp.plan.io/issues/2071

Actions #2

Updated by bizhang over 7 years ago

  • Status changed from NEW to POST
  • Assignee set to bizhang
Actions #3

Updated by bizhang over 7 years ago

  • Status changed from POST to MODIFIED
  • % Done changed from 0 to 100
Actions #4

Updated by semyers over 7 years ago

  • Platform Release set to 2.11.0
Actions #5

Updated by semyers over 7 years ago

  • Status changed from MODIFIED to 5
Actions #6

Updated by pthomas@redhat.com over 7 years ago

  • Status changed from 5 to 6
{"http_request_method": "POST", "exception": null, "error_message": "Configuration key [http] is required, but was not provided\nConfiguration key [https] is required, but was not provided\nConfiguration key [relative_rpm_path] is not supported\nSettings serve via http and https are both set to false. At least one option should be set to true.", "_href": "/pulp/api/v2/repositories/", "http_status": 400, "error": {"code": "PLP0000", "data": {}, "description": "Configuration key [http] is required, but was not provided\nConfiguration key [https] is required, but was not provided\nConfiguration key [relative_rpm_path] is not supported\nSettings serve via http and https are both set to false. At least one option should be set to true.", "sub_errors": []}, "args": ["Configuration key [http] is required, but was not provided\nConfiguration key [https] is required, but was not provided\nConfiguration key [relative_rpm_path] is not supported\nSettings serve via http and https are both set to false. At least one optio* Closing connection 0
n should be set to true."], "traceback": null}
Actions #7

Updated by pcreech over 7 years ago

  • Status changed from 6 to CLOSED - CURRENTRELEASE
Actions #9

Updated by bmbouter about 5 years ago

  • Tags Pulp 2 added

Also available in: Atom PDF