'maas-run-scripts report-results' uses Debian tooling and is not distro-agnostic

Bug #1962519 reported by Chuan Li
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MAAS
Fix Released
High
Alberto Donato

Bug Description

How to reproduce:

0) install 3 VMs. All 3 VMs are connected to the same virt bridge. I disable the virt dhcp and assign 3 static IPs to 3 VMs(same subnet)

A: CentOS7
B: Ubuntu 20.04
C: Ubuntu 20.04 (install the latest MAAS 3.1.0-10901-g.f1f8f1505-0ubuntu1~20.04.1 on it)

1) enlist CentOS7 following [1].
After running 'maas-run-scripts report-results', machines read show "status_message": "Script - 50-maas-01-commissioning failed" and CPU/ram/network/storage are all empty(NO-machine-information.png)
Detail steps are in enlist-centos-steps.txt

2) enlist Ubuntu 20.04 following same procedures. Results look good to me.
Detail steps are in enlist-ubuntu-steps.txt

maas logs are in maas-log.txt

[1] https://maas.io/docs/snap/3.1/ui/whats-new-in-maas#heading--enlist-deployed-machines

Tags: sts

Related branches

Revision history for this message
Chuan Li (lccn) wrote :
Revision history for this message
Chuan Li (lccn) wrote :
Revision history for this message
Chuan Li (lccn) wrote :
Revision history for this message
Chuan Li (lccn) wrote :
Revision history for this message
Alberto Donato (ack) wrote :

This seems to be the culprit:

2022-02-24 08:31:48 metadataserver.api: [critical] mymachine.maas(aka44t): commissioning script '50-maas-01-commissioning' failed during post-processing.
 Traceback (most recent call last):
   File "/usr/lib/python3/dist-packages/metadataserver/api.py", line 817, in signal
     target_status = process(node, request, status)
   File "/usr/lib/python3/dist-packages/metadataserver/api.py", line 641, in _process_commissioning
     self._store_results(
   File "/usr/lib/python3/dist-packages/metadataserver/api.py", line 529, in _store_results
     script_result.store_result(
   File "/usr/lib/python3/dist-packages/metadataserver/models/scriptresult.py", line 376, in store_result
     signal_status = try_or_log_event(
 --- <exception caught here> ---
   File "/usr/lib/python3/dist-packages/metadataserver/api.py", line 447, in try_or_log_event
     func(*args, **kwargs)
   File "/usr/lib/python3/dist-packages/metadataserver/builtin_scripts/hooks.py", line 932, in process_lxd_results
     raise ValueError(f"{e}: {output}")
 builtins.ValueError: Expecting value: line 1 column 1 (char 0): b''

Changed in maas:
status: New → Triaged
importance: Undecided → High
milestone: none → next
Revision history for this message
Alberto Donato (ack) wrote :

Could you please also include the output of the 50-maas-10-commissioning script for the failing machine?

Changed in maas:
status: Triaged → Incomplete
Revision history for this message
Chuan Li (lccn) wrote :

stdout and yaml are empty and stderr shows "Failed to parse /tmp/tmpvfa6obeu/resources.json: Expecting value: line 1 column 1 (char 0)"
You could check screenshot 50-maas-10-commissioning.png

Revision history for this message
Chuan Li (lccn) wrote :
Revision history for this message
Alberto Donato (ack) wrote :

What about 40-maas-01-machine-resources? Can you paste the output/error for it?

Also, do you have a custom script for storage configuration that runs between these two?

Changed in maas:
status: Incomplete → New
status: New → Incomplete
Revision history for this message
Chuan Li (lccn) wrote :

There is no custom script.

40-maas-01-machine-resources stderr:

/tmp/tmpvfa6obeu/scripts/commissioning/40-maas-01-machine-resources: line 29: dpkg: command not found

40-maas-01-machine-resources stdout: empty

Revision history for this message
Chuan Li (lccn) wrote :
Revision history for this message
Alberto Donato (ack) wrote :

Ah, there it is. The script is using dpkg, so it currently fails on distros that are not Debian-based

Changed in maas:
status: Incomplete → Triaged
Revision history for this message
Heather Lemon (hypothetical-lemon) wrote :

Is there any known workarounds? other than not use Debain-based distro

Changed in maas:
assignee: nobody → Adam Collard (adam-collard)
Revision history for this message
Thomas Lescot (tomm312) wrote :

Same issue for me on an Ubuntu machine :

50-maas-01-commissioning

Failed to parse /tmp/tmpvc2uyq9x/resources.json: Expecting value: line 1 column 1 (char 0)
Thu, 20 Jan. 2022 13:55:38 Script result lookup or storage error - Failed processing commissioning data: invalid JSON data

Thu, 20 Jan. 2022 13:55:38 Script result lookup or storage error - ogdcjct-s01.gdc.local(m4bnrg): commissioning script '50-maas-01-commissioning' failed during post-processing.

In fact, the file "resources.json" is empty because the script 40 (local inventory) is not executed.

Workaround (manual scripts download and execution):
wget "http://<MAASIP>:5240/MAAS/machine-resources/amd64" -O "resources_bin" >&2
chmod +x resources_bin

wget http://<MAASIP>:5240/MAAS/maas-run-scripts
chmod 755 maas-run-scripts

Add the line "os.system('sudo /home/username/resources_bin > ' + str(paths.resources_file))"
to maas-run-scripts like this :

 result = script.run(console_output=ns.debug)
os.system('sudo /home/adm_gdc/resources_bin > ' + str(paths.resources_file))
 if ns.debug:

Run the script in sudo :

sudo ./maas-run-scripts report-results --config u1-creds.yaml

If that could help

Revision history for this message
Thomas Lescot (tomm312) wrote :

Despite this workaround, all informations are not reported to maas for network and storage

Revision history for this message
Chuan Li (lccn) wrote :

Try the w/a on centos7.

Revision history for this message
Chuan Li (lccn) wrote :
Revision history for this message
Chuan Li (lccn) wrote :
Revision history for this message
Chuan Li (lccn) wrote :
Revision history for this message
Chuan Li (lccn) wrote :
Revision history for this message
Chuan Li (lccn) wrote :
Revision history for this message
Chuan Li (lccn) wrote :
summary: - [3.1 new feature] 'maas-run-scripts report-results' return
- '50-maas-01-commissioning failed' when enlist a deployed CentOS
+ 'maas-run-scripts report-results' returns '50-maas-01-commissioning
+ failed' when enlist a deployed CentOS
summary: - 'maas-run-scripts report-results' returns '50-maas-01-commissioning
- failed' when enlist a deployed CentOS
+ 'maas-run-scripts report-results' uses Debian tooling and is not distro-
+ agnostic
Changed in maas:
assignee: Adam Collard (adam-collard) → nobody
assignee: nobody → Alberto Donato (ack)
milestone: next → 3.2.0
Alberto Donato (ack)
Changed in maas:
status: Triaged → In Progress
Changed in maas:
status: In Progress → Fix Committed
Changed in maas:
milestone: 3.2.0 → 3.2.0-beta5
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.