Skip to content

Commit 8990906

Browse files
committed
Move resource prefix to utils package
1 parent 33b5630 commit 8990906

4 files changed

Lines changed: 12 additions & 4 deletions

File tree

ecs-cli/modules/cli/configure/migrate.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
"strings"
2222

2323
"github.com/aws/amazon-ecs-cli/ecs-cli/modules/config"
24+
"github.com/aws/amazon-ecs-cli/ecs-cli/modules/utils"
2425
)
2526

2627
func maskSecret(secret string) (out string) {
@@ -122,7 +123,7 @@ credentials:
122123
[WARN] Please read the following changes carefully: http://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_CLI_Configuration.html
123124
- The option --compose-project-name-prefix has been removed (name used for create task definition: <compose_project_name_prefix> + <project_name>). You can specify your desired name with the --project-name option.
124125
- The --compose-service-name-prefix option has been deprecated (name used for create service: <compose_service_name_prefix> + <project_name>). This field can still be configured; however, if it is not configured there is no longer a default value assigned.
125-
- The --cfn-stack-name-prefix option has been removed. To use an existing CloudFormation stack, please specify the full stack name using the --cfn-stack-name option; otherwise, the stack name defaults to amazon-ecs-cli-setup-<cluster_name>.
126+
- The --cfn-stack-name-prefix option has been removed. To use an existing CloudFormation stack, please specify the full stack name using the --cfn-stack-name option; otherwise, the stack name defaults to ` + utils.ECSCLIResourcePrefix + `<cluster_name>.
126127
- Storing an AWS Profile name in the config is no longer supported, please use the --aws-profile flag inline instead.
127128
128129
Are you sure you want to migrate[y/n]?

ecs-cli/modules/commands/configure/configure_command.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@ package configureCommand
1616
import (
1717
"fmt"
1818

19-
"github.com/sirupsen/logrus"
2019
"github.com/aws/amazon-ecs-cli/ecs-cli/modules/cli/configure"
2120
"github.com/aws/amazon-ecs-cli/ecs-cli/modules/commands/flags"
21+
"github.com/aws/amazon-ecs-cli/ecs-cli/modules/utils"
22+
"github.com/sirupsen/logrus"
2223
"github.com/urfave/cli"
2324
)
2425

@@ -186,7 +187,7 @@ func configureFlags() []cli.Flag {
186187
cli.StringFlag{
187188
Name: flags.CFNStackNameFlag,
188189
Usage: fmt.Sprintf(
189-
"[Optional] Specifies the name of AWS CloudFormation stack created on ecs-cli up. (default: \"amazon-ecs-cli-setup-<cluster-name>\")",
190+
"[Optional] Specifies the name of AWS CloudFormation stack created on ecs-cli up. (default: \"" + utils.ECSCLIResourcePrefix + "<cluster-name>\")",
190191
),
191192
},
192193
cli.StringFlag{

ecs-cli/modules/commands/flags/flags.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717
"fmt"
1818
"os"
1919

20+
"github.com/aws/amazon-ecs-cli/ecs-cli/modules/utils"
2021
"github.com/sirupsen/logrus"
2122
"github.com/urfave/cli"
2223
)
@@ -62,7 +63,7 @@ const (
6263
ComposeServiceNamePrefixFlag = "compose-service-name-prefix"
6364
ComposeServiceNamePrefixDefaultValue = ComposeProjectNamePrefixDefaultValue + "service-"
6465
CFNStackNameFlag = "cfn-stack-name"
65-
CFNStackNamePrefixDefaultValue = "amazon-ecs-cli-setup-"
66+
CFNStackNamePrefixDefaultValue = utils.ECSCLIResourcePrefix
6667

6768
LaunchTypeFlag = "launch-type"
6869
DefaultLaunchTypeFlag = "default-launch-type"

ecs-cli/modules/utils/utils.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ import (
1919
"os"
2020
)
2121

22+
const (
23+
// ECSCLIResourcePrefix is prepended to the names of resources created through the ecs-cli
24+
ECSCLIResourcePrefix = "amazon-ecs-cli-setup-"
25+
)
26+
2227
// InSlice checks if the given string exists in the given slice:
2328
func InSlice(str string, list []string) bool {
2429
for _, s := range list {

0 commit comments

Comments
 (0)