weixin_39689687 2020-11-29 13:32
浏览 0

Avoid repetition in juju register warnings/errors

Description of change

When invoking a juju register command twice, you would get a warning message advising you that the controller is already known and how to connect to it, followed by an error like controller is already registered as "blah".

This PR fixes the above stuttering issue and as a drive-by updates the logic behind juju register $ip to work similarly to the juju login $ip command, i.e when you try to register an endpoint IP for an already locally known controller you will get the same error like calling juju register twice.

QA steps

console
$ juju bootstrap lxd test --no-gui

# Create a new user and grab the registration command
$ juju add-user bob
User "bob" added
Please send this command to bob:
    juju register MEMTA2JvYjAUExIxMC42NS40Ny4xMTU6MTcwNzAEIP4g-Nnh4plv7E11qLsOPK0bSKlZDkQhy4RHqdIODGTQEwR0ZXN0

"bob" has not been granted access to any models. You can use "juju grant" to grant access.

# Edit ~/.local/share/juju/controllers.yaml and change the controller entry key to "test1"
# Then, run the registration command (when prompted for a controller name use the default value: "test")
$ juju register MEMTA2JvYjAUExIxMC42NS40Ny4xMTU6MTcwNzAEIP4g-Nnh4plv7E11qLsOPK0bSKlZDkQhy4RHqdIODGTQEwR0ZXN0

Enter a new password:
Confirm password:
Enter a name for this controller [test]:
Initial password successfully set for bob.
ERROR This controller has already been registered on this client as "test1".
To login user "bob" run 'juju login -u bob -c test1'.
To update controller details and login as user "bob":
    1. run 'juju unregister bob'
    2. request from your controller admin another registration string, i.e
       output from 'juju change-user-password bob --reset'
    3. re-run 'juju register' with the registration from (2) above.

# Next, try to register the controller using the endpoint of the test controller (see controllers.yaml)
$ juju register 10.65.47.115:17070
ERROR This controller has already been registered on this client as "test1"
To login run 'juju login -c test1'.

# Finally, edit the controllers.yaml file and change the controller key back to "test".
# Then, run the registration command one more time
$ juju register 10.65.47.115:17070
ERROR This controller has already been registered on this client as "test".
To login user "admin" run 'juju login -u admin -c test'.
To update controller details and login as user "admin":
    1. run 'juju unregister admin'
    2. request from your controller admin another registration string, i.e
       output from 'juju change-user-password admin --reset'
    3. re-run 'juju register' with the registration from (2) above.

Bug reference

https://bugs.launchpad.net/juju/+bug/1825166

该提问来源于开源项目:juju/juju

  • 写回答

6条回答 默认 最新

  • weixin_39689687 2020-11-29 13:32
    关注

    !!build!!

    (Failed due to ProvisionerSuite.TestAvailabilityZoneMachinesStartMachinesAZFailuresWithDG)

    评论

报告相同问题?