cloudfoundry-community / cloudfoundry-community/cf-python-client

not able/failing to stop app

Open
#50 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
55
Forks
54
PR merge metrics
No merged PRs in 30d

Description

successfully instantiating client and retrieving an app with
app = client.v2.apps.get_first(**{'name': <app_name>})

successfully checking app object with
type(app)
app.summary()

but getting this exception when running
app.stop()
would you please help? is there anything I maybe missing?

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Python/2.7/site-packages/cloudfoundry_client/v2/apps.py", line 22, in stop
    return self.client.v2.apps.stop(self['metadata']['guid'])
  File "/Library/Python/2.7/site-packages/cloudfoundry_client/v2/apps.py", line 89, in stop
    result = super(AppManager, self)._update(application_guid, dict(state='STOPPED'))
  File "/Library/Python/2.7/site-packages/cloudfoundry_client/v2/entities.py", line 79, in _update
    return self._put(url, data, **kwargs)
  File "/Library/Python/2.7/site-packages/cloudfoundry_client/v2/entities.py", line 91, in _put
    response = self.client.put(url, json=data, **kwargs)
  File "/Library/Python/2.7/site-packages/cloudfoundry_client/client.py", line 175, in put
    return CloudFoundryClient._check_response(response)
  File "/Library/Python/2.7/site-packages/cloudfoundry_client/client.py", line 194, in _check_response
    raise InvalidStatusCode(response.status_code, body)
cloudfoundry_client.errors.InvalidStatusCode: 400 : {"code": 1001, "error_code": "CF-MessageParseError", "description": "Request invalid due to parse error: Decoded JSON cannot be nil"}

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing app.stop() with the client setup shown in the issue, then trace the request through cloudfoundry_client/v2/apps.py, v2/entities.py, and client.py. Inspect the JSON sent by the PUT and the resulting response; done means stopping the retrieved app no longer produces the 400 CF-MessageParseError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.