func (j *macaroonJar) Activate(cURL *charm.URL) error {
	if j == nil {
		return nil
	}
	if err := j.reset(); err != nil {
		return errors.Trace(err)
	}
	j.currentCharm = cURL

	m, err := j.cache.Get(cURL)
	if err != nil {
		return errors.Trace(err)
	}
	if m != nil {
		_ = httpbakery.SetCookie(j.underlying, j.serverURL, MacaroonNamespace, m)
	}
	return nil
}
// Activate empties the cookiejar and loads the macaroon for the given charm
// (if any) into the cookiejar, avoiding the mechanism in SetCookies
// that records new macaroons.  This also enables the functionality of storing
// macaroons in SetCookies.
// If the macaroonJar is nil, this is NOP.
Activate empties the cookiejar and loads the macaroon for the given charm
(if any) into the cookiejar, avoiding the mechanism in SetCookies
that records new macaroons.  This also enables the functionality of storing
macaroons in SetCookies.
If the macaroonJar is nil, this is NOP.
// Activate empties the cookiejar and loads the macaroon for the given charm // ( if any ) into the cookiejar avoiding the mechanism in SetCookies // that records new macaroons . This also enables the functionality of storing // macaroons in SetCookies . // If the macaroonJar is nil this is NOP .
func (j *macaroonJar) Activate(cURL *charm.URL) error {
	if j == nil {
		return nil
	}
	if err := j.reset(); err != nil {
		return errors.Trace(err)
	}
	j.currentCharm = cURL
	m, err := j.cache.Get(cURL)
	if err != nil {
		return errors.Trace(err)
	}
	if m != nil {
		_ = httpbakery.SetCookie(j.underlying, j.serverURL, MacaroonNamespace, m)
	}
	return nil
}
func ( j * macaroonJar ) Activate ( cURL * charm . URL ) error { if j == nil { return nil } if err := j . reset ( ) ; err != nil { return errors . Trace ( err ) } j . currentCharm = cURL m , err := j . cache . Get ( cURL ) if err != nil { return errors . Trace ( err ) } if m != nil { _ = httpbakery . SetCookie ( j . underlying , j . serverURL , MacaroonNamespace , m ) } return nil }
Activate empties the cookiejar and loads the macaroon for the given charm
(if any) into the cookiejar, avoiding the mechanism in SetCookies
that records new macaroons.
Activate empties the cookiejar and loads the macaroon for the given charm ( if any ) into the cookiejar avoiding the mechanism in SetCookies that records new macaroons .