cli icon indicating copy to clipboard operation
cli copied to clipboard

Cannot update a service_instance's plan that was made private after it was provisioned

Open markstgodard opened this issue 10 years ago • 12 comments

Given a service which supports "plan_updateable", User cannot update a service instance's plan if a service plan is made private after a service instance provisioned.

NOTE: @dkoper I can create a PR as well

(see related CC item: https://github.com/cloudfoundry/cloud_controller_ng/issues/561)

For example: (using bosh-lite)

Service has two plans, and another plan "fake-plan" which I made private (so does not show up here)

mark at evilcorp ~ $ cf m
Getting services from marketplace in org o / space s as mark...
OK

service                                             plans                                   description
fake-service-6dde3dd0-c875-4818-94fb-6b8d521bfa1a   fake-async-plan, fake-async-only-plan   fake service

TIP:  Use 'cf marketplace -s SERVICE' to view descriptions of individual plans of a given service.

I have a service instance, which was provisioned BEFORE fake-plan was set to private.

mark at evilcorp ~ $ cf s
Getting services in org o / space s as mark...
OK

name                  service                                             plan        bound apps   last operation
myservice             fake-service-6dde3dd0-c875-4818-94fb-6b8d521bfa1a   fake-plan                create succeeded

However when a service instance is updated to another plan (which is valid) it gets an error.

Command

$ cf update-service myservice -p fake-async-plan
FAILED
Plan does not exist for the  service

CLI Version

6.15.0+1076af9-2016-02-11

Error

FAILED Plan does not exist for the service

The reason it is getting this error is likely due to: inline-relations-depth=1

GET /v2/spaces/1187a7d0-ba38-431c-a01a-0b657f741b7c/service_instances?return_user_provided_service_instances=true&q=name%3Amyservice&inline-relations-depth=1 HTTP/1.1

IMPORTANT NOTE: Simon and myself was looking at this, and Simon also created a CAPI GH Issue as well, because there is likely related discussion / potential changes to be made on the CC side..

CF Trace

mark at evilcorp ~ $ CF_TRACE=true cf update-service myservice -p fake-async-plan

REQUEST: [2016-03-10T09:23:35-06:00]
GET /v2/spaces/1187a7d0-ba38-431c-a01a-0b657f741b7c/service_instances?return_user_provided_service_instances=true&q=name%3Amyservice&inline-relations-depth=1 HTTP/1.1
Host: api.bosh-lite.com
Accept: application/json
Authorization: [PRIVATE DATA HIDDEN]
Content-Type: application/json
User-Agent: go-cli 6.15.0+1076af9 / darwin



RESPONSE: [2016-03-10T09:23:36-06:00]
HTTP/1.1 200 OK
Content-Length: 2851
Content-Type: application/json;charset=utf-8
Date: Thu, 10 Mar 2016 15:23:36 GMT
Server: nginx
X-Content-Type-Options: nosniff
X-Vcap-Request-Id: e0aa539b-d4e7-4201-6f68-fd5218a11bf9
X-Vcap-Request-Id: 46fc39b7-6084-4782-6491-aa586e8e9df5::4fbe86d7-f4d0-4bcc-a816-0dbaeb8c48e3

{
  "total_results": 1,
  "total_pages": 1,
  "prev_url": null,
  "next_url": null,
  "resources": [
    {
      "metadata": {
        "guid": "0e404e2a-c00e-484c-802d-ff50813e2b29",
        "url": "/v2/service_instances/0e404e2a-c00e-484c-802d-ff50813e2b29",
        "created_at": "2016-03-10T15:18:59Z",
        "updated_at": null
      },
      "entity": {
        "name": "myservice",
        "credentials": {

        },
        "service_plan_guid": null,
        "space_guid": "1187a7d0-ba38-431c-a01a-0b657f741b7c",
        "gateway_data": null,
        "dashboard_url": null,
        "type": "managed_service_instance",
        "last_operation": {
          "type": "create",
          "state": "succeeded",
          "description": "",
          "updated_at": null,
          "created_at": "2016-03-10T15:18:59Z"
        },
        "tags": [

        ],
        "space_url": "/v2/spaces/1187a7d0-ba38-431c-a01a-0b657f741b7c",
        "space": {
          "metadata": {
            "guid": "1187a7d0-ba38-431c-a01a-0b657f741b7c",
            "url": "/v2/spaces/1187a7d0-ba38-431c-a01a-0b657f741b7c",
            "created_at": "2016-02-24T21:47:50Z",
            "updated_at": null
          },
          "entity": {
            "name": "s",
            "organization_guid": "12d1a30b-4623-46ee-bebd-38e90f9c6f26",
            "space_quota_definition_guid": null,
            "allow_ssh": true,
            "organization_url": "/v2/organizations/12d1a30b-4623-46ee-bebd-38e90f9c6f26",
            "developers_url": "/v2/spaces/1187a7d0-ba38-431c-a01a-0b657f741b7c/developers",
            "managers_url": "/v2/spaces/1187a7d0-ba38-431c-a01a-0b657f741b7c/managers",
            "auditors_url": "/v2/spaces/1187a7d0-ba38-431c-a01a-0b657f741b7c/auditors",
            "apps_url": "/v2/spaces/1187a7d0-ba38-431c-a01a-0b657f741b7c/apps",
            "routes_url": "/v2/spaces/1187a7d0-ba38-431c-a01a-0b657f741b7c/routes",
            "domains_url": "/v2/spaces/1187a7d0-ba38-431c-a01a-0b657f741b7c/domains",
            "service_instances_url": "/v2/spaces/1187a7d0-ba38-431c-a01a-0b657f741b7c/service_instances",
            "app_events_url": "/v2/spaces/1187a7d0-ba38-431c-a01a-0b657f741b7c/app_events",
            "events_url": "/v2/spaces/1187a7d0-ba38-431c-a01a-0b657f741b7c/events",
            "security_groups_url": "/v2/spaces/1187a7d0-ba38-431c-a01a-0b657f741b7c/security_groups"
          }
        },
        "service_bindings_url": "/v2/service_instances/0e404e2a-c00e-484c-802d-ff50813e2b29/service_bindings",
        "service_bindings": [

        ],
        "service_keys_url": "/v2/service_instances/0e404e2a-c00e-484c-802d-ff50813e2b29/service_keys",
        "service_keys": [

        ],
        "routes_url": "/v2/service_instances/0e404e2a-c00e-484c-802d-ff50813e2b29/routes",
        "routes": [

        ]
      }
    }
  ]
}

REQUEST: [2016-03-10T09:23:36-06:00]
GET /v2/service_plans?q=service_guid%3A HTTP/1.1
Host: api.bosh-lite.com
Accept: application/json
Authorization: [PRIVATE DATA HIDDEN]
Content-Type: application/json
User-Agent: go-cli 6.15.0+1076af9 / darwin



RESPONSE: [2016-03-10T09:23:36-06:00]
HTTP/1.1 200 OK
Content-Length: 107
Content-Type: application/json;charset=utf-8
Date: Thu, 10 Mar 2016 15:23:36 GMT
Server: nginx
X-Content-Type-Options: nosniff
X-Vcap-Request-Id: eceb2426-7f1e-4bfe-5a75-251435a9f5a0
X-Vcap-Request-Id: c9f76582-2752-4599-6d99-933f8bfbc0c2::4d158550-68e9-4af0-aa56-577756d7c656

{
  "total_results": 0,
  "total_pages": 1,
  "prev_url": null,
  "next_url": null,
  "resources": [

  ]
}

REQUEST: [2016-03-10T09:23:36-06:00]
GET /v2/organizations?q=name%3Ao&inline-relations-depth=1 HTTP/1.1
Host: api.bosh-lite.com
Accept: application/json
Authorization: [PRIVATE DATA HIDDEN]
Content-Type: application/json
User-Agent: go-cli 6.15.0+1076af9 / darwin



RESPONSE: [2016-03-10T09:23:36-06:00]
HTTP/1.1 200 OK
Content-Length: 15411
Content-Type: application/json;charset=utf-8
Date: Thu, 10 Mar 2016 15:23:36 GMT
Server: nginx
X-Content-Type-Options: nosniff
X-Vcap-Request-Id: 95f6aa66-0063-400e-7897-dba259ca75d8
X-Vcap-Request-Id: 32802049-5dce-4a16-4e14-1c4fd6fdad1f::7cd38145-7324-42c0-8c60-9ad92992e6b8

{
  "total_results": 1,
  "total_pages": 1,
  "prev_url": null,
  "next_url": null,
  "resources": [
    {
      "metadata": {
        "guid": "12d1a30b-4623-46ee-bebd-38e90f9c6f26",
        "url": "/v2/organizations/12d1a30b-4623-46ee-bebd-38e90f9c6f26",
        "created_at": "2016-02-24T21:47:42Z",
        "updated_at": null
      },
      "entity": {
        "name": "o",
        "billing_enabled": false,
        "quota_definition_guid": "bbda921a-7bd5-42ac-8be4-73324e5ff497",
        "status": "active",
        "quota_definition_url": "/v2/quota_definitions/bbda921a-7bd5-42ac-8be4-73324e5ff497",
        "quota_definition": {
          "metadata": {
            "guid": "bbda921a-7bd5-42ac-8be4-73324e5ff497",
            "url": "/v2/quota_definitions/bbda921a-7bd5-42ac-8be4-73324e5ff497",
            "created_at": "2016-02-24T21:28:58Z",
            "updated_at": null
          },
          "entity": {
            "name": "default",
            "non_basic_services_allowed": true,
            "total_services": 100,
            "total_routes": 1000,
            "total_private_domains": -1,
            "memory_limit": 10240,
            "trial_db_allowed": false,
            "instance_memory_limit": -1,
            "app_instance_limit": -1,
            "app_task_limit": -1,
            "total_service_keys": -1
          }
        },
        "spaces_url": "/v2/organizations/12d1a30b-4623-46ee-bebd-38e90f9c6f26/spaces",
        "spaces": [
          {
            "metadata": {
              "guid": "1187a7d0-ba38-431c-a01a-0b657f741b7c",
              "url": "/v2/spaces/1187a7d0-ba38-431c-a01a-0b657f741b7c",
              "created_at": "2016-02-24T21:47:50Z",
              "updated_at": null
            },
            "entity": {
              "name": "s",
              "organization_guid": "12d1a30b-4623-46ee-bebd-38e90f9c6f26",
              "space_quota_definition_guid": null,
              "allow_ssh": true,
              "organization_url": "/v2/organizations/12d1a30b-4623-46ee-bebd-38e90f9c6f26",
              "developers_url": "/v2/spaces/1187a7d0-ba38-431c-a01a-0b657f741b7c/developers",
              "managers_url": "/v2/spaces/1187a7d0-ba38-431c-a01a-0b657f741b7c/managers",
              "auditors_url": "/v2/spaces/1187a7d0-ba38-431c-a01a-0b657f741b7c/auditors",
              "apps_url": "/v2/spaces/1187a7d0-ba38-431c-a01a-0b657f741b7c/apps",
              "routes_url": "/v2/spaces/1187a7d0-ba38-431c-a01a-0b657f741b7c/routes",
              "domains_url": "/v2/spaces/1187a7d0-ba38-431c-a01a-0b657f741b7c/domains",
              "service_instances_url": "/v2/spaces/1187a7d0-ba38-431c-a01a-0b657f741b7c/service_instances",
              "app_events_url": "/v2/spaces/1187a7d0-ba38-431c-a01a-0b657f741b7c/app_events",
              "events_url": "/v2/spaces/1187a7d0-ba38-431c-a01a-0b657f741b7c/events",
              "security_groups_url": "/v2/spaces/1187a7d0-ba38-431c-a01a-0b657f741b7c/security_groups"
            }
          }
        ],
        "domains_url": "/v2/organizations/12d1a30b-4623-46ee-bebd-38e90f9c6f26/domains",
        "domains": [
          {
            "metadata": {
              "guid": "c109d178-7225-4b0b-8b1e-420c72bfd873",
              "url": "/v2/domains/c109d178-7225-4b0b-8b1e-420c72bfd873",
              "created_at": "2016-03-03T22:35:09Z",
              "updated_at": null
            },
            "entity": {
              "name": "something.com",
              "router_group_guid": null
            }
          },
          {
            "metadata": {
              "guid": "cf056330-9495-4c3c-947f-ecd2e5eb9445",
              "url": "/v2/domains/cf056330-9495-4c3c-947f-ecd2e5eb9445",
              "created_at": "2016-02-24T21:28:58Z",
              "updated_at": "2016-03-07T14:42:38Z"
            },
            "entity": {
              "name": "bosh-lite.com",
              "router_group_guid": null
            }
          }
        ],
        "private_domains_url": "/v2/organizations/12d1a30b-4623-46ee-bebd-38e90f9c6f26/private_domains",
        "private_domains": [

        ],
        "users_url": "/v2/organizations/12d1a30b-4623-46ee-bebd-38e90f9c6f26/users",
        "users": [
          {
            "metadata": {
              "guid": "088e14a7-8309-4348-b81a-9e8542cfe55e",
              "url": "/v2/users/088e14a7-8309-4348-b81a-9e8542cfe55e",
              "created_at": "2016-02-24T21:47:35Z",
              "updated_at": null
            },
            "entity": {
              "admin": false,
              "active": true,
              "default_space_guid": null,
              "spaces_url": "/v2/users/088e14a7-8309-4348-b81a-9e8542cfe55e/spaces",
              "organizations_url": "/v2/users/088e14a7-8309-4348-b81a-9e8542cfe55e/organizations",
              "managed_organizations_url": "/v2/users/088e14a7-8309-4348-b81a-9e8542cfe55e/managed_organizations",
              "billing_managed_organizations_url": "/v2/users/088e14a7-8309-4348-b81a-9e8542cfe55e/billing_managed_organizations",
              "audited_organizations_url": "/v2/users/088e14a7-8309-4348-b81a-9e8542cfe55e/audited_organizations",
              "managed_spaces_url": "/v2/users/088e14a7-8309-4348-b81a-9e8542cfe55e/managed_spaces",
              "audited_spaces_url": "/v2/users/088e14a7-8309-4348-b81a-9e8542cfe55e/audited_spaces"
            }
          },
          {
            "metadata": {
              "guid": "6ca1184b-f094-4e8f-b179-d7e32ea222ae",
              "url": "/v2/users/6ca1184b-f094-4e8f-b179-d7e32ea222ae",
              "created_at": "2016-03-03T18:42:33Z",
              "updated_at": null
            },
            "entity": {
              "admin": false,
              "active": false,
              "default_space_guid": null,
              "spaces_url": "/v2/users/6ca1184b-f094-4e8f-b179-d7e32ea222ae/spaces",
              "organizations_url": "/v2/users/6ca1184b-f094-4e8f-b179-d7e32ea222ae/organizations",
              "managed_organizations_url": "/v2/users/6ca1184b-f094-4e8f-b179-d7e32ea222ae/managed_organizations",
              "billing_managed_organizations_url": "/v2/users/6ca1184b-f094-4e8f-b179-d7e32ea222ae/billing_managed_organizations",
              "audited_organizations_url": "/v2/users/6ca1184b-f094-4e8f-b179-d7e32ea222ae/audited_organizations",
              "managed_spaces_url": "/v2/users/6ca1184b-f094-4e8f-b179-d7e32ea222ae/managed_spaces",
              "audited_spaces_url": "/v2/users/6ca1184b-f094-4e8f-b179-d7e32ea222ae/audited_spaces"
            }
          },
          {
            "metadata": {
              "guid": "fd645c80-9fb3-485b-b301-0dd9cfce6675",
              "url": "/v2/users/fd645c80-9fb3-485b-b301-0dd9cfce6675",
              "created_at": "2016-03-03T19:03:51Z",
              "updated_at": null
            },
            "entity": {
              "admin": false,
              "active": false,
              "default_space_guid": null,
              "spaces_url": "/v2/users/fd645c80-9fb3-485b-b301-0dd9cfce6675/spaces",
              "organizations_url": "/v2/users/fd645c80-9fb3-485b-b301-0dd9cfce6675/organizations",
              "managed_organizations_url": "/v2/users/fd645c80-9fb3-485b-b301-0dd9cfce6675/managed_organizations",
              "billing_managed_organizations_url": "/v2/users/fd645c80-9fb3-485b-b301-0dd9cfce6675/billing_managed_organizations",
              "audited_organizations_url": "/v2/users/fd645c80-9fb3-485b-b301-0dd9cfce6675/audited_organizations",
              "managed_spaces_url": "/v2/users/fd645c80-9fb3-485b-b301-0dd9cfce6675/managed_spaces",
              "audited_spaces_url": "/v2/users/fd645c80-9fb3-485b-b301-0dd9cfce6675/audited_spaces"
            }
          },
          {
            "metadata": {
              "guid": "3bdaae3b-57d2-467a-9efb-d2878cf87fa8",
              "url": "/v2/users/3bdaae3b-57d2-467a-9efb-d2878cf87fa8",
              "created_at": "2016-03-03T19:05:47Z",
              "updated_at": null
            },
            "entity": {
              "admin": false,
              "active": false,
              "default_space_guid": null,
              "spaces_url": "/v2/users/3bdaae3b-57d2-467a-9efb-d2878cf87fa8/spaces",
              "organizations_url": "/v2/users/3bdaae3b-57d2-467a-9efb-d2878cf87fa8/organizations",
              "managed_organizations_url": "/v2/users/3bdaae3b-57d2-467a-9efb-d2878cf87fa8/managed_organizations",
              "billing_managed_organizations_url": "/v2/users/3bdaae3b-57d2-467a-9efb-d2878cf87fa8/billing_managed_organizations",
              "audited_organizations_url": "/v2/users/3bdaae3b-57d2-467a-9efb-d2878cf87fa8/audited_organizations",
              "managed_spaces_url": "/v2/users/3bdaae3b-57d2-467a-9efb-d2878cf87fa8/managed_spaces",
              "audited_spaces_url": "/v2/users/3bdaae3b-57d2-467a-9efb-d2878cf87fa8/audited_spaces"
            }
          },
          {
            "metadata": {
              "guid": "8394d6f4-4a9f-4bb4-84cf-3bed78d8ca7d",
              "url": "/v2/users/8394d6f4-4a9f-4bb4-84cf-3bed78d8ca7d",
              "created_at": "2016-03-03T21:40:29Z",
              "updated_at": null
            },
            "entity": {
              "admin": false,
              "active": false,
              "default_space_guid": null,
              "spaces_url": "/v2/users/8394d6f4-4a9f-4bb4-84cf-3bed78d8ca7d/spaces",
              "organizations_url": "/v2/users/8394d6f4-4a9f-4bb4-84cf-3bed78d8ca7d/organizations",
              "managed_organizations_url": "/v2/users/8394d6f4-4a9f-4bb4-84cf-3bed78d8ca7d/managed_organizations",
              "billing_managed_organizations_url": "/v2/users/8394d6f4-4a9f-4bb4-84cf-3bed78d8ca7d/billing_managed_organizations",
              "audited_organizations_url": "/v2/users/8394d6f4-4a9f-4bb4-84cf-3bed78d8ca7d/audited_organizations",
              "managed_spaces_url": "/v2/users/8394d6f4-4a9f-4bb4-84cf-3bed78d8ca7d/managed_spaces",
              "audited_spaces_url": "/v2/users/8394d6f4-4a9f-4bb4-84cf-3bed78d8ca7d/audited_spaces"
            }
          },
          {
            "metadata": {
              "guid": "c0d1198b-ebbd-48bd-b64e-ba148f8f983d",
              "url": "/v2/users/c0d1198b-ebbd-48bd-b64e-ba148f8f983d",
              "created_at": "2016-03-10T00:53:46Z",
              "updated_at": null
            },
            "entity": {
              "admin": false,
              "active": false,
              "default_space_guid": null,
              "spaces_url": "/v2/users/c0d1198b-ebbd-48bd-b64e-ba148f8f983d/spaces",
              "organizations_url": "/v2/users/c0d1198b-ebbd-48bd-b64e-ba148f8f983d/organizations",
              "managed_organizations_url": "/v2/users/c0d1198b-ebbd-48bd-b64e-ba148f8f983d/managed_organizations",
              "billing_managed_organizations_url": "/v2/users/c0d1198b-ebbd-48bd-b64e-ba148f8f983d/billing_managed_organizations",
              "audited_organizations_url": "/v2/users/c0d1198b-ebbd-48bd-b64e-ba148f8f983d/audited_organizations",
              "managed_spaces_url": "/v2/users/c0d1198b-ebbd-48bd-b64e-ba148f8f983d/managed_spaces",
              "audited_spaces_url": "/v2/users/c0d1198b-ebbd-48bd-b64e-ba148f8f983d/audited_spaces"
            }
          }
        ],
        "managers_url": "/v2/organizations/12d1a30b-4623-46ee-bebd-38e90f9c6f26/managers",
        "managers": [
          {
            "metadata": {
              "guid": "088e14a7-8309-4348-b81a-9e8542cfe55e",
              "url": "/v2/users/088e14a7-8309-4348-b81a-9e8542cfe55e",
              "created_at": "2016-02-24T21:47:35Z",
              "updated_at": null
            },
            "entity": {
              "admin": false,
              "active": true,
              "default_space_guid": null,
              "spaces_url": "/v2/users/088e14a7-8309-4348-b81a-9e8542cfe55e/spaces",
              "organizations_url": "/v2/users/088e14a7-8309-4348-b81a-9e8542cfe55e/organizations",
              "managed_organizations_url": "/v2/users/088e14a7-8309-4348-b81a-9e8542cfe55e/managed_organizations",
              "billing_managed_organizations_url": "/v2/users/088e14a7-8309-4348-b81a-9e8542cfe55e/billing_managed_organizations",
              "audited_organizations_url": "/v2/users/088e14a7-8309-4348-b81a-9e8542cfe55e/audited_organizations",
              "managed_spaces_url": "/v2/users/088e14a7-8309-4348-b81a-9e8542cfe55e/managed_spaces",
              "audited_spaces_url": "/v2/users/088e14a7-8309-4348-b81a-9e8542cfe55e/audited_spaces"
            }
          },
          {
            "metadata": {
              "guid": "fd645c80-9fb3-485b-b301-0dd9cfce6675",
              "url": "/v2/users/fd645c80-9fb3-485b-b301-0dd9cfce6675",
              "created_at": "2016-03-03T19:03:51Z",
              "updated_at": null
            },
            "entity": {
              "admin": false,
              "active": false,
              "default_space_guid": null,
              "spaces_url": "/v2/users/fd645c80-9fb3-485b-b301-0dd9cfce6675/spaces",
              "organizations_url": "/v2/users/fd645c80-9fb3-485b-b301-0dd9cfce6675/organizations",
              "managed_organizations_url": "/v2/users/fd645c80-9fb3-485b-b301-0dd9cfce6675/managed_organizations",
              "billing_managed_organizations_url": "/v2/users/fd645c80-9fb3-485b-b301-0dd9cfce6675/billing_managed_organizations",
              "audited_organizations_url": "/v2/users/fd645c80-9fb3-485b-b301-0dd9cfce6675/audited_organizations",
              "managed_spaces_url": "/v2/users/fd645c80-9fb3-485b-b301-0dd9cfce6675/managed_spaces",
              "audited_spaces_url": "/v2/users/fd645c80-9fb3-485b-b301-0dd9cfce6675/audited_spaces"
            }
          }
        ],
        "billing_managers_url": "/v2/organizations/12d1a30b-4623-46ee-bebd-38e90f9c6f26/billing_managers",
        "billing_managers": [

        ],
        "auditors_url": "/v2/organizations/12d1a30b-4623-46ee-bebd-38e90f9c6f26/auditors",
        "auditors": [
          {
            "metadata": {
              "guid": "3bdaae3b-57d2-467a-9efb-d2878cf87fa8",
              "url": "/v2/users/3bdaae3b-57d2-467a-9efb-d2878cf87fa8",
              "created_at": "2016-03-03T19:05:47Z",
              "updated_at": null
            },
            "entity": {
              "admin": false,
              "active": false,
              "default_space_guid": null,
              "spaces_url": "/v2/users/3bdaae3b-57d2-467a-9efb-d2878cf87fa8/spaces",
              "organizations_url": "/v2/users/3bdaae3b-57d2-467a-9efb-d2878cf87fa8/organizations",
              "managed_organizations_url": "/v2/users/3bdaae3b-57d2-467a-9efb-d2878cf87fa8/managed_organizations",
              "billing_managed_organizations_url": "/v2/users/3bdaae3b-57d2-467a-9efb-d2878cf87fa8/billing_managed_organizations",
              "audited_organizations_url": "/v2/users/3bdaae3b-57d2-467a-9efb-d2878cf87fa8/audited_organizations",
              "managed_spaces_url": "/v2/users/3bdaae3b-57d2-467a-9efb-d2878cf87fa8/managed_spaces",
              "audited_spaces_url": "/v2/users/3bdaae3b-57d2-467a-9efb-d2878cf87fa8/audited_spaces"
            }
          }
        ],
        "app_events_url": "/v2/organizations/12d1a30b-4623-46ee-bebd-38e90f9c6f26/app_events",
        "space_quota_definitions_url": "/v2/organizations/12d1a30b-4623-46ee-bebd-38e90f9c6f26/space_quota_definitions",
        "space_quota_definitions": [

        ]
      }
    }
  ]
}

REQUEST: [2016-03-10T09:23:36-06:00]
GET /v2/service_plan_visibilities HTTP/1.1
Host: api.bosh-lite.com
Accept: application/json
Authorization: [PRIVATE DATA HIDDEN]
Content-Type: application/json
User-Agent: go-cli 6.15.0+1076af9 / darwin



RESPONSE: [2016-03-10T09:23:36-06:00]
HTTP/1.1 200 OK
Content-Length: 107
Content-Type: application/json;charset=utf-8
Date: Thu, 10 Mar 2016 15:23:36 GMT
Server: nginx
X-Content-Type-Options: nosniff
X-Vcap-Request-Id: ff0e0071-7388-4023-429b-606cd30ad92a
X-Vcap-Request-Id: acf7bdbc-c974-4ecc-6673-c29135556e42::23137606-038c-4e46-93ce-0d6196672cb1

{
  "total_results": 0,
  "total_pages": 1,
  "prev_url": null,
  "next_url": null,
  "resources": [

  ]
}
FAILED
Plan does not exist for the  service
FAILED
Plan does not exist for the  service

Platform Details

Mac OS X 10.11.1

markstgodard avatar Mar 10 '16 15:03 markstgodard

We have created an issue in Pivotal Tracker to manage this. You can view the current status of your issue at: https://www.pivotaltracker.com/story/show/115423679.

cf-gitbot avatar Mar 10 '16 15:03 cf-gitbot

Took at look at this today, and it looks like the main problem in this case when we attempt to update a service instance that has a service plan that is now private:

  • we fetch the space's service_instance by name
  • we get the service guid via the service_instance's service plan <-----
  • we fetch the service plans for that service guid

The problem occurs in the 2nd step since when a service plan is private, the response from CC will return a nil service_plan_guid and no service_plan, and then the cli cannot resolve the service.. and current service plans...

markstgodard avatar Mar 18 '16 00:03 markstgodard

Yes, let's check with CAPI what API we are supposed to retrieve the service guid from in this case.

dkoper avatar Mar 18 '16 01:03 dkoper

as of now, I am not seeing a nice way for the CLI to be changed resolve the service from a service instance if the service plan is not on the service instance.

I'll talk to @dieucao

cc @fraenkel

markstgodard avatar Mar 18 '16 01:03 markstgodard

@markstgodard @dkoper The only way I can think of solving this is to add an option to specify the service name and if that option is specified with the plan name then instead of the cli inferring the service name via a lookup from the service_plan guid on the service_instance, the new plan's guid can be looked up directly against the service specified.

For example: cf update-service mydb -p NEW_PLAN -s SERVICE_NAME

The only thing to be careful of here is how the option is described in the help so that it doesn't imply that you can update a service instance to a totally different service.

Thoughts on that approach @dkoper ? I can't think of a way to change things on the CC side to make this easier that doesn't accidentally expose the private service plan.

cc @SocalNick @shalako

dieucao avatar Mar 18 '16 06:03 dieucao

Hi @dieucao

I am fine with that. @dkoper If you are cool with that, I can create a PR for the cli changes.

Cheers

markstgodard avatar Mar 18 '16 13:03 markstgodard

@dkoper No pressure on your decision for a new optional "-s" flag, but I did some work on this this afternoon, to see if its a viable option, and there were no other issues, and it works nicely. Also will not allow a user to choose a plan from another service, etc.

Let me know when you are back on Monday. If it makes sense to you, I'll submit a PR.

Cheers

markstgodard avatar Mar 19 '16 23:03 markstgodard

Talked to @dkoper today, submitting a PR for this to add an optional -s flag to specify the service name associated with the plan.

markstgodard avatar May 04 '16 02:05 markstgodard

This option should not be necessary. Just need to use the right API endpoints.

shalako avatar May 04 '16 04:05 shalako

@shalako:Note that @dieu said I can't think of a way to change things on the CC side to make this easier, hence the PR. Do share if you know the right API endpoints we should call instead.

dkoper avatar May 04 '16 04:05 dkoper

@markstgodard let's talk tomorrow

shalako avatar May 04 '16 04:05 shalako

Closing as CAPI team is going to address this here https://www.pivotaltracker.com/n/projects/966314/stories/119333093, so no changes are expected to be required on the CLI side.

dkoper avatar May 21 '16 01:05 dkoper