示例#1
0
文件: group.go 项目: ContainX/depcon
func (c *MarathonClient) ParseGroupFromFile(filename string, opts *CreateOptions) (*Group, error) {
	log.Info("Creating Group from file: %s", filename)

	file, err := os.Open(filename)
	if err != nil {
		return nil, fmt.Errorf("Error opening filename %s, %s", filename, err.Error())
	}

	if et, err := encoding.EncoderTypeFromExt(filename); err != nil {
		return nil, err
	} else {
		return c.ParseGroupFromString(file, et, opts)
	}
}
示例#2
0
文件: group.go 项目: ContainX/depcon
func (c *MarathonClient) CreateGroupFromString(filename string, grpstr string, opts *CreateOptions) (*Group, error) {
	et, err := encoding.EncoderTypeFromExt(filename)
	if err != nil {
		return nil, err
	}
	group, err := c.ParseGroupFromString(strings.NewReader(grpstr), et, opts)

	if err != nil {
		return group, err
	}

	if opts.StopDeploy {
		if deployment, err := c.CancelAppDeployment(group.GroupID, true); err == nil && deployment != nil {
			log.Info("Previous deployment found..  cancelling and waiting until complete.")
			c.WaitForDeployment(deployment.DeploymentID, time.Second*30)
		}
	}

	return c.CreateGroup(group, opts.Wait, opts.Force)
}