Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-11059

Improve cache already exists HTTP code

This issue belongs to an archived project. You can view it, but you can't modify it. Learn more

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Obsolete
    • Icon: Major Major
    • None
    • 10.1.0.Final
    • None
    • None

      Creating a cache that already exists currently returns 400 Bad Request:

      curl -v -d '<infinispan><cache-container><distributed-cache name="example" mode="SYNC"><backups><backup site="SiteB" strategy="ASYNC" timeout="30000"/></backups></distributed-cache></cache-container></infinispan>' -H "Content-Type: application/xml" -u developer:$(kubectl get secret example-infinispan-generated-secret -o jsonpath="{.data.identities\.yaml}" | base64 -D | yq -r .credentials[0].password) -X POST $(minikube service example-infinispan-external --url --namespace local-operators)/rest/v2/caches/example
      Note: Unnecessary use of -X or --request, POST is already inferred.
      *   Trying 192.168.99.101...
      * TCP_NODELAY set
      * Connected to 192.168.99.101 (192.168.99.101) port 30222 (#0)
      * Server auth using Basic with user 'developer'
      > POST /rest/v2/caches/example HTTP/1.1
      > Host: 192.168.99.101:30222
      > Authorization: Basic ZGV2ZWxvcGVyOlFXUWE4U3V0c0QzZW9SUmg=
      > User-Agent: curl/7.64.1
      > Accept: */*
      > Content-Type: application/xml
      > Content-Length: 200
      >
      * upload completely sent off: 200 out of 200 bytes
      < HTTP/1.1 400 Bad Request
      < content-length: 40
      <
      * Connection #0 to host 192.168.99.101 left intact
      ISPN000507: Cache example already exists* Closing connection 0
      

      More fine-grained behaviour would be desirable: if the cache being created is exactly the same configuration wise, it should return 200. Otherwise, if different it should be 409.

              ttarrant@redhat.com Tristan Tarrant
              rh-ee-galder Galder ZamarreƱo
              Archiver:
              rhn-support-adongare Amol Dongare

                Created:
                Updated:
                Resolved:
                Archived: