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

Add configuration setting to put cf push in verbose mode #35

Closed
mikegehard opened this issue Oct 3, 2017 · 2 comments
Closed

Add configuration setting to put cf push in verbose mode #35

mikegehard opened this issue Oct 3, 2017 · 2 comments

Comments

@mikegehard
Copy link

mikegehard commented Oct 3, 2017

For debugging purposes, it would be nice to be able to set CF_TRACE=true when running this resource. I had a problem with an extra / at the end of an API endpoint that caused the CF CLI to fail with an "Unknown command" error that didn't tell me much about what is wrong.

I propose adding a configuration setting debug, that defaults to false, to help with this.

@mikegehard mikegehard changed the title Add configuration setting to push cf push in verbose mode Add configuration setting to put cf push in verbose mode Oct 3, 2017
@JohannesRudolph
Copy link
Contributor

I've had a go at this, since we also found the need for this setting: https://github.com/meshcloud/cf-resource/tree/feature/support-verbose

However, with my changes put steps on the modified cf-resource would ocassionally fail with an error message like this:

REQUEST: [2018-02-06T09:47:52Z]
GET /v2/apps?q=name:panel&q=space_guid:76ab50b9-0d34-47a0-8279-b1d4691de6a8 HTTP/1.1
Host: api.cf.dev.eu-de-central.msh.host
Accept: application/json
Authorization: [PRIVATE DATA HIDDEN]
Connection: close
Content-Type: application/json
User-Agent: go-cli 6.34.1+bbdf81482.2018-01-17 / linux

RESPONSE: [2018-02-06T09:47:52Z]
HTTP/1.1 200 OK
Connection: close
Content-Length: 3361
Content-Type: application/json;charset=utf-8
Date: Tue, 06 Feb 2018 09:47:52 GMT
Server: nginx
X-Content-Type-Options: nosniff
X-Vcap-Request-Id: aa1681f5-7a54-4fdf-4528-5911cb162b59::521c3723-7431-45ce-9081-d0e420899095

{
...
}
error: unexpected end of JSON input
error running command: exit status 1

I'm not sure why this happens, as the cf cli output is explicitly redirected to stderr so that it doesn't trip up concourse:

func (cf *CloudFoundry) cf(args ...string) *exec.Cmd {
	cmd := exec.Command("cf", args...)
	cmd.Stdout = os.Stderr
	cmd.Stderr = os.Stderr
	cmd.Env = append(os.Environ(), "CF_COLOR=true", "CF_DIAL_TIMEOUT=30")

	if cf.verbose {
		cmd.Env = append(cmd.Env, "CF_TRACE=true")
	}

	return cmd
}

Any ideas?

@JohannesRudolph
Copy link
Contributor

Appears to be related to a known issue in the cf cli.

API tracing to terminal (using CF_TRACE=true, -v option or cf config --trace) doesn't work well with some CLI plugin commands. Trace to file works fine. On Linux, CF_TRACE=/dev/stdout works too.

I'll try fixing it by setting CF_TRACE=/dev/stderr

via cloudfoundry-attic/Diego-Enabler#6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants