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

last_operation returns 500 due to invalid URL #707

Closed
mhrivnak opened this issue Jan 29, 2018 · 1 comment
Closed

last_operation returns 500 due to invalid URL #707

mhrivnak opened this issue Jan 29, 2018 · 1 comment
Assignees
Labels
3.9 | release-1.1 Kubernetes 1.9 | Openshift 3.9 | Broker release-1.1 3.10 | release-1.2 Kubernetes 1.10 | Openshift 3.10 | Broker release-1.2

Comments

@mhrivnak
Copy link
Member

What happened:
While trying to test the last_operation binding endpoint, I messed up the URL and ended up making this request, as seen in the broker log:

GET /ansible-service-broker/v2/service_instances/5a08a0d0-2036-4a58-aa20-9bf9413b4fb0/service_bindings/70d7f74d-99cb-482c-94ea-796aefbaf25b/last_operation?operation=\"5f99ca72-8ce8-43f7-bd12-ed7491211cb6\"

This resulted in a 500 error from the broker. Here is more log output:

[2018-01-29T19:34:39.343Z] [ERROR] - problem reading job state: [5a08a0d0-2036-4a58-aa20-9bf9413b4fb0]. error: [100: Key not found (/state/5a08a0d0-2036-4a58-aa20-9bf9413b4fb0/job/"5f99ca72-8ce8-43f7-bd12-ed7491211cb6") [26]]
[2018-01-29T19:34:39.343Z] [DEBUG] - state: failed
172.17.0.1 - - [29/Jan/2018:19:34:39 +0000] "GET /ansible-service-broker/v2/service_instances/5a08a0d0-2036-4a58-aa20-9bf9413b4fb0/service_bindings/70d7f74d-99cb-482c-94ea-796aefbaf25b/last_operation?operation=\"5f99ca72-8ce8-43f7-bd12-ed7491211cb6\" HTTP/1.1" 500 138

And an example of a response:

HTTP/1.1 500 Internal Server Error
Content-Type: application/json
Date: Mon, 29 Jan 2018 19:50:58 GMT
Content-Length: 105
Set-Cookie: d05351dd24520dce41f310fcfc112523=cf44571ff518c281d2b9338b30a5e779; path=/; HttpOnly; Secure

{
  "description": "100: Key not found (/state/5a08a0d0-2036-4a58-aa20-9bf9413b4fb0/job/\"foo\") [66]"
}

What you expected to happen
A 404 Not Found response would be appropriate.

How to reproduce it:
It only reproduces while there is a valid job running for the given service and binding. The broker must be configured to launch APBs on bind and auto-escalate. I saw this with the release-1.1 branch.

This script will reproduce it if you supply a service ID as the only argument:

#!/usr/bin/env bash

INSTANCE_ID=$1
BINDING_ID=$(uuidgen)
PLAN_UUID="7f4a5e35e4af2beb70076e72fab0b7ff"
SERVICE_UUID="dh-postgresql-apb-s964m"
OPERATION=\"foo\"

req="{
  \"plan_id\": \"$PLAN_UUID\",
  \"service_id\": \"$SERVICE_UUID\",
  \"context\": \"blog-project\",
  \"app_guid\":\"\",
  \"bind_resource\":{},
  \"parameters\": {}
}"

curl \
    -k \
    -i \
    -X PUT \
    -H "Authorization: bearer $(oc whoami -t)" \
    -H "Content-type: application/json" \
    -H "Accept: application/json" \
    -H "X-Broker-API-Originating-Identity: " \
    -d "$req" \
    "https://asb-1338-ansible-service-broker.172.17.0.1.nip.io/ansible-service-broker/v2/service_instances/$INSTANCE_ID/service_bindings/$BINDING_ID?accepts_incomplete=true"

curl \
    -k \
    -i \
    -s \
    -X GET \
    -H "Authorization: bearer $(oc whoami -t)" \
    -H "Content-type: application/json" \
    -H "Accept: application/json" \
    -H "X-Broker-API-Originating-Identity: " \
    "https://asb-1338-ansible-service-broker.172.17.0.1.nip.io/ansible-service-broker/v2/service_instances/$INSTANCE_ID/service_bindings/$BINDING_ID/last_operation?operation=$OPERATION"
@rthallisey rthallisey added bug 3.9 | release-1.1 Kubernetes 1.9 | Openshift 3.9 | Broker release-1.1 3.10 | release-1.2 Kubernetes 1.10 | Openshift 3.10 | Broker release-1.2 labels Jan 29, 2018
@shawn-hurley shawn-hurley self-assigned this Mar 9, 2018
@jmrodri
Copy link
Contributor

jmrodri commented May 17, 2018

Fixed by PR #746

@jmrodri jmrodri closed this as completed May 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.9 | release-1.1 Kubernetes 1.9 | Openshift 3.9 | Broker release-1.1 3.10 | release-1.2 Kubernetes 1.10 | Openshift 3.10 | Broker release-1.2
Projects
None yet
Development

No branches or pull requests

4 participants