Project

Profile

Help

Issue #1622

closed

Pulp event notifier not setting the right content type

Added by paji@redhat.com almost 7 years ago. Updated over 3 years ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Category:
-
Sprint/Milestone:
-
Start date:
Due date:
Estimated time:
Severity:
2. Medium
Version:
Master
Platform Release:
2.8.0
OS:
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Pulp 2
Sprint:
Quarter:

Description

1) Create a post sync notifier in pulp. There may be a pulp-admin way of doing this -> but Katello does it in the following way

path = /pulp/api/v2/events/, args = post,{"notifier_type_id":"http","notifier_config":{"url":"https://<SAT FQDN>/katello/api/v2/repositories/sync_complete?token=test"},"event_types":["repo.sync.finish"]},{"content_type"=>"application/json", "accept"=>"application/json", "Authorization"=>"OAuth oauth_body_hash=\"2jmj7l5rSw0yVb%2FvlWAYkK%2FYBwk%3D\", oauth_consumer_key=\"5N52BJQuADMGfHKMhzRV8NUfKUZvePw4\", oauth_nonce=\"b5L7Mkm0QXEi4WiM2j3Sdqz4CCPsdxnYClgBJ2dxyko\", oauth_signature=\"s%2BhM%2FjS%2FBMaFuu%2FpS%2FezpubMdcs%3D\", oauth_signature_method=\"HMAC-SHA1\", oauth_timestamp=\"1454430929\", oauth_version=\"1.0\"", "pulp-user"=>"admin"}

2) Sync any repo

Katello logs noticed the following error

2016-02-02T11:05:03 [app] [D] With body: {                                                                           
 |   "error": {"message":"'Content-Type: application/x-www-form-urlencoded' is unsupported in API v2 for POST and PUT
requests. Please use 'Content-Type: application/json'."}                                                             
 | }                                                                                                                 

So the sync complete notifier didnt set the content type correctly.

Added by Jeremy Cline almost 7 years ago

Revision ccd0a77f

Ensure the HTTP event notifier sends JSON-encoded bodies.

By default requests form-encodes post requests. However, there is a json kwarg that will dump the provided dictionary to JSON and POST it with the correct content type.

Actions #1

Updated by jcline@redhat.com almost 7 years ago

  • Status changed from NEW to POST
  • Assignee set to jcline@redhat.com
  • Triaged changed from No to Yes
Actions #2

Updated by jcline@redhat.com almost 7 years ago

  • Status changed from POST to MODIFIED
Actions #3

Updated by rbarlow almost 7 years ago

  • Platform Release set to 2.8.0
Actions #4

Updated by dkliban@redhat.com almost 7 years ago

  • Status changed from MODIFIED to 5
Actions #5

Updated by dkliban@redhat.com over 6 years ago

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

Updated by bmbouter over 3 years ago

  • Tags Pulp 2 added

Also available in: Atom PDF