mirror of
https://github.com/serverless/serverless.git
synced 2026-01-25 15:07:39 +00:00
made region select more robust
This commit is contained in:
parent
860ce56889
commit
acfefd08cf
@ -263,7 +263,7 @@ class ServerlessPlugin {
|
||||
* CLI: Prompt Select Region
|
||||
*/
|
||||
|
||||
cliPromptSelectRegion(message, addAllRegions, region, stage) {
|
||||
cliPromptSelectRegion(message, addAllRegions, existing, region, stage) {
|
||||
|
||||
let _this = this;
|
||||
|
||||
@ -288,7 +288,7 @@ class ServerlessPlugin {
|
||||
return BbPromise.reject(new SError('Stage ' + stage + ' does not exist in your project', SError.errorCodes.UNKNOWN));
|
||||
}
|
||||
|
||||
if (addAllRegions) {
|
||||
if (existing) {
|
||||
|
||||
// list only regions in stage
|
||||
regionChoices = [];
|
||||
|
||||
@ -134,7 +134,7 @@ module.exports = function(SPlugin, serverlessPath) {
|
||||
})
|
||||
})
|
||||
.then(function() {
|
||||
return _this.cliPromptSelectRegion('Choose a Region in this Stage: ', true, _this.evt.region, _this.evt.stage)
|
||||
return _this.cliPromptSelectRegion('Choose a Region in this Stage: ', false, true, _this.evt.region, _this.evt.stage)
|
||||
.then(region => {
|
||||
_this.evt.region = region;
|
||||
})
|
||||
|
||||
@ -130,7 +130,7 @@ module.exports = function(SPlugin, serverlessPath) {
|
||||
})
|
||||
})
|
||||
.then(function(){
|
||||
return _this.cliPromptSelectRegion('Select a region to get env var from: ', true, _this.evt.region, _this.evt.stage)
|
||||
return _this.cliPromptSelectRegion('Select a region to get env var from: ', true, true, _this.evt.region, _this.evt.stage)
|
||||
.then(region => {
|
||||
_this.evt.region = region;
|
||||
BbPromise.resolve();
|
||||
|
||||
@ -116,7 +116,7 @@ module.exports = function(SPlugin, serverlessPath) {
|
||||
BbPromise.resolve();
|
||||
})
|
||||
.then(function(){
|
||||
return _this.cliPromptSelectRegion('Select a region to list env vars from: ', true, _this.evt.region, _this.evt.stage)
|
||||
return _this.cliPromptSelectRegion('Select a region to list env vars from: ', true, true, _this.evt.region, _this.evt.stage)
|
||||
.then(region => {
|
||||
_this.evt.region = region;
|
||||
BbPromise.resolve();
|
||||
|
||||
@ -143,7 +143,7 @@ module.exports = function(SPlugin, serverlessPath) {
|
||||
})
|
||||
})
|
||||
.then(function(){
|
||||
return _this.cliPromptSelectRegion('Select a region to set env var in: ', true, _this.evt.region, _this.evt.stage)
|
||||
return _this.cliPromptSelectRegion('Select a region to set env var in: ', true, true, _this.evt.region, _this.evt.stage)
|
||||
.then(region => {
|
||||
_this.evt.region = region;
|
||||
BbPromise.resolve();
|
||||
|
||||
@ -130,7 +130,7 @@ module.exports = function(SPlugin, serverlessPath) {
|
||||
})
|
||||
})
|
||||
.then(function(){
|
||||
return _this.cliPromptSelectRegion('Select a region to unset env var from: ', true, _this.evt.region, _this.evt.stage)
|
||||
return _this.cliPromptSelectRegion('Select a region to unset env var from: ', true, true, _this.evt.region, _this.evt.stage)
|
||||
.then(region => {
|
||||
_this.evt.region = region;
|
||||
BbPromise.resolve();
|
||||
|
||||
@ -126,7 +126,7 @@ module.exports = function(SPlugin, serverlessPath) {
|
||||
BbPromise.resolve();
|
||||
})
|
||||
.then(function(){
|
||||
return _this.cliPromptSelectRegion('Select a new region for your existing stage: ', false, _this.evt.region, _this.evt.stage)
|
||||
return _this.cliPromptSelectRegion('Select a new region for your existing stage: ', false, false, _this.evt.region, _this.evt.stage)
|
||||
.then(region => {
|
||||
_this.evt.region = region;
|
||||
BbPromise.resolve();
|
||||
|
||||
@ -113,7 +113,7 @@ module.exports = function(SPlugin, serverlessPath) {
|
||||
BbPromise.resolve();
|
||||
})
|
||||
.then(function(){
|
||||
return _this.cliPromptSelectRegion('Which region are you deploying to: ', false, _this.evt.region, false)
|
||||
return _this.cliPromptSelectRegion('Which region are you deploying to: ', false, true, _this.evt.region, _this.evt.stage)
|
||||
.then(region => {
|
||||
_this.evt.region = region;
|
||||
BbPromise.resolve();
|
||||
|
||||
@ -143,7 +143,7 @@ module.exports = function(SPlugin, serverlessPath) {
|
||||
BbPromise.resolve();
|
||||
})
|
||||
.then(function(){
|
||||
return _this.cliPromptSelectRegion('Select a region for your new stage: ', false, _this.evt.region, false)
|
||||
return _this.cliPromptSelectRegion('Select a region for your new stage: ', false, false, _this.evt.region, false)
|
||||
.then(region => {
|
||||
_this.evt.region = region;
|
||||
BbPromise.resolve();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user