akretion / docky

Docky - Helper for docker-compose mainly used in odoo context
GNU Affero General Public License v3.0
56 stars 31 forks source link

usability: cryptic docker-compose error when odoo/src is empty #119

Open rvalyi opened 5 years ago

rvalyi commented 5 years ago

when you create a new project, it odoo/src will typically be empty. However if you try to run docky build before doing ak run, odoo/src might still be empty and then docky build will fail hard with this non user friendly error:

ERROR: Service 'odoo' failed to build: The command '/bin/sh -c pip install -e /odoo/src' returned a non-zero code: 1
Traceback (most recent call last):                              
  File "/usr/local/bin/docky", line 11, in <module>       
    load_entry_point('docky==5.0.3', 'console_scripts', 'docky')()
  File "/usr/local/lib/python3.6/dist-packages/docky/main.py", line 7, in main
    Docky.run()                                                            
  File "/usr/local/lib/python3.6/dist-packages/plumbum/cli/application.py", line 577, in run
    inst, retcode = subapp.run(argv, exit=False)                                                         
  File "/usr/local/lib/python3.6/dist-packages/plumbum/cli/application.py", line 572, in run
    retcode = inst.main(*tailargs)                                          
  File "/usr/local/lib/python3.6/dist-packages/docky/cmd/base.py", line 77, in main                                 
    self._main(*args, **kwargs)    
  File "/usr/local/lib/python3.6/dist-packages/docky/cmd/forward.py", line 16, in _main
    return self._run(self.compose[cmd])       
  File "/usr/local/lib/python3.6/dist-packages/docky/cmd/base.py", line 62, in _run
    self.parent._run(*args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/docky/cmd/base.py", line 32, in _run
    return cmd & retcode
  File "/usr/local/lib/python3.6/dist-packages/plumbum/commands/modifiers.py", line 153, in __rand__
    timeout=self.timeout)
  File "/usr/local/lib/python3.6/dist-packages/plumbum/commands/base.py", line 103, in __call__
    return self.run(args, **kwargs)[1]
  File "/usr/local/lib/python3.6/dist-packages/plumbum/commands/base.py", line 240, in run
    return p.run()
  File "/usr/local/lib/python3.6/dist-packages/plumbum/commands/base.py", line 201, in runner
    return run_proc(p, retcode, timeout)
  File "/usr/local/lib/python3.6/dist-packages/plumbum/commands/processes.py", line 232, in run_proc
    return _check_process(proc, retcode, timeout, stdout, stderr)
  File "/usr/local/lib/python3.6/dist-packages/plumbum/commands/processes.py", line 23, in _check_process
    proc.verify(retcode, timeout, stdout, stderr)
  File "/usr/local/lib/python3.6/dist-packages/plumbum/machines/base.py", line 26, in verify
    stderr)
plumbum.commands.processes.ProcessExecutionError: Command line: ['/usr/local/bin/docker-compose', '-f', 'dev.docker-compose.yml', '--project-name', 'erp_docky-project1', 'build']
Exit code: 1

I think docky build could ensure odoo/src exists before trying to run the docker-compose command instead.