示例#1
0
// ProjectPs lists the containers.
func ProjectPs(p ecscompose.Project, c *cli.Context) {
	allInfo, err := p.Info()
	if err != nil {
		log.Fatal(err)
	}
	os.Stdout.WriteString(allInfo.String())
}
示例#2
0
// loadProject opens the project by loading configs
func (projectFactory projectFactory) loadProject(project ecscompose.Project) error {
	err := project.Parse()
	if err != nil {
		utils.LogError(err, "Unable to open ECS Compose Project")
	}
	return err
}
示例#3
0
// ProjectPs lists the containers.
func ProjectPs(p ecscompose.Project, c *cli.Context) {
	allInfo, err := p.Info()
	if err != nil {
		log.Fatal(err)
	}
	os.Stdout.WriteString(allInfo.String(ecscompose.ContainerInfoColumns, displayTitle))
}
示例#4
0
// ProjectScale scales containers.
func ProjectScale(p ecscompose.Project, c *cli.Context) {
	if len(c.Args()) != 1 {
		log.Fatal("Please pass arguments in the form: ecs-cli compose scale COUNT")
	}
	count, err := strconv.Atoi(c.Args().First())
	if err != nil {
		log.Fatal("Please pass an integer value for argument COUNT")
	}
	err = p.Scale(count)
	if err != nil {
		log.Fatal(err)
	}
}
示例#5
0
// ProjectRun starts containers and executes one-time command against the container
func ProjectRun(p ecscompose.Project, c *cli.Context) {
	args := c.Args()
	if len(args)%2 != 0 {
		log.Fatal("Please pass arguments in the form: CONTAINER COMMAND [CONTAINER COMMAND]...")
	}
	commandOverrides := make(map[string]string)
	for i := 0; i < len(args); i += 2 {
		commandOverrides[args[i]] = args[i+1]
	}
	err := p.Run(commandOverrides)
	if err != nil {
		log.Fatal(err)
	}
}
示例#6
0
// ProjectUp brings all containers up.
func ProjectUp(p ecscompose.Project, c *cli.Context) {
	err := p.Up()
	if err != nil {
		log.Fatal(err)
	}
}
示例#7
0
// ProjectCreate creates the task definition required for the containers but does not start them.
func ProjectCreate(p ecscompose.Project, c *cli.Context) {
	err := p.Create()
	if err != nil {
		log.Fatal(err)
	}
}