Merge pull request #4137 from serverless/minor-config-credentials-cleanup

Minor cleanup after merging PRs for config credentials on AWS
This commit is contained in:
Philipp Muens 2017-08-22 14:22:51 +02:00 committed by GitHub
commit 4eefd2b6bb
3 changed files with 8 additions and 5 deletions

View File

@ -53,4 +53,5 @@ serverless config credentials --provider aws --key 1234 --secret 5678 --profile
```
This example overwrite `custom-profile` profile with the `aws_access_key_id` of `1234` and the `aws_secret_access_key` of `5678`.
If the profile do not exist, it will be added anyway.

View File

@ -92,9 +92,11 @@ class AwsConfigCredentials {
} else {
// Only update the profile if the overwrite flag was set
if (!this.options.overwrite) {
this.serverless.cli.log(
`Failed! ~/.aws/credentials already has a "${this.options.profile}" profile.
Use the overwrite flag ("-o" or "--overwrite") to force the update`);
const message = [
`Failed! ~/.aws/credentials already has a "${this.options.profile}" profile.`,
' Use the overwrite flag ("-o" or "--overwrite") to force the update',
].join('');
this.serverless.cli.log(message);
return BbPromise.resolve();
}
@ -151,7 +153,7 @@ class AwsConfigCredentials {
return this.serverless.utils.writeFile(this.credentialsFilePath, updatedCredsFileContent)
.then(() => {
// set file permissions to only readable/writable by owner (equivalent to 'chmod 600')
// Note: `chmod` doesn't behave as intended on Windows, so skip if we're on Windows.
// NOTE: `chmod` doesn't behave as intended on Windows, so skip if we're on Windows.
if (os.platform() !== 'win32') {
fs.chmodSync(
this.credentialsFilePath,

View File

@ -275,7 +275,7 @@ describe('AwsConfigCredentials', () => {
expect(profileBoundaries.start).to.equal(-1);
});
it('should set the end to the credentials lentgh if no other profile was found', () => {
it('should set the end to the credentials length if no other profile was found', () => {
awsConfigCredentials.options.profile = 'my-profile';
awsConfigCredentials.credentials = [
'[my-profile]',