kjackal | hi, I am trying to use the launchpad API and I cannot figure out how to add a list of architectures in a snap package. What issupposed to go into launchpad.snaps.new ? | 16:56 |
---|---|---|
kjackal | I can add a single processor but I do not know how to add a list of them? | 16:56 |
nacc | https://launchpad.net/+apidoc/devel.html#processor | 16:58 |
kjackal | thanks nacc, how can I put two of those in a single entity? | 16:59 |
kjackal | arm_proc = launchpad.processors.getByName(name="arm64") | 17:00 |
kjackal | amd_proc = launchpad.processors.getByName(name="amd64") | 17:00 |
kjackal | new_snap.setProcessors(processors=<what goes here?>) | 17:00 |
kjackal | nacc: ^ | 17:00 |
nacc | kjackal: do you have a link to your code? | 17:00 |
nacc | kjackal: ah ok | 17:00 |
nacc | um, i'm not 100% sure, tbh -- did you try passing those as a list? | 17:01 |
kjackal | nacc: in a few forms, but with no success | 17:02 |
kjackal | what kind of list does it expect? | 17:02 |
nacc | kjackal: you could try getting the current snap's definition and then seeing what it has in that processors_collection member? | 17:03 |
kjackal | this does not help much it is an <lazr.restfulclient.resource.Collection object at 0x7f51b7eb44a8>. I am obviously not good at this... | 17:09 |
kjackal | but I cannot feed that to setprocessors | 17:13 |
kjackal | nacc: ^ | 17:13 |
nacc | kjackal: we might need cjwatson or wgrant to give insight | 17:15 |
kjackal | for completeness, I am trying to figure out how to use the "processors" parameter in creating a new snap https://github.com/juju-solutions/kubernetes-jenkins/blob/master/microk8s/update-gh-branches-and-lp-builders.py#L120 | 17:16 |
nacc | looking | 17:24 |
nacc | kjackal: so do you have it working with a single arch? | 17:25 |
nacc | kjackal: and can you link to what you tried doing? | 17:25 |
kjackal | nacc literaly the extra part are these 3 lines: new_snap = self._get_snap() | 17:26 |
kjackal | arm_proc = launchpad.processors.getByName(name="arm64") | 17:26 |
kjackal | amd_proc = launchpad.processors.getByName(name="amd64") | 17:26 |
kjackal | new_snap.setProcessors(processors=amd_proc) | 17:26 |
wgrant | kjackal, nacc: convert the collection to a list (a collection object is a lazy iterator over a remote collection), or use processors.getByName and make a list from that | 17:27 |
kjackal | excuse my ignorance wgrant, how do you make a list from the above arm_proc and amd_proc ? | 17:28 |
wgrant | Normal python | 17:28 |
wgrant | [arm_proc, amd64_proc] | 17:28 |
kjackal | no, that does not work, let me show you the output | 17:28 |
kjackal | https://pastebin.ubuntu.com/p/7Myym7jymX/ | 17:30 |
kjackal | wgrant: ^ | 17:31 |
nacc | kjackal: well, right even if only passing one, you need it to be a list (above) | 17:31 |
nacc | wgrant: ack on what you suggested | 17:31 |
kjackal | nacc: no if it is a single processor it does not need to be a list. This works perfecctly: new_snap.setProcessors(processors=amd_proc) | 17:32 |
wgrant | You can always fall back to processors=['/+processor/amd64', '/+processor/i386'] etc. I'm afk so can't test the launchpadlib bits myself. But what is the type of amd_proc in the case that works? | 17:34 |
wgrant | Ah | 17:40 |
kjackal | it is a {Entry} dict, I think | 17:40 |
wgrant | So the WADL declaration is bad, I think | 17:41 |
wgrant | It won't automatically serialise a list of objects | 17:41 |
wgrant | But a list of paths works fine | 17:41 |
wgrant | (but +processors, not +processor as I said above) | 17:41 |
kjackal | trying it now | 17:42 |
kjackal | Ah, finally worked! Thank you wgrant, nacc | 17:44 |
kjackal | this worked new_snap.setProcessors(processors=['/+processors/amd64', '/+processors/arm64']), let me try to add this to the new constractor | 17:44 |
cjwatson | IIRC it's that we don't have a way to declare that kind of nested structure in WADL. Similar issue as I mentioned the other day regarding git permissions stuff. | 17:48 |
wgrant | kjackal: you can also use .self_link on the processor object (recommended in case we change the URLs, though that's somewhat unlikely) | 17:49 |
wgrant | I thought restfulclient could do it on serialisation, just not deserialisation. Maybe I misremember | 17:49 |
cjwatson | I don't think so but the code is super-twisty and it's well within the bounds of imagination that I missed something there | 17:50 |
kjackal | it is a bit problematic since I wouldnt normaly know about the processors=['/+processors/amd64', '/+processors/arm64'] syntax | 17:57 |
cjwatson | You can sort of see it if you do list() on an existing processors collection (gives you longer URLs, but equivalent in this case) | 18:06 |
cjwatson | But it's indeed a bit opaque | 18:07 |
kyrofa | This git branch was updated 20 hours ago, but Launchpad still hasn't registered it as having changed: https://code.launchpad.net/~nextcloud-snappy-dev/nextcloud-snap/+git/nextcloud-snap/+ref/12 | 18:53 |
kyrofa | i.e. the change doesn't show up online nor has the snap been rebuilt | 18:53 |
kyrofa | But if I clone it, I see it | 18:53 |
kyrofa | Is there anything I can do to convince it to update? | 18:54 |
kyrofa | cjwatson, if you're around, perhaps you know? | 19:27 |
kyrofa | Perhaps it'll work if I just manually poke the new build | 19:53 |
cjwatson | kyrofa: lp.load('/~nextcloud-snappy-dev/nextcloud-snap/+git/nextcloud-snap').rescan() | 23:22 |
Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!