Duplicated prefix in the url used by the CLI

Bug #1075597 reported by Diogo Matsubara
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Jeroen T. Vermeulen
Jeroen T. Vermeulen

Bug Description

I logged in using maas-cli but when I use any command (e.g. maas-cli maas nodes list) I get a 302 error

ubuntu@autopkgtest:~$ maas-cli maas nodes list
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
    <meta http-equiv="Content-Language" content="en-us" />
    <link rel="shortcut icon" href="/MAAS/static/img/favicon.ico"/>
    <link rel="stylesheet" href="/MAAS/combo/maas/?css/base.css&css/typography.css&css/forms.css&css/layout.css&css/modifiers.css&css/components/flash_messages.css&css/components/pagination.css&css/components/table_list.css&css/components/title_form.css&css/components/blocks.css&css/components/yui_panel.css&css/components/yui_overlay.css&css/components/yui_node_add.css&css/components/data_list.css&css/components/search_box.css&css/ubuntu-webfonts.css" />
    <title>Login | autopkgtest MAAS
    <script type="text/javascript">
var YUI_config = {
    debug: false,
    combine: true,
    filter: 'min',
    root: '',
    base: '/MAAS/combo/yui/?',
    comboBase: '/MAAS/combo/yui/?',
var MAAS_config = {
    uris: {
        login: '/MAAS/accounts/login/',
        statics: '/MAAS/static/',
        maas_handler: '/MAAS/api/1.0/maas/',
        nodes_handler: '/MAAS/api/1.0/nodes/',
        account_handler: '/MAAS/api/1.0/account/'
    debug: false
// -->
<script type="text/javascript"
<script type="text/javascript"

    <script type="text/javascript">
    YUI().use('node', function (Y) {
      Y.on('load', function() {
    // -->

<body class="modal-content login ">

  <div class="center-page-wrapper">
    <div class="center-page-content">

      <div id="body">
        <ul id="flash-messages">


          <h1 id="page-title">Metal as a Service</h1>

        <div id="content">
            <div id="sidebar"></div>

  <h2>Login to autopkgtest MAAS

  <form method="post" action="/MAAS/accounts/login/"><div style='display:none'><input type='hidden' name='csrfmiddlewaretoken' value='4wyki7qiioi5EbGNG1FEdTsQNJ6l0nVN' /></div>
    <input type="hidden" name="next" value="/MAAS/MAAS/api/1.0/nodes/" />

<li class="username">
  <label for="id_username">


      <span class="required">(required)</span>


    <input id="id_username" type="text" name="username" maxlength="30" />

  <span class="help"></span>


<li class="password">
  <label for="id_password">


      <span class="required">(required)</span>


    <input type="password" name="password" id="id_password" />

  <span class="help"></span>


      <li class="form-submit"><input type="submit" value="Login" /></li>

            <div class="clear"></div>
      <div id="footer">
        <img src="/MAAS/static/img/ubuntu_logo_footer.png" alt="Ubuntu" />

        <div class="clear"></div>


Apache log shows this for the request: - - [06/Nov/2012:15:29:51 +0000] "GET /MAAS/MAAS/api/1.0/nodegroups/master/interfaces/?op=list HTTP/1.1" 302 345 "-" "Python-httplib2/0.7.4 (gzip)"

Note the /MAAS/MAAS in the request. Somewhere that's been added to the request.

ubuntu@autopkgtest:~$ maas-cli list
maas G2UxYyWkcT6R6jLkQQ:eBptexySymtgxH7VgF:XdraqcBzpMUramU6GGGFyYQydHTUehwz

Shows I'm logged in successfully.

Tags: cli Edit Tag help

Related branches

Raphaël Badin (rvb)
Changed in maas:
importance: Undecided → Critical
status: New → Triaged
tags: added: api maas-cli
Revision history for this message
Raphaël Badin (rvb) wrote :

I managed to recreate the problem (using the package in the daily ppa):

maas-cli login maas creds:creds:creds
maas-cli maas node-groups list => returns the HTLM content of the login page

From apache's access log: - - [06/Nov/2012:15:33:31 +0000] "GET /MAAS/api/1.0/describe/ HTTP/1.1" 200 6050 "-" "Python-httplib2/0.7.4 (gzip)" - - [06/Nov/2012:15:33:42 +0000] "GET /MAAS/MAAS/api/1.0/nodegroups/?op=list HTTP/1.1" 302 322 "-" "Python-httplib2/0.7.4 (gzip)"

The problem is the URL used to fetch the list of the nodegroups; it contains a duplicated prefix: '/MAAS/MAAS/'.
Here is the content of /MAAS/api/1.0/describe/: http://paste.ubuntu.com/1337566/
The 'path' field of the handlers seems fine but the 'uri' field contains '/MAAS/MAAS'.

This seems to be a very recent problem and the last change I can think of in this area is https://code.launchpad.net/~allenap/maas/api-uri-bug-1059645/+merge/132527. Probably worth a look.

summary: - maas-cli commands not working. Returns a http 302 error
+ Duplicated prefix in the url used by the CLI
tags: added: cli
removed: api maas-cli
Changed in maas:
status: Triaged → In Progress
assignee: nobody → Jeroen T. Vermeulen (jtv)
Changed in maas:
status: In Progress → Fix Committed
Changed in maas:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Related blueprints