Cannot select distro_series using API

Bug #1852627 reported by Craig Bender
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MAAS
Fix Released
High
Lee Trager

Bug Description

Trying to use deploy API to deploy something other than default distro (esxi 6.7 in this example). No errors reported, but the distro deployed is always the default (bionic). See api.out in attached file.

Using CLI, selecting esxi/6.7 distro results in error message with usage that conflicts with what "maas {PROFILE} boot-resources read" reports as the name.

$ maas admin machine deploy 7rq3a3 distro_series='esxi/6.7'
{"distro_series": ["6.7 in distro_series does not match with operating system esxi"]}

$ maas admin boot-resources read|jq -r '.[]|select(.name|startswith("esxi"))'
{
  "id": 122,
  "type": "Uploaded",
  "name": "esxi/6.7",
  "architecture": "amd64/generic",
  "resource_uri": "/MAAS/api/2.0/boot-resources/122/",
  "subarches": "generic",
  "title": "VMware ESXi 6.7"

Meanwhile, just selecting esxi OR 6.7 works

$ maas admin machine deploy 7rq3a3 distro_series='6.7'
Success.
Machine-readable output follows:
{
    "boot_interface": {
        "params": "",
        "mac_address": "b8:ae:ed:7b:f2:27",
        "effective_mtu": 1500,
        "vlan": {
...

From Doc:

API URL: POST /MAAS/api/2.0/machines/{system_id}/?op=deploy
(from https://maas.io/docs/api)

Example of using deploy API using URL from docs: (note: Have tried multiple iterations of distro_series, e.g. xenial, ubuntu/xenial, 6.7, esxi, etc)

#!/usr/bin/env python
import json

from requests import Request, Session
from requests_oauthlib import OAuth1

auth1 = OAuth1(u'Ax625PGbVyA5v5fv8A', u'',
               u'WLDFH7KYmdRSPedwnH', u'dU6FhmAH2WYTxYctzn38fMcuWEkUvqad')

headers = {'Accept': 'application/json'}
url = u'http://172.27.20.1:5240/MAAS/api/2.0/machines/7rq3a3/?op=deploy'
body = json.dumps({'system_id': '7rq3a3',
                   'distro_series': 'esxi/6.7'})

headers = {'Content-Type': 'application/json',
           'Content-Length': str(len(body))}

s = Session()
req = Request('POST', url, data=body, headers=headers, auth=auth1)
prepped = req.prepare()
resp = s.send(prepped)
print(resp.text)

Related branches

Revision history for this message
Craig Bender (craig-bender) wrote :
Changed in maas:
status: New → Triaged
importance: Undecided → High
assignee: nobody → Lee Trager (ltrager)
tags: added: api
Revision history for this message
Lee Trager (ltrager) wrote :

MAAS tracks keeps the operating system and distro series as separate variables. So the command should be

$ maas admin machine deploy 7rq3a3 osystem='esxi' distro_series='6.7'

For some reason the osystem parameter wasn't documented, I've added that.

Changed in maas:
milestone: none → next
status: Triaged → Fix Committed
Changed in maas:
milestone: next → 2.7.0b1
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.