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

ecs-cli configure --cluster short-name trashes its config file when you shorten the name of the cluster #177

Closed
markriggins opened this issue Nov 2, 2016 · 1 comment · Fixed by #216
Labels

Comments

@markriggins
Copy link
Contributor

markriggins commented Nov 2, 2016

On OSX, if you build from the latest master 8c73f54, the ecs-cli configure command trashes its own config file if you shorten the name of the cluster.

To reproduce,

  1. build from source on OSX
$ cd $GOPATH/github.com
$ mkdir aws
$ git clone [email protected]:aws/amazon-ecs-cli.git
$ cd amazon-ecs-cli
$ make build
  1. create a valid config file with a long cluster name
$ mkdir -p home/.ecs
$ echo '[ecs]' > home/.ecs/config
$ HOME=$PWD/home bin/local/ecs-cli configure --cluster a-really-long-long-long-name
INFO[0000] Saved ECS CLI configuration for cluster (a-really-long-long-long-name) 
$ cat home/.ecs/config
[ecs]
cluster                     = a-really-long-long-long-name
aws_profile                 = 
region                      = 
aws_access_key_id           = 
aws_secret_access_key       = 
compose-project-name-prefix = ecscompose-
compose-service-name-prefix = ecscompose-service-
cfn-stack-name-prefix       = amazon-ecs-cli-setup-

Then update it with a shorter cluster name

$ HOME=$PWD/home bin/local/ecs-cli configure --cluster short-name
$ cat home/.ecs/config
[ecs]
cluster                     = short-name
aws_profile                 = 
region                      = 
aws_access_key_id           = 
aws_secret_access_key       = 
compose-project-name-prefix = ecscompose-
compose-service-name-prefix = ecscompose-service-
cfn-stack-name-prefix       = amazon-ecs-cli-setup-

n-ecs-cli-setup-

Notice the trash at the end of the config file. This happens because the file was opened and written to, but never truncated, so any extra stuff at the end of the file will remain as trash.

@markriggins
Copy link
Contributor Author

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