func ParsePlacement(p string) (*UnitPlacement, error) {
	m := validPlacement.FindStringSubmatch(p)
	if m == nil {
		return nil, fmt.Errorf("invalid placement syntax %q", p)
	}
	up := UnitPlacement{
		ContainerType: m[1],
		Application:   m[2],
		Machine:       m[4],
	}
	if unitStr := m[3]; unitStr != "" {
		// We know that unitStr must be a valid integer because
		// it's specified as such in the regexp.
		up.Unit, _ = strconv.Atoi(unitStr)
	} else {
		up.Unit = -1
	}
	if up.Application == "new" {
		if up.Unit != -1 {
			return nil, fmt.Errorf("invalid placement syntax %q", p)
		}
		up.Machine, up.Application = "new", ""
	}
	return &up, nil
}
// ParsePlacement parses a unit placement directive, as
// specified in the To clause of an application entry in the
// applications section of a bundle.
ParsePlacement parses a unit placement directive, as
specified in the To clause of an application entry in the
applications section of a bundle.
// ParsePlacement parses a unit placement directive as // specified in the To clause of an application entry in the // applications section of a bundle .
func ParsePlacement(p string) (*UnitPlacement, error) {
	m := validPlacement.FindStringSubmatch(p)
	if m == nil {
		return nil, fmt.Errorf("invalid placement syntax %q", p)
	}
	up := UnitPlacement{
		ContainerType: m[1],
		Application:   m[2],
		Machine:       m[4],
	}
	if unitStr := m[3]; unitStr != "" {
		up.Unit, _ = strconv.Atoi(unitStr)
	} else {
		up.Unit = -1
	}
	if up.Application == "new" {
		if up.Unit != -1 {
			return nil, fmt.Errorf("invalid placement syntax %q", p)
		}
		up.Machine, up.Application = "new", ""
	}
	return &up, nil
}
func ParsePlacement ( p string ) ( * UnitPlacement , error ) { m := validPlacement . FindStringSubmatch ( p ) if m == nil { return nil , fmt . Errorf ( " " , p ) } up := UnitPlacement { ContainerType : m [ 1 ] , Application : m [ 2 ] , Machine : m [ 4 ] , } if unitStr := m [ 3 ] ; unitStr != " " { up . Unit , _ = strconv . Atoi ( unitStr ) } else { up . Unit = - 1 } if up . Application == " " { if up . Unit != - 1 { return nil , fmt . Errorf ( " " , p ) } up . Machine , up . Application = " " , " " } return & up , nil }
ParsePlacement parses a unit placement directive, as
specified in the To clause of an application entry in the
applications section of a bundle.
ParsePlacement parses a unit placement directive as specified in the To clause of an application entry in the applications section of a bundle .
// We know that unitStr must be a valid integer because // it's specified as such in the regexp.