cloudfoundry / cli

The official command line client for Cloud Foundry
https://docs.cloudfoundry.org/cf-cli
Apache License 2.0
1.75k stars 930 forks source link

plugin.cliConnection.GetApp not returning domain list #707

Closed xchapter7x closed 8 years ago

xchapter7x commented 8 years ago

when calling cliConnection.GetApp from a plugin I am not given any valid domains in my plugin_models.GetAppModel response. However, When calling the cloud controller api directly my app response object does contain the proper domains array.

cloud controller app summary:

REQUEST: [2015-12-07T11:55:52-05:00]
GET /v2/apps/b38803b0-140a-4f22-99e3-963b8f001ea4/summary HTTP/1.1
Host: api.run.core.pez.pivotal.io
Accept: application/json
Authorization: [PRIVATE DATA HIDDEN]
Content-Type: application/json
User-Agent: go-cli 6.14.0+2654a47 / darwin

RESPONSE: [2015-12-07T11:55:53-05:00]
HTTP/1.1 200 OK
Connection: close
Content-Length: 1588
Content-Type: application/json;charset=utf-8
Date: Mon, 07 Dec 2015 16:55:53 GMT
Server: nginx
X-Cf-Requestid: a749e77e-079c-41d5-68df-8d1bd7d56a01
X-Content-Type-Options: nosniff
X-Vcap-Request-Id: 4a310c87-fcfe-48c8-7671-ba21cc9c49ee::e66b5fed-4e98-4a42-ae66-5df52fb33467

{"guid":"b38803b0-140a-4f22-99e3-963b8f001ea4","name":"dispenser","routes":[{"guid":"8b89dc0a-84be-48f9-a7aa-c26241129eeb","host":"dispenser","domain":{"guid":"f4475db3-9d60-410f-89db-ade4d0f20171","name":"cfapps.core.pez.pivotal.io"}}],"running_instances":4,"services":[{"guid":"025227b6-7c84-4f71-95f6-dd6b98230c38","name":"pezvalidator-service","bound_app_count":2},{"guid":"cc7128b2-2044-4a24-9da5-c03c109b732a","name":"dispenser-task-service","bound_app_count":1},{"guid":"2941e97b-f7d5-4d37-bc31-9de904604c38","name":"pezdispenser-2csmall-vcd-1","bound_app_count":1}],"available_domains":[{"guid":"f4475db3-9d60-410f-89db-ade4d0f20171","name":"cfapps.core.pez.pivotal.io"}],"name":"dispenser","production":false,"space_guid":"8b3bff18-f276-479a-ad0f-ec97f56cba24","stack_guid":"d3af53f0-14f3-4bf2-9db5-499992f31474","buildpack":"http://github.com/ryandotsmith/null-buildpack.git","detected_buildpack":null,"environment_json":{"TASK_SERVICE_DATABASE_NAME":"database","TASK_SERVICE_NAME":"dispenser-task-service","TASK_SERVICE_URI_NAME":"uri","UPS_PEZVALIDATOR_NAME":"pezvalidator-service","UPS_PEZVALIDATOR_TARGET":"target-url"},"memory":1024,"instances":4,"disk_quota":1024,"state":"STARTED","version":"17c4a3fb-8cf7-4405-986f-f6692de7f3c1","command":"./main","console":false,"debug":null,"staging_task_id":"e61869bc26074170b3c365f7a708bb3b","package_state":"STAGED","health_check_type":"port","health_check_timeout":null,"staging_failed_reason":null,"diego":false,"docker_image":null,"package_updated_at":"2015-12-02T16:38:30Z","detected_start_command":"./main","enable_ssh":false}

cloud controller spaces api request:

REQUEST: [2015-12-07T00:04:47-05:00]
GET /v2/spaces/8b3bff18-f276-479a-ad0f-ec97f56cba24/summary HTTP/1.1
Host: api.run.core.pez.pivotal.io
Accept: application/json
Authorization: [PRIVATE DATA HIDDEN]
Content-Type: application/json
User-Agent: go-cli 6.12.4-b4b6af1 / darwin

RESPONSE: [2015-12-07T00:04:47-05:00]
HTTP/1.1 200 OK
Connection: close
Content-Length: 5935
Content-Type: application/json;charset=utf-8
Date: Mon, 07 Dec 2015 05:04:47 GMT
Server: nginx
X-Cf-Requestid: 7418040c-f63a-468d-5284-cbb97e6a4823
X-Content-Type-Options: nosniff
X-Vcap-Request-Id: 5ec7fb32-67e2-4206-60ae-ccbc223cf5cf::fba62731-1314-47ab-8633-5ab1c99f6b8e

{
      "guid": "b38803b0-140a-4f22-99e3-963b8f001ea4",
      "urls": [
        "dispenser.cfapps.core.pez.pivotal.io"
      ],
      "routes": [
        {
          "guid": "8b89dc0a-84be-48f9-a7aa-c26241129eeb",
          "host": "dispenser",
          "domain": {
            "guid": "f4475db3-9d60-410f-89db-ade4d0f20171",
            "name": "cfapps.core.pez.pivotal.io"
          }
        }
      ],
      "service_count": 3,
      "service_names": [
        "pezvalidator-service",
        "dispenser-task-service",
        "pezdispenser-2csmall-vcd-1"
      ],
      "running_instances": 4,
      "name": "dispenser",
      "production": false,
      "space_guid": "8b3bff18-f276-479a-ad0f-ec97f56cba24",
      "stack_guid": "d3af53f0-14f3-4bf2-9db5-499992f31474",
      "buildpack": "http://github.com/ryandotsmith/null-buildpack.git",
      "detected_buildpack": null,
      "environment_json": {
        "TASK_SERVICE_DATABASE_NAME": "database",
        "TASK_SERVICE_NAME": "dispenser-task-service",
        "TASK_SERVICE_URI_NAME": "uri",
        "UPS_PEZVALIDATOR_NAME": "pezvalidator-service",
        "UPS_PEZVALIDATOR_TARGET": "target-url"
      },
      "memory": 1024,
      "instances": 4,
      "disk_quota": 1024,
      "state": "STARTED",
      "version": "17c4a3fb-8cf7-4405-986f-f6692de7f3c1",
      "command": "./main",
      "console": false,
      "debug": null,
      "staging_task_id": "e61869bc26074170b3c365f7a708bb3b",
      "package_state": "STAGED",
      "health_check_type": "port",
      "health_check_timeout": null,
      "staging_failed_reason": null,
      "diego": false,
      "docker_image": null,
      "package_updated_at": "2015-12-02T16:38:30Z",
      "detected_start_command": "./main",
      "enable_ssh": false
    }
  ],
  "services": [
    {
      "guid": "2941e97b-f7d5-4d37-bc31-9de904604c38",
      "name": "pezdispenser-2csmall-vcd-1",
      "bound_app_count": 1
    },
    {
      "guid": "c55fb635-84aa-4cd9-bece-5bcdd8425069",
      "name": "inventory-db",
      "bound_app_count": 1,
      "last_operation": {
        "type": "create",
        "state": "succeeded",
        "description": "",
        "updated_at": "2015-09-26T02:06:40Z"
      },
      "dashboard_url": null,
      "service_plan": {
        "guid": "7b1ef276-d19e-4d9b-a7e3-c7af85bad95a",
        "name": "development",
        "service": {
          "guid": "d3fb8607-0fd0-4606-8bad-436f9a8dd73b",
          "label": "p-mongodb",
          "provider": null,
          "version": null
        }
      }
    }

appmodel from cliConnection.GetApp() call within plugin:

{"Guid":"b38803b0-140a-4f22-99e3-963b8f001ea4","Name":"dispenser","BuildpackUrl":"","Command":"./main","Diego":false,"DetectedStartCommand":"./main","DiskQuota":1024,"EnvironmentVars":{"TASK_SERVICE_DATABASE_NAME":"database","TASK_SERVICE_NAME":"dispenser-task-service","TASK_SERVICE_URI_NAME":"uri","UPS_PEZVALIDATOR_NAME":"pezvalidator-service","UPS_PEZVALIDATOR_TARGET":"target-url"},"InstanceCount":4,"Memory":1024,"RunningInstances":0,"HealthCheckTimeout":0,"State":"started","SpaceGuid":"8b3bff18-f276-479a-ad0f-ec97f56cba24","PackageUpdatedAt":"2015-12-02T16:38:30Z","PackageState":"STAGED","StagingFailedReason":"","Stack":{"Guid":"d3af53f0-14f3-4bf2-9db5-499992f31474","Name":"cflinuxfs2","Description":""},"Instances":[{"State":"running","Details":"","Since":"2015-12-02T11:38:48-05:00","CpuUsage":8.909049486393853e-05,"DiskQuota":1073741824,"DiskUsage":18726912,"MemQuota":1073741824,"MemUsage":96862208},{"State":"running","Details":"","Since":"2015-12-02T11:38:50-05:00","CpuUsage":0.00011169651085939928,"DiskQuota":1073741824,"DiskUsage":18726912,"MemQuota":1073741824,"MemUsage":97779712},{"State":"running","Details":"","Since":"2015-12-02T11:38:50-05:00","CpuUsage":0.00012238917638084681,"DiskQuota":1073741824,"DiskUsage":18726912,"MemQuota":1073741824,"MemUsage":95498240},{"State":"running","Details":"","Since":"2015-12-02T11:38:48-05:00","CpuUsage":0.019530583336595155,"DiskQuota":1073741824,"DiskUsage":18726912,"MemQuota":1073741824,"MemUsage":148152320}],"Routes":[{"Guid":"8b89dc0a-84be-48f9-a7aa-c26241129eeb","Host":"dispenser","Domain":{"Guid":"","Name":"","OwningOrganizationGuid":"","Shared":false}}],"Services":null}
cf-gitbot commented 8 years ago

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/109642726.

xchapter7x commented 8 years ago

temporary workaround is to just use plugin.cliConnection.GetApps instead of plugin.cliConnection.GetApp (singular, no 's' is where the issue is).

then just filter the results on the appname needed. GetApps() results do actually contain host and domain for the apps.

krishicks commented 8 years ago

I believe this is the same bug, which I've just updated with triage info: https://github.com/cloudfoundry/cli/issues/699#issuecomment-163440624

dkoper commented 8 years ago

@xchapter7x This should be fixed now, please try with our Edge binary/latest code.

xchapter7x commented 8 years ago

tested on HEAD master. works for me. Thanks :)