+initseries calls deriveDistroSeries() with incorrect arguments

Bug #753249 reported by Steve Kowalik
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Launchpad itself
Fix Released
High
Gavin Panella

Bug Description

While testing +initseries on dogfood, I noticed the JSON encoded data passed to DistributionJob was incorrect.

packagesets and arches are treated specially and need to be passed to deriveDistroSeries as tuples. For example: arches=('i386', 'amd64'), packagesets=().

Related branches

Revision history for this message
Gavin Panella (allenap) wrote :
Download full text (3.2 KiB)

Locally, I applied the following patch to devel:

{{{
=== modified file 'lib/lp/registry/javascript/distroseries.js'
--- lib/lp/registry/javascript/distroseries.js 2011-03-29 20:13:28 +0000
+++ lib/lp/registry/javascript/distroseries.js 2011-04-07 10:01:44 +0000
@@ -716,6 +716,7 @@
                     "Copy Source and Rebuild")
             }
         };
+ alert(Y.JSON.stringify(config, null, 4));
         var parent = this.deriveFromChoice.get("value");
         this.client.named_post(
             parent, "deriveDistroSeries", config);

=== modified file 'lib/lp/registry/model/distroseries.py'
--- lib/lp/registry/model/distroseries.py 2011-04-04 01:42:16 +0000
+++ lib/lp/registry/model/distroseries.py 2011-04-07 10:09:34 +0000
@@ -1939,6 +1939,8 @@
                            description=None, version=None,
                            architectures=(), packagesets=(), rebuild=False):
         """See `IDistroSeries`."""
+ from pprint import pprint
+ pprint(vars())
         # XXX StevenK bug=643369 This should be in the security adapter
         # This should be allowed if the user is a driver for self.parent
         # or the child.parent's drivers.

}}}

I added a few packagesets:

{{{
$ bin/harness
>>> d = store.find(Distribution, name=u'ubuntu').one()
>>> ds = d.getSeries(u"warty")
>>> factory.makePackageset(u"britney", distroseries=ds)
>>> factory.makePackageset(u"spears", distroseries=ds)
>>> transaction.commit()
}}}

Then, on https://launchpad.dev/deribuntu/deriwarty/+initseries, I
chose to derive from ubuntu/warty and selected all the available
architectures and packagesets. I got the following JSON from both
Firefox 4 and Chromium:

{
    "on": {},
    "parameters": {
        "name": "deriwarty",
        "distribution": "https://launchpad.dev/api/devel/deribuntu",
        "architectures": [
            "hppa",
            "i386"
        ],
        "packagesets": [
            "britney",
            "spears"
        ],
        "rebuild": false
    }
}

Server-side, at the top of deriveDistroSeries, vars() gives (slightly
edited):

{'architectures': [u'hppa,i386'],
 'description': None,
 'displayname': None,
 'distribution': <Distribution 'Deribuntu' (deribuntu)>,
 'name': u'deriwarty',
 'packagesets': [u'britney,spears'],
 'rebuild': False,
 'self': <DistroSeries u'warty'>,
 'summary': None,
 'title': None,
 'user': <Person at 0xb60d0d0 name16 (Foo Bar)>,
 'version': None}

Then I tried again, with no architectures or packagesets selected, and
got:

{
    "on": {},
    "parameters": {
        "name": "deriwarty",
        "distribution": "https://launchpad.dev/api/devel/deribuntu",
        "architectures": [],
        "packagesets": [],
        "rebuild": false
    }
}

Server-side:

{'architectures': [u''],
 'description': None,
 'displayname': None,
 'distribution': <Distribution 'Deribuntu' (deribuntu)>,
 'name': u'deriwarty',
 'packagesets': [u''],
 'rebuild': False,
 'self': <DistroSeries u'warty'>,
 'summary': None,
 'title': None,
 'user': <Person at 0x9203e50 name16 (Foo Bar)>,
 'version': None}

I'm not sure what is causing that empty string to be added. My
suspicious is that it's lazr.restf...

Read more...

Changed in launchpad:
status: Confirmed → Triaged
Revision history for this message
Gavin Panella (allenap) wrote :

The important bits of my earlier message are:

> Server-side, at the top of deriveDistroSeries, vars() gives (slightly
> edited):
>
> {'architectures': [u'hppa,i386'],
...
> 'packagesets': [u'britney,spears'],

The architectures and packagesets arguments should instead both be
2-element lists:

{'architectures': [u'hppa', u'i386'],
...
 'packagesets': [u'britney', u'spears'],

> Then I tried again, with no architectures or packagesets selected, and
> got:
...
> Server-side:
>
> {'architectures': [u''],
...
> 'packagesets': [u''],

The architectures and packagesets arguments should instead be empty
lists:

{'architectures': [],
...
 'packagesets': [],

Gavin Panella (allenap)
Changed in launchpad:
assignee: nobody → Gavin Panella (allenap)
status: Triaged → In Progress
Revision history for this message
Gavin Panella (allenap) wrote :

Launchpad.named_post (in client.js) cannot deal with array arguments. I have a rough fix ready.

Revision history for this message
Launchpad QA Bot (lpqabot) wrote :
Changed in launchpad:
milestone: none → 11.05
tags: added: qa-needstesting
Changed in launchpad:
status: In Progress → Fix Committed
Gavin Panella (allenap)
tags: added: qa-ok
removed: qa-needstesting
Brad Crittenden (bac)
Changed in launchpad:
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.