Comment 1 for bug 1553605

Revision history for this message
Mike Pontillo (mpontillo) wrote :

This has been a pet peeve of mine for a long time, so thanks for the excuse to look into it. ;-)

Upon initial triage of this issue, I immediately noticed that it never occurrs in my development environment. But the problem always occurs with an installed version of MAAS. Comparing how the CLI is executed on an installed MAAS versus a development MAAS, it turns out that the problems stems from packaging. In the MAAS package, we were using a shell script to call the CLI code:

    exec python -m maascli "$@"

When Python is called like this, it takes the module specified in the -m parameter, and replaces sys.argv[0] with the full path to that file.

If instead the wrapper is a Python script, Python will leave it as-is. So the fix is to replace our shell script wrapper with a Python-based wrapper.