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

add all apply option for secure #107

Merged
merged 1 commit into from
Nov 3, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 6 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,39 +135,29 @@ test-service:
Show update plan.

```bash
(path-to-path/test-ecs-formation $ ecs-formation task plan
(path-to-path/test-ecs-formation $ ecs-formation task plan --all
(path-to-path/test-ecs-formation $ ecs-formation task plan -t test_definition
```

Apply all definition.

```bash
(path-to-path/test-ecs-formation $ ecs-formation task apply
```

Specify Task Definition.

```bash
(path-to-path/test-ecs-formation $ ecs-formation task apply --all
(path-to-path/test-ecs-formation $ ecs-formation task apply -t test_definition
```

#### Manage Services on Cluster

Show update plan.
Show update plan. Required cluster.

```bash
(path-to-path/test-ecs-formation $ ecs-formation service plan
(path-to-path/test-ecs-formation $ ecs-formation service plan -c test-cluster --all
```

Apply all services.

```bash
(path-to-path/test-ecs-formation $ ecs-formation service apply
```

Specify cluster.

```bash
(path-to-path/test-ecs-formation $ ecs-formation service apply -c test-cluster
(path-to-path/test-ecs-formation $ ecs-formation service apply -c test-cluster --all
```

Specify cluster and service.
Expand Down
47 changes: 0 additions & 47 deletions cmd/cluster.go

This file was deleted.

1 change: 1 addition & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ func init() {
// Cobra also supports local flags, which will only run
// when this action is called directly.
RootCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
RootCmd.PersistentFlags().BoolP("all", "a", false, "Target all resources")

RootCmd.AddCommand(task.TaskCmd, service.ServiceCmd, bluegreen.BlueGreenCmd)
}
Expand Down
1 change: 0 additions & 1 deletion cmd/service/apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ var applyCmd = &cobra.Command{
Use: "apply",
Short: "Update ecs service on target cluster",
RunE: func(cmd *cobra.Command, args []string) error {

srv, err := service.NewClusterService(projectDir, []string{cluster}, serviceName, parameters)
if err != nil {
return err
Expand Down
9 changes: 9 additions & 0 deletions cmd/service/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,15 @@ var ServiceCmd = &cobra.Command{
}
serviceName = sv

all, err := cmd.Flags().GetBool("all")
if err != nil {
return err
}

if serviceName == "" && all == false {
return errors.New("should specify '-s service_name' or '-all' option")
}

paramTokens, err := cmd.Flags().GetStringSlice("parameter")
if err != nil {
return err
Expand Down
12 changes: 12 additions & 0 deletions cmd/task/init.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package task

import (
"errors"

"github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/stormcat24/ecs-formation/client"
Expand Down Expand Up @@ -37,11 +39,21 @@ var TaskCmd = &cobra.Command{
}
taskDefinition = td

all, err := cmd.Flags().GetBool("all")
if err != nil {
return err
}

if taskDefinition == "" && all == false {
return errors.New("should specify '-t task_definition_name' or '-all' option")
}

paramTokens, err := cmd.Flags().GetStringSlice("parameter")
if err != nil {
return err
}
parameters = util.ParseKeyValues(paramTokens)

return nil
},
}
Expand Down