cli
cli copied to clipboard
Error writing config: rename ~/.cf/temp-config929711920 ~/.cf/config.json: no such file or directory
Please fill out the issue checklist below and provide ALL the requested information.
- [x] I reviewed open and closed github issues that may be related to my problem.
- [x] I tried updating to the latest version of the CF CLI to see if it fixed my problem.
- [x] I attempted to run the command with
CF_TRACE=1to help debug the issue. - [x] I am reporting a bug that others will be able to reproduce.
Describe the bug and the command you saw an issue with Provide details on what you were trying to do (and why).
What happened When I was using GNU parallel to run some scripts that can execute multiple cf commands in parallel, I got the below error for one job, but others worked:
| Error writing config: rename /Users/user/.cf/temp-config929711920 /Users/user/.cf/config.json: no such file or directory |
I compared the config.json file and found that only the AccessToken field was different when that file was changed. And after inspecting the AccessToken, especially the iat and exp fields, where the latter is only 1-hour after the former.
And thanks to https://github.com/cloudfoundry/cli/pull/1594, the token must have been automatically refreshed when my script was running. So more then one cf commands tried to refresh the token and it caused contentions even they try to use temp files.
Expected behavior Whether there's an even smarter way to avoid parallel file writing contention, I would expect the life span of the CF CLI access token can be extended to something like 1 day, or at least 12 hours.
The default 1-hour life span of the CF access token is really just too short, especially when one needs to work with multiple CF spaces, BTW I also use $CF_HOME to work with multiple CF spaces simultaneously.
Exact Steps To Reproduce Steps to reproduce the behavior; include the exact CLI commands and verbose output:
- Run
cf login, to a space where multiple apps or services are deployed - Take the
AccessTokenfield in $CF_HOME/.cf/config.json - Use a JWT decoder to inspect the above AccessToken, check the
expfield - Convert the value of the
expfield to a readable date, e.g. usingdate -d@1636967840 - At the time when the token is about to expire, launch some command that uses GNU parallel to run multiple cf commands concurrently, e.g.,
cf apps | awk 'NR>4 {print $1}' | parallel -N1 cf env
Provide more context
- platform and shell details: Mac OS 12.0.1, iTerm 3.4.12, Bash 5.1.8 installed via Homebrew
- version of the CLI you are running:
cf version 8.0.0+e8d41cf8e.2021-09-16 - version of the CC API Release you are on: 3.108.0"
Notes regarding V6 and V7 CLI support:
- V6:
- Minimum supported version of CF Deployment: v7.0.0 (CAPI Release: 1.74.0 (APIs 2.128.0 and 3.63.0))
- Maximum supported version of CF Deployment: v13.4.0 (CAPI Release: 1.94.0 (APIs 2.149.0 and 3.84.0))
- V7:
- Minimum supported version of CF Deployment: v13.5.0 (CAPI Release: 1.95.0 (APIs 2.150.0 and 3.85.0))
Experiencing the same issue when running multiple cf commands in parallel.
experiencing the same issue as well!
same here
Experiencing the same issue when running multiple cf commands in parallel.