project-create fails due to an IndexError

Bug #1849536 reported by Sheila Miguez
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mojo: Continuous Delivery for Juju
Confirmed
Medium
Unassigned

Bug Description

I'm on bionic and using mojo 0.5.1 installed from a snap on the edge channel.

The stacktrace below happens the first time I try to create a project. It successfully creates a container, and a subsequent call to project-new succeeds due to that.

I played around with pylxd to get the uid the same way that mojo does, and it returns an empty list instead of the config info when I tried it on a stopped container (the one that was created from mojo).

>>> client = pylxd.Client()
>>> container = client.containers.all()[6]
>>> container.name
u'c3upgrade-bionic'
>>> vsm = container.config['volatile.last_state.idmap']
>>> vsm
u'[]'
>>>

» mojo project-new $MOJO_PROJECT -s $MOJO_SERIES --container lxd
2019-10-23 10:02:42 [INFO] Checking c3upgrade project path at /home/codersquid/.local/share/mojo/c3upgrade ...
2019-10-23 10:02:42 [INFO] Checking c3upgrade project container at /home/codersquid/.local/share/mojo/c3upgrade/bionic ...
2019-10-23 10:02:42 [INFO] Not found, creating container
2019-10-23 10:02:42 [INFO] Using mojo container image mojo-ubuntu-bionic-amd64.
2019-10-23 10:02:42 [INFO] Launching container 'c3upgrade-bionic'
/snap/mojo/75/lib/python2.7/site-packages/pylxd/models/operation.py:79: UserWarning: Attempted to set unknown attribute "location" on instance of "Operation"
  .format(key, self.__class__.__name__))
/snap/mojo/75/lib/python2.7/site-packages/pylxd/models/_model.py:137: UserWarning: Attempted to set unknown attribute "type" on instance of "Container"
  key, self.__class__.__name__
2019-10-23 10:02:42 [INFO] Adding device mojo-project-series-root to LXC container c3upgrade-bionic
Traceback (most recent call last):
  File "/snap/mojo/75/bin/mojo-project-new", line 11, in <module>
    load_entry_point('mojo==0.5.1', 'console_scripts', 'mojo-project-new')()
  File "/snap/mojo/75/lib/python2.7/site-packages/mojo/project_new.py", line 39, in main
    cli.create_project(args)
  File "/snap/mojo/75/lib/python2.7/site-packages/mojo/cli.py", line 194, in create_project
    project.create()
  File "/snap/mojo/75/lib/python2.7/site-packages/mojo/project.py", line 229, in create
    self.container.create()
  File "/snap/mojo/75/lib/python2.7/site-packages/mojo/contain.py", line 309, in create
    self._setup_mount()
  File "/snap/mojo/75/lib/python2.7/site-packages/mojo/contain.py", line 227, in _setup_mount
    uid_in_container = self._container_uid_offset
  File "/snap/mojo/75/lib/python2.7/site-packages/mojo/contain.py", line 195, in _container_uid_offset
    return ast.literal_eval(vsm.replace('true', 'True').replace('false', 'False'))[0]["Hostid"]
IndexError: list index out of range
2019-10-23 10:02:42 [ERROR] Error calling external process
Traceback (most recent call last):
  File "/snap/mojo/75/lib/python2.7/site-packages/mojo/cli.py", line 627, in run_with_args
    args.func(args)
  File "/snap/mojo/75/lib/python2.7/site-packages/mojo/utils.py", line 305, in wrapped
    return method(*args, **kwargs)
  File "/snap/mojo/75/lib/python2.7/site-packages/mojo/cli.py", line 236, in call_project_new
    subprocess.check_call(cmd)
  File "/snap/mojo/75/usr/lib/python2.7/subprocess.py", line 541, in check_call
    raise CalledProcessError(retcode, cmd)
CalledProcessError: Command '('mojo-project-new', '--series', 'bionic', '--container', 'lxd', '--log_level', 'INFO', 'c3upgrade')' returned non-zero exit status 1

Revision history for this message
Laurent Sesquès (sajoupa) wrote :

I could reproduce the issue in a fresh VM using both the stable and the edge snaps.

https://pastebin.canonical.com/p/9QPWts9m37/

Changed in mojo:
status: New → Confirmed
importance: Undecided → Medium
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.