maas snap cli renders SyntaxWarning in the stderr

Bug #1915869 reported by Vladimir Grevtsev
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MAAS
Fix Released
Critical
Alberto Donato
2.9
Fix Committed
Critical
Unassigned

Bug Description

$ maas -h
/snap/maas/11778/usr/lib/python3/dist-packages/netaddr/strategy/__init__.py:189: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if word_sep is not '':
usage: maas [-h] COMMAND ...

optional arguments:
  -h, --help show this help message and exit

drill down:
  COMMAND
    login Log in to a remote API, and remember its description and credentials.
    logout Log out of a remote API, purging any stored credentials.
    list List remote APIs that have been logged-in to.
    refresh Refresh the API descriptions of all profiles.
    init Initialise MAAS in the specified run mode.
    config View or change controller configuration.
    status Status of controller services.
    migrate Perform migrations on connected database.
    apikey Used to manage a user's API keys. Shows existing keys unless --generate or --delete is passed.
    configauth Configure external authentication.
    createadmin Create a MAAS administrator account.
    changepassword
                  Change a MAAS user's password.

http://maas.io/

(Note the "SyntaxWarning" string; while it's not harmful at all, currently it breaks some FCE-related automation which relies on MAAS CLI outputs).

$ snap list maas
Name Version Rev Tracking Publisher Notes
maas 2.9.2-9165-g.b5dc1fd6c 11778 2.9/stable canonical✓ -

Related branches

Revision history for this message
Vladimir Grevtsev (vlgrevtsev) wrote :

This currently blocks all Field deployments using FCE with latest snapped MAAS, so subscribing field-critical.

tags: added: field-critical
Lee Trager (ltrager)
Changed in maas:
status: New → Triaged
importance: Undecided → Critical
assignee: nobody → Alberto Donato (ack)
Revision history for this message
Lee Trager (ltrager) wrote :

The issue appears to be that snapcraft isn't generating pyc files for any of MAAS's dependencies.

description: updated
Revision history for this message
Adam Collard (adam-collard) wrote :

Originally this bug claimed that maas cli *stdout* was broken, that's not true - the warning message is printed by Python to *stderr*.

$ maas --help >/dev/null
/snap/maas/11843/usr/lib/python3/dist-packages/netaddr/strategy/__init__.py:189: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if word_sep is not '':
$ echo $?
0

We need to understand what FCE is attempting to do with stderr (and if/why it attempts to parse `maas -h`)

The issue with netaddr itself is captured in https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=950787 and fixed in 0.7.19-4 which appears to be in Groovy

Revision history for this message
Adam Collard (adam-collard) wrote :

`PYTHONWARNINGS=ignore maas --help`

is another way of working around this issue, if ignoring stderr is difficult/unwelcome.

description: updated
Changed in maas:
milestone: none → 2.10-beta1
status: Triaged → Fix Committed
Revision history for this message
Adam Collard (adam-collard) wrote :

There are snaps available in 2.9/candidate channel with this fix in, they are a rebuild of 2.9.2 tag with snapcraft 4.4.4 and contain compiled python which will hide this error

summary: - maas snap cli renders SyntaxWarning in the stdout
+ maas snap cli renders SyntaxWarning in the stderr
Changed in maas:
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.