Send discharged macaroons when connecting to a stream #6742

Merged
merged 1 commit into from Dec 22, 2016

Conversation

Projects
None yet
3 participants
Member

babbageclunk commented Dec 22, 2016

If the macaroons passed in to an API client connection already include
discharge macaroons, the discharge request dance doesn't need to be
done, so the macaroons won't be in the cookie jar. In this case make
sure they're still sent along when making a websocket connection. (This
is analogous to the code in api.state.Login that adds macaroons from the
bakery client jar to the login request.)

Includes a drive-by fix to MacaroonSuite - the DischargerLogin function
wasn't reset in setup so the function set in one test could be called
accidentally from another test.

Fixes https://bugs.launchpad.net/juju/+bug/1650451

Member

babbageclunk commented Dec 22, 2016

QA steps:

  • Bootstrap 2 controllers, A and B, and add a model m on A.
  • On B, create a new user (keeping track of the register command generated) and grant them superuser access:
juju add-user passuser
juju grant passuser superuser
  • Still on B, set a password for admin and logout, then unregister B, and reregister with the register command above:
juju change-user-password
juju logout
juju unregister B
  • Reregister B with the command given when you created passuser.
  • Now migrate m from A to B.
  • The logtransfer phase (and the rest of the migration) should complete successfully.
Member

babbageclunk commented Dec 22, 2016

!!chittychitty!!

@babbageclunk babbageclunk changed the title from Send discharged macaroons when connecting to a strean to Send discharged macaroons when connecting to a stream Dec 22, 2016

Send discharged macaroons when connecting to a stream
If the macaroons passed in to an API client connection already include
discharge macaroons, the discharge request dance doesn't need to be
done, so the macaroons won't be in the cookie jar. In this case make
sure they're still sent along when making a websocket connection. (This
is analogous to the code in api.state.Login that adds macaroons from the
bakery client jar to the login request.)

Includes a drive-by fix to MacaroonSuite - the DischargerLogin function
wasn't reset in setup so the function set in one test could be called
accidentally from another test.

Fixes https://bugs.launchpad.net/juju/+bug/1650451
Member

babbageclunk commented Dec 22, 2016

$$merge$$

Contributor

jujubot commented Dec 22, 2016

Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju

@jujubot jujubot merged commit 741d0cf into juju:2.1 Dec 22, 2016

jujubot added a commit that referenced this pull request Dec 22, 2016

Merge pull request #6747 from babbageclunk/mm-logtransfer-macaroons-dev
Send discharged macaroons when connecting to a stream (forward port)

(Forward port of #6742 to develop from 2.1 branch.)

If the macaroons passed in to an API client connection already include
discharge macaroons, the discharge request dance doesn't need to be
done, so the macaroons won't be in the cookie jar. In this case make
sure they're still sent along when making a websocket connection. (This
is analogous to the code in api.state.Login that adds macaroons from the
bakery client jar to the login request.)

Includes a drive-by fix to MacaroonSuite - the DischargerLogin function
wasn't reset in setup so the function set in one test could be called
accidentally from another test.

Fixes https://bugs.launchpad.net/juju/+bug/1650451

@babbageclunk babbageclunk deleted the babbageclunk:mm-logtransfer-macaroons branch Dec 22, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment