juju list-controllers returns 'controller-uuid' instead of 'uuid' on version 2.5 and causes jujuclient/juju2 to fail on func27 testing

Bug #1785586 reported by Pedro Guimarães
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-jujuclient
In Progress
Undecided
Pedro Guimarães

Bug Description

Running:
- Juju version: 2.5-beta1-bionic-amd64
- jujuclient

When running tox -e func27 to trigger Amulet testing, gets following error stacktrace:
ubuntu@...:~/designate_bind/build/builds/designate-bind$ tox -e func27
func27 installed: amulet==1.21.0,aodhclient==1.1.1,appdirs==1.4.3,asn1crypto==0.24.0,Babel==2.6.0,blessings==1.6,bundletester==0.12.2,cffi==1.11.5,charm-tools==2.2.3,charmhelpers==0.19.1,Cheetah==2.4.4,cliff==2.13.0,cmd2==0.8.8,colander==1.0b1,configparser==3.5.0,contextlib2==0.5.5,coverage==4.5.1,cryptography==2.3,debtcollector==1.20.0,decorator==4.3.0,deprecation==2.0.5,distro==1.3.0,distro-info==0.0.0,docutils==0.14,dogpile.cache==0.6.7,ecdsa==0.13,entrypoints==0.2.3,enum34==1.1.6,extras==1.0.0,fixtures==3.0.0,flake8==2.4.1,funcsigs==1.0.2,functools32==3.2.3.post2,future==0.16.0,futures==3.2.0,httplib2==0.11.3,idna==2.7,ipaddress==1.0.22,iso8601==0.1.12,Jinja2==2.10,jmespath==0.9.3,jsonpatch==1.23,jsonpointer==2.0,jsonschema==2.5.1,juju-deployer==0.11.0,juju-wait==2.5.0,jujubundlelib==0.5.6,jujuclient==0.54.0,keyring==13.2.1,keystoneauth1==3.10.0,launchpadlib==1.10.6,lazr.authentication==0.1.3,lazr.restfulclient==0.14.0,lazr.uri==1.0.3,libcharmstore==0.0.7,linecache2==1.0.0,Markdown==2.6.11,MarkupSafe==1.0,mccabe==0.3.1,mock==2.0.0,monotonic==1.5,msgpack==0.5.6,munch==2.3.2,netaddr==0.7.19,netifaces==0.10.7,nose==1.3.7,oauth==1.0.1,oauthlib==2.1.0,openstacksdk==0.17.1,os-client-config==1.31.2,os-service-types==1.2.0,os-testr==1.0.0,osc-lib==1.11.0,oslo.config==6.4.0,oslo.context==2.21.0,oslo.i18n==3.21.0,oslo.log==3.39.0,oslo.serialization==2.27.0,oslo.utils==3.36.4,otherstuf==1.1.0,packaging==17.1,paramiko==1.18.5,parse==1.8.4,path.py==8.1.2,pathspec==0.3.4,pbr==4.2.0,pep8==1.7.1,pika==0.12.0,pkg-resources==0.0.0,prettytable==0.7.2,pycparser==2.18,pycrypto==2.6.1,pyflakes==0.8.1,pyinotify==0.9.6,pyOpenSSL==18.0.0,pyparsing==2.2.0,pyperclip==1.6.4,python-barbicanclient==4.7.0,python-ceilometerclient==2.9.0,python-cinderclient==4.0.1,python-dateutil==2.7.3,python-designateclient==2.9.0,python-glanceclient==2.12.1,python-heatclient==1.16.1,python-keystoneclient==3.17.0,python-manilaclient==1.24.1,python-mimeparse==1.6.0,python-neutronclient==6.9.0,python-novaclient==11.0.0,python-openstackclient==3.16.0,python-subunit==1.3.0,python-swiftclient==3.6.0,pytz==2018.5,PyYAML==3.11,requests==2.6.0,requestsexceptions==1.4.0,rfc3986==1.1.0,ruamel.base==1.0.0,ruamel.ordereddict==0.4.13,ruamel.yaml==0.10.23,SecretStorage==2.3.1,simplejson==3.16.0,six==1.11.0,stestr==2.1.0,stevedore==1.29.0,stuf==0.9.16,subprocess32==3.5.2,Tempita==0.5.2,testresources==2.0.1,testtools==2.3.0,theblues==0.3.8,traceback2==1.4.0,translationstring==1.3,unicodecsv==0.14.1,unittest2==1.1.0,virtualenv==16.0.0,voluptuous==0.11.5,wadllib==1.3.3,warlock==1.3.0,wcwidth==0.1.7,websocket-client==0.40.0,wrapt==1.10.11,wsgi-intercept==1.8.0,zope.interface==4.5.0
func27 runtests: PYTHONHASHSEED='0'
func27 runtests: commands[0] | bundletester -vl DEBUG -r json -o func-results.json --test-pattern gate-* --no-destroy
DEBUG:bundletester.utils:Updating JUJU_MODEL: "" -> "serverstack-serverstack:admin/default"
DEBUG:root:Bootstrap environment: serverstack-serverstack:admin/default
DEBUG:deployer.env:Connecting to serverstack-serverstack:admin/default...

DEBUG:bundletester.utils:Updating JUJU_MODEL: "serverstack-serverstack:admin/default" -> ""
Traceback (most recent call last):
  File "/home/ubuntu/designate_bind/build/builds/designate-bind/.tox/func27/bin/bundletester", line 11, in <module>
    sys.exit(entrypoint())
  File "/home/ubuntu/designate_bind/build/builds/designate-bind/.tox/func27/local/lib/python2.7/site-packages/bundletester/tester.py", line 166, in entrypoint
    status = main()
  File "/home/ubuntu/designate_bind/build/builds/designate-bind/.tox/func27/local/lib/python2.7/site-packages/bundletester/tester.py", line 155, in main
    [report.emit(result) for result in run()]
  File "/home/ubuntu/designate_bind/build/builds/designate-bind/.tox/func27/local/lib/python2.7/site-packages/bundletester/runner.py", line 142, in __call__
    bootstrapped = self.builder.bootstrap()
  File "/home/ubuntu/designate_bind/build/builds/designate-bind/.tox/func27/local/lib/python2.7/site-packages/bundletester/builder.py", line 57, in bootstrap
    self.environment.connect()
  File "/home/ubuntu/designate_bind/build/builds/designate-bind/.tox/func27/local/lib/python2.7/site-packages/deployer/env/go.py", line 78, in connect
    self.client = self.client_class.connect(self.name)
  File "/home/ubuntu/designate_bind/build/builds/designate-bind/.tox/func27/local/lib/python2.7/site-packages/jujuclient/environment.py", line 87, in connect
    return connector().run(cls, env_name)
  File "/home/ubuntu/designate_bind/build/builds/designate-bind/.tox/func27/local/lib/python2.7/site-packages/jujuclient/connector.py", line 49, in run
    jhome, data = self.parse_env(env_name)
  File "/home/ubuntu/designate_bind/build/builds/designate-bind/.tox/func27/local/lib/python2.7/site-packages/jujuclient/juju2/connector.py", line 71, in parse_env
    'server-uuid': controller['uuid'],
KeyError: 'uuid'
ERROR: InvocationError: '/home/ubuntu/designate_bind/build/builds/designate-bind/.tox/func27/bin/bundletester -vl DEBUG -r json -o func-results.json --test-pattern gate-* --no-destroy'
_________________________________________________________________________________________________ summary __________________________________________________________________________________________________
ERROR: func27: commands failed

The corresponding connector.py line is (which originally was 69, but moved to 71 as I added some print code before):

connect.py:
        controller_name, model_name, owner = self._parse_env_name(env_name)
        controller = self.get_controller(controller_name)
        model = self.get_model(controller_name, model_name, owner)
        account = self.get_account(jhome, controller_name)

        return jhome, {
            'user': account['user'],
            'password': account.get('password', ''),
            'environ-uuid': model['model-uuid'],
----> 'server-uuid': controller['uuid'],
            'state-servers': controller['api-endpoints'],
            'ca-cert': controller['ca-cert'],
        }
get_controller returns the output of "juju list-controllers --format=yaml" command

Added a command to print "controller" value and got:
{'machine-count': 1, 'controller-uuid': '5996dac0-f975-4f3d-882d-1efcf591d818', 'recent-server': '10.5.0.3:17070', 'access': 'superuser', 'controller-machines': {'active': 0, 'total': 1}, 'ca-cert': '-----BEGIN CERTIFICATE-----(BLABLABLA)-----END CERTIFICATE-----\n', 'cloud': 'serverstack', 'api-endpoints': ['10.5.0.3:17070', '252.0.3.1:17070'], 'user': 'admin', 'current-model': 'default', 'region': 'serverstack', 'model-count': 2, 'agent-version': '2.5-beta1'}

I discovered that 'controller-uuid' was returned instead of 'uuid'.
Double checked running juju show-controller NAME:
serverstack-serverstack:
  details:
    controller-uuid: 5996dac0-f975-4f3d-882d-1efcf591d818
    api-endpoints: ['10.5.0.3:17070', '252.0.3.1:17070']
    ca-cert: |
      -----BEGIN CERTIFICATE-----
      BLABLABLABLA
      -----END CERTIFICATE-----
    cloud: serverstack
    region: serverstack
    agent-version: 2.5-beta1
  controller-machines:
    "0":
      instance-id: 09fef41d-5506-46f0-9c64-42f58438c54d
  models:
    controller:
      model-uuid: 2f212fba-b352-471b-8e28-5818a9f86e6e
      machine-count: 1
      core-count: 2
    default:
      model-uuid: 97ec123d-e527-4911-8aed-3b45817bad0b
  current-model: admin/default
  account:
    user: admin
    access: superuser

Related branches

Changed in python-jujuclient:
assignee: nobody → Pedro Guimarães (pguimaraes)
Revision history for this message
Pedro Guimarães (pguimaraes) wrote :
Changed in python-jujuclient:
status: New → In Progress
Revision history for this message
Ryan Beisner (1chb1n) wrote :

I've raised a bug against juju core regarding the key name change, which may be dangerous for other reasons.

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

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.