maas-cli from PPA errors out with traceback - ModuleNotFoundError: No module named 'provisioningserver'

Bug #1986590 reported by Jeff Lane 
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MAAS
Fix Released
Medium
Anton Troyanov
3.2
Fix Released
Medium
Anton Troyanov
3.3
Fix Committed
Medium
Anton Troyanov

Bug Description

at some point in the recent past, the maas cli (not maas-cli which is, confusingly an entirely different tool) has started throwing a traceback:

$ maas --help
Traceback (most recent call last):
  File "/usr/bin/maas", line 11, in <module>
    load_entry_point('maas==3.2.1', 'console_scripts', 'maas')()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 490, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2854, in load_entry_point
    return ep.load()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2445, in load
    return self.resolve()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2451, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/lib/python3/dist-packages/maascli/__init__.py", line 10, in <module>
    from maascli.parser import get_deepest_subparser, prepare_parser
  File "/usr/lib/python3/dist-packages/maascli/parser.py", line 12, in <module>
    from maascli.cli import register_cli_commands
  File "/usr/lib/python3/dist-packages/maascli/cli.py", line 30, in <module>
    from provisioningserver.certificates import check_certificate
ModuleNotFoundError: No module named 'provisioningserver'

I'm unable to use the maas cli tool now.

Note this is from the 3.2 debs on Focal. I was able to use maas cli from the 3.2 snap on a different machine. HOWEVER, I don't want to install a 150MB snap on my local machine just to get remote api access. The 3.2 debs are only a few KB in size:

$ ll /var/cache/apt/archives/*maas* -h
-rw-r--r-- 1 root root 37K Aug 3 15:48 /var/cache/apt/archives/maas-cli_1%3a3.2.1-12003-g.e0fedd282-0ubuntu1~20.04.1_all.deb
-rw-r--r-- 1 root root 67K Aug 3 15:48 /var/cache/apt/archives/python3-maas-client_1%3a3.2.1-12003-g.e0fedd282-0ubuntu1~20.04.1_all.deb

So just over 100KB in size compared to the full MAAS snap:
3.2/stable: 3.2.2-12005-g.f0f96fa78 2022-08-08 (23178) 147MB

Related branches

Bill Wear (billwear)
Changed in maas:
status: New → Triaged
importance: Undecided → Medium
Jeff Lane  (bladernr)
description: updated
Revision history for this message
Nobuto Murata (nobuto) wrote :

The module "provisioningserver" is offered by python3-maas-provisioningserver, but maas-cli doesn't depends on it and it will consume ~50MB disk space additionally in the current packaging structure.

====
The following NEW packages will be installed:
  curtin-common python-babel-localedata python3-babel python3-bcrypt python3-boto python3-bs4 python3-bson python3-bson-ext python3-crochet python3-curtin python3-dateutil python3-decorator
  python3-dnspython python3-formencode python3-html5lib python3-iso8601 python3-lxml python3-maas-provisioningserver python3-paramiko python3-pbr python3-prettytable python3-prometheus-client
  python3-pylxd python3-pyparsing python3-pypureomapi python3-pyvmomi python3-requests-toolbelt python3-seamicroclient python3-simplestreams python3-soupsieve python3-txtftp python3-uvloop
  python3-webencodings python3-ws4py
0 upgraded, 34 newly installed, 0 to remove and 15 not upgraded.
Need to get 9340 kB of archives.
After this operation, 49.4 MB of additional disk space will be used.
====

summary: - maas cli 3.2 traceback
+ maas-cli from PPA errors out with traceback - ModuleNotFoundError: No
+ module named 'provisioningserver'
Revision history for this message
Jerzy Husakowski (jhusakowski) wrote :

MAAS cli shouldn't depend on provisioning server, the shared code should either be part of a common package, or there should be no shared code. We also need to fix import checker to detect incorrect dependencies in MAAS cli.

Changed in maas:
milestone: none → 3.4.0
assignee: nobody → Anton Troyanov (troyanov)
Changed in maas:
status: Triaged → In Progress
Changed in maas:
status: In Progress → Fix Committed
Alberto Donato (ack)
Changed in maas:
milestone: 3.4.0 → 3.4.0-beta1
Alberto Donato (ack)
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.