func MatchProfileNameByAppName(names []string, appName string) (string, error) {
	if appName == "" {
		return "", errors.BadRequestf("no application name specified")
	}
	var foundProfile string
	for _, p := range LXDProfileNames(names) {
		rev, err := ProfileRevision(p)
		if err != nil {
			// "Shouldn't" happen since we used LXDProfileNames...
			if errors.IsBadRequest(err) {
				continue
			}
			return "", err
		}
		if strings.HasSuffix(p, fmt.Sprintf("-%s-%d", appName, rev)) {
			foundProfile = p
			break
		}
	}
	return foundProfile, nil
}
// MatchProfileNameByApp returns the first profile which matches the provided
// appName.  No match returns an empty string.
// Assumes there is not more than one profile for the same application.
MatchProfileNameByApp returns the first profile which matches the provided
appName.  No match returns an empty string.
Assumes there is not more than one profile for the same application.
// MatchProfileNameByApp returns the first profile which matches the provided // appName . No match returns an empty string . // Assumes there is not more than one profile for the same application .
func MatchProfileNameByAppName(names []string, appName string) (string, error) {
	if appName == "" {
		return "", errors.BadRequestf("no application name specified")
	}
	var foundProfile string
	for _, p := range LXDProfileNames(names) {
		rev, err := ProfileRevision(p)
		if err != nil {
			if errors.IsBadRequest(err) {
				continue
			}
			return "", err
		}
		if strings.HasSuffix(p, fmt.Sprintf("-%s-%d", appName, rev)) {
			foundProfile = p
			break
		}
	}
	return foundProfile, nil
}
func MatchProfileNameByAppName ( names [ ] string , appName string ) ( string , error ) { if appName == " " { return " " , errors . BadRequestf ( " " ) } var foundProfile string for _ , p := range LXDProfileNames ( names ) { rev , err := ProfileRevision ( p ) if err != nil { if errors . IsBadRequest ( err ) { continue } return " " , err } if strings . HasSuffix ( p , fmt . Sprintf ( " " , appName , rev ) ) { foundProfile = p break } } return foundProfile , nil }
MatchProfileNameByApp returns the first profile which matches the provided
appName.
MatchProfileNameByApp returns the first profile which matches the provided appName .
// "Shouldn't" happen since we used LXDProfileNames...