"mojo run" fails in a non-obvious way if it doesn't understand the spec branch you're passing it

Bug #1419915 reported by Tom Haddon
18
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Mojo: Continuous Delivery for Juju
Fix Released
High
David Ames

Bug Description

If you pass a non-spec branch location to "mojo run" it raises a non-obvious error:

Traceback (most recent call last):
  File "/usr/bin/mojo", line 9, in <module>
    load_entry_point('mojo==0.1', 'console_scripts', 'mojo')()
  File "/usr/lib/python2.7/dist-packages/mojo/cli.py", line 510, in main
    run_with_args(args, ap)
  File "/usr/lib/python2.7/dist-packages/mojo/cli.py", line 485, in run_with_args
    args.func(args)
  File "/usr/lib/python2.7/dist-packages/mojo/cli.py", line 261, in run_from_manifest
    args.name, stage=stage, manifest_file=args.manifest_file)
  File "/usr/lib/python2.7/dist-packages/mojo/__init__.py", line 465, in create_workspace
    mkdirs(ws_path, self.owner)
  File "/usr/lib/python2.7/dist-packages/mojo/utils.py", line 157, in mkdirs
    raise OSError("Creation of directory failed: {}".format(path))

It should instead tell you that you've passed it a non-spec branch location, or one it doesn't understand.

Tags: papercut

Related branches

James Troup (elmo)
Changed in mojo:
importance: Undecided → High
status: New → Confirmed
James Troup (elmo)
tags: added: papercut
Tom Haddon (mthaddon)
Changed in mojo:
assignee: nobody → David Ames (thedac)
Revision history for this message
David Ames (thedac) wrote :

This bug has been around since early revisions. Brad Crittenden's revno 120 started on the fix but had the order of operations wrong.

Two problems existed. One the args.spec_url.rsplit("/")[-1] was always broken for no trailing slash. And two, if there was a trailing slash the guessed project name superseded the MOJO_PROJECT variable.

Set the priority for acquiring the project name
 1) From CLI with --project
 2) From MOJO_PROJECT environment variable
 3) Guess from the spec url and warn this is a guess

I am tempted to remove 3 altogether but it may be useful and now with better error handling it will be clear if that guess is incorrect.

lp:~thedac/mojo/non-spec-branch-location-fix

Tom Haddon (mthaddon)
Changed in mojo:
status: Confirmed → Fix Committed
Tom Haddon (mthaddon)
Changed in mojo:
status: Fix Committed → Fix Released
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.