mirror of
https://github.com/serverless/serverless.git
synced 2026-01-25 15:07:39 +00:00
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:
commit
4eefd2b6bb
@ -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.
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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]',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user