func constructRefreshBase(base RefreshBase) (transport.Base, error) {
	if base.Architecture == "" {
		return transport.Base{}, logAndReturnError(errors.NotValidf("refresh arch"))
	}

	name := base.Name
	if name == "" {
		name = NotAvailable
	}

	var channel string
	var err error
	switch base.Channel {
	case "":
		channel = NotAvailable
	case "kubernetes":
		// Kubernetes is not a valid channel for a base.
		// Instead use the latest LTS version of ubuntu.
		name = "ubuntu"
		channel, err = coreseries.SeriesVersion(coreseries.LatestLts())
		if err != nil {
			return transport.Base{}, errors.NotValidf("invalid latest version")
		}
	default:
		// If we have a series, we need to convert it to a stable version.
		// If we have a version, then just pass that through.
		potential, err := coreseries.SeriesVersion(base.Channel)
		if err == nil {
			channel = potential
		} else {
			channel = base.Channel
		}
	}

	return transport.Base{
		Architecture: base.Architecture,
		Name:         name,
		Channel:      channel,
	}, nil
}
// constructRefreshBase creates a refresh request base that allows for
// partial base queries.
constructRefreshBase creates a refresh request base that allows for
partial base queries.
// constructRefreshBase creates a refresh request base that allows for // partial base queries .
func constructRefreshBase(base RefreshBase) (transport.Base, error) {
	if base.Architecture == "" {
		return transport.Base{}, logAndReturnError(errors.NotValidf("refresh arch"))
	}
	name := base.Name
	if name == "" {
		name = NotAvailable
	}
	var channel string
	var err error
	switch base.Channel {
	case "":
		channel = NotAvailable
	case "kubernetes":
		name = "ubuntu"
		channel, err = coreseries.SeriesVersion(coreseries.LatestLts())
		if err != nil {
			return transport.Base{}, errors.NotValidf("invalid latest version")
		}
	default:
		potential, err := coreseries.SeriesVersion(base.Channel)
		if err == nil {
			channel = potential
		} else {
			channel = base.Channel
		}
	}
	return transport.Base{
		Architecture: base.Architecture,
		Name:         name,
		Channel:      channel,
	}, nil
}
func constructRefreshBase ( base RefreshBase ) ( transport . Base , error ) { if base . Architecture == " " { return transport . Base { } , logAndReturnError ( errors . NotValidf ( " " ) ) } name := base . Name if name == " " { name = NotAvailable } var channel string var err error switch base . Channel { case " " : channel = NotAvailable case " " : name = " " channel , err = coreseries . SeriesVersion ( coreseries . LatestLts ( ) ) if err != nil { return transport . Base { } , errors . NotValidf ( " " ) } default : potential , err := coreseries . SeriesVersion ( base . Channel ) if err == nil { channel = potential } else { channel = base . Channel } } return transport . Base { Architecture : base . Architecture , Name : name , Channel : channel , } , nil }
constructRefreshBase creates a refresh request base that allows for
partial base queries.
constructRefreshBase creates a refresh request base that allows for partial base queries .
// Kubernetes is not a valid channel for a base. // Instead use the latest LTS version of ubuntu. // If we have a series, we need to convert it to a stable version. // If we have a version, then just pass that through.