Friday, 2019-05-17

*** gvincent has joined #ara06:03
*** ktibi has joined #ara09:46
*** ktibi has quit IRC10:15
*** ktibi has joined #ara10:16
*** ktibi has quit IRC10:22
*** dbpiv has joined #ara11:23
*** dbpiv has quit IRC12:27
*** ktibi has joined #ara12:32
*** krion has quit IRC12:45
*** krion has joined #ara12:51
ktibidmsimard, Hi, So I succeded to install ARA api 1.0 (with PG) and configure ansible 2.8 with plugin. Do you have doc for install the web part or I need to use ansible role ?12:51
dmsimardktibi: you can use the ansible role or install from source (which is ultimately not very different)12:53
dmsimardktibi: https://github.com/ansible-community/ara-web -- npm install, npm start12:53
dmsimardthe role takes care of installing npm, getting the source, generating either a static version or running the development server with a systemd unit12:53
dmsimardalso takes care of the frontend (only nginx for now)12:53
ktibidmsimard, ok thx for that.12:55
ktibiDo you have plan for multi tenant env for the web interface ?12:56
ktibior I need to deploy a database and an API for each project ? (If I want to isolated each project)12:56
dmsimardktibi: the web client connects to the API, so however many tenants you are sending to the api ?12:57
dmsimardthere'll eventually be authentication support in the web client so it is able to authenticate against the API12:57
ktibiMaybe 10 project send to API.12:57
dmsimardyou don't want a project to see another project's playbooks but yet still send them to the same database ?12:57
ktibiFor now, I had imagined to deploy one API by project12:58
ktibisame PG instance but one database by project12:58
dmsimardthat would work12:58
dmsimardI would need some time to think about what multi-tenancy would look like12:59
dmsimardvery out of scope for 1.0 for sure :)13:00
ktibifor now, can I arrange all reports by label or project ? Maybe with a tag.13:00
ktibiIf I use one API server13:00
dmsimardthe API supports labelling playbooks13:00
dmsimardwhich, in turn, would allow you to search for playbooks matching a label13:01
dmsimardhowever there is no client-side support for that feature yet13:01
ktibiok so I can't send the label with ansible.13:02
dmsimardwell, not yet13:02
dmsimardhang on13:02
dmsimardktibi: this is tracked as https://github.com/ansible-community/ara/issues/2513:02
ktibiho it's for that story board is empty13:03
dmsimardyeah, we migrated everything to github13:03
dmsimardlabels might end up working the same way as playbook names, they aren't documented yet but are explained here https://github.com/ansible-community/ara/issues/1513:03
ktibiok, ara leave openstack community ? ;)13:03
dmsimardit hasn't13:03
dmsimardopenstack has rebranded their code review/ci infrastructure to opendev.org and was no longer mirroring projects to the (now "official") openstack namespace on github13:04
dmsimardhttps://opendev.org/recordsansible/ara is the "authoritary" repository13:05
dmsimardgithub is the mirror13:05
*** dbpiv has joined #ara13:08
*** ktibi has quit IRC13:15
*** ktibi has joined #ara13:16
*** ktibi has quit IRC13:17
*** ktibi has joined #ara13:18
ktibidmsimard, do you test ara with ansible 2.8 ? I have a lot of warning now : Failure using method (v2_playbook_on_stats) in callback plugin (<ansible.plugins.callback./home/ktibi/ansible3/lib/python3.6/site-13:22
ktibipackages/ara/plugins/callback/ara_default.CallbackModule object at 0x7fd48c2fd898>): 'NoneType' object is not subscriptable13:22
dmsimardktibi: we have integration tests running on devel but it might be a regression we didn't catch13:22
dmsimardktibi: does it always reproduce ?13:22
ktibidmsimard, https://paste.ubuntu.com/p/TMNxSPKmvr/13:24
dmsimardktibi: can you run that with -vvv (three V's) to have the full trace ?13:25
ktibidmsimard, I pasted just full trace, I removed all ansible log : https://paste.ubuntu.com/p/MHbttQfRP7/13:28
dmsimardok, give me a while and I can look into it13:31
dmsimardapollo13: I was looking at the client side implementation for labels and asking myself whether we really need a dedicated table just for holding the labels13:45
dmsimardcould probably just be a field in the playbook table ?13:45
dmsimardthe objective is to make labels searchable13:46
dmsimardi.e, finding playbooks that have label X or Y13:46
dmsimardI figure it's probably a faster query to look up playbooks that match a label which under the hood is a foreign key ?13:48
dmsimardthe only thing with a dedicated table is that we need to handle the machinery of creating the label if it doesn't exist13:48
dmsimardso need to change https://github.com/ansible-community/ara/blob/e1d3e568937a50916b468c7a1713fa092eb3fc2e/ara/api/serializers.py#L366-L375 slightly I suppose13:52
dmsimardyeah I'll stick with a dedicated table -- otherwise if you change the name of a label it doesn't cascade14:11
apollo13dmsimard: also if it is just a field, how are you going to search if you have multiple labels14:32
apollo13aside from an array field or so which basically only work on postgresql :D14:32
dmsimardI actually sort of wish jsonfield worked with sqlite14:33
dmsimardand mysql14:33
dmsimardsince ansible is all json14:33
apollo13it more or less does14:33
apollo13well differently put, it would be possible to write a json field for those three14:34
apollo13I think django has a gsoc project this year trying to do that14:34
dmsimardthe serialized and compressed binary fields we have works right now but there are surely opportunities to improve that14:34
dmsimardktibi: oi, I might have a patch for labels sometime today if you want to try it out14:36
dmsimard^ apollo13: I think you wanted to try that as well14:36
apollo13I'll do my best, no promises though14:37
apollo13I still have to read the docs and figure out how to install the webfrontend :D14:37
dmsimardnpm install/npm start :p14:37
dmsimardotherwise https://ara.readthedocs.io/en/feature-1.0/ansible-role-ara-web.html14:38
apollo13mhm, the frontend should just be static files right?14:38
dmsimardit can be, yes14:38
*** ktibi has quit IRC14:38
dmsimard# Whether to use the embedded react web server or not14:39
dmsimard# Setting this to false means ara-web will be statically built instead14:39
dmsimardara_web_dev_server: true14:39
*** krion has quit IRC14:41
apollo13cool, so that I could include into my exe then, let me quickly check if I can built an executable for ara-server :D14:41
dmsimardhmmmm14:41
dmsimardfor labels14:41
*** krion has joined #ara14:42
dmsimardI want users to just pass a list of labels14:42
dmsimardbut the API is expecting a list of dicts (which would be [{"name": "foo"}]) instead of just ["foo"]14:42
apollo13map(lambda l: {"name": l}, labels)14:43
apollo13will give you that14:43
dmsimardsure, but I was debating where that code should live14:43
dmsimardin the callback would work14:44
dmsimardbut then you need to patch all the other places too14:44
dmsimardso I guess it needs to be at the serializer level14:44
apollo13right, change the api? :D14:44
*** ktibi has joined #ara14:50
apollo13mhm, my idea of building ara into an executable fails due to pyyaml not having manylinux wheels *scratches head and wonders if he really wants to go down that rabbit hole*14:51
apollo13otherwise the executable seems to run, guess I have to try it in a manylinux 2010 container and see if I can build it14:52
apollo13dmsimard: are you up for an adventure?15:05
dmsimardoh boy15:05
dmsimardwe're friday, don't ask too much of me15:06
apollo13if you trust me, download https://apolloner.eu/~apollo13/.tmp/ara15:06
apollo13make it executable and see if you can get it to run15:06
dmsimardapollo13: that seems to work15:07
apollo13coolio15:07
dmsimarddon't think it's the latest tag though, has the cors bug15:07
apollo13that is a standalone ara server15:07
apollo13it is the beta build yes15:07
apollo13from pypi15:07
dmsimardhmm15:07
dmsimard?: (corsheaders.E013) Origin '127.0.0.1:8000' in CORS_ORIGIN_WHITELIST is missing scheme or netloc15:07
dmsimard?: (corsheaders.E013) Origin 'localhost:3000' in CORS_ORIGIN_WHITELIST is missing scheme or netloc15:07
dmsimardthat's supposed to be fixed by the new defaults which include the http://15:07
apollo13ara-1.0.0.0b1-py2.py3-none-any.whl15:08
apollo13straight from pypi, so apparently your config is still wonky or it's not fixed :D15:08
dmsimardoh, wait, that's possible15:08
dmsimardyeah15:08
dmsimardold config15:08
dmsimard++ it works15:08
dmsimardhow did you do it ?15:09
apollo13now all I need to do is add gunicorn + the static files from the frontend and we got a server running in a second15:09
dmsimardyeah I think the api is a good fit for containers15:09
apollo13pex -m ara.server PyYAML-5.1-cp37-cp37m-manylinux1_x86_64.whl 'ara[server]==1.0.0.0b1' psycopg2-binary -o ara15:09
dmsimardthat's it ?15:10
apollo13yeah15:10
dmsimardthat's pretty friggin sweet15:10
apollo13well I did manually build PyYAML in a manylinux container otherwise it would build against my system and most likely not work on yours15:10
apollo13but aside from that15:10
dmsimardthat's because the wheels aren't on pypi ?15:10
apollo13yeah15:10
dmsimardhttps://github.com/yaml/pyyaml/issues/9515:11
apollo13if I add gunicorn and a custom management command, you can even run "ara server" and do socket activation via systemd (at least if a gunicorn with my patches is used)15:11
apollo13yeah https://github.com/yaml/pyyaml/issues/43 mainly15:12
dmsimardgvincent: around ? scratching my head about a django-rest-framework serializer issue and google-fu is failing me15:15
gvincentyes15:15
dmsimardgvincent: it's about playbooks and labels -- somewhere along those lines: https://github.com/ansible-community/ara/blob/e1d3e568937a50916b468c7a1713fa092eb3fc2e/ara/api/serializers.py#L348-L37515:16
dmsimard1) I got rid of the description field which was redundant (people can just supply good names I suppose)15:17
dmsimard2) I'd like the client to be able to pass a list of label names: ["foo", "bar"] instead of needing to supply dicts: [{"name": "foo"}, {"name", "bar"}]15:18
dmsimard3) I already changed the models.Label.objects.create to a models.Label.objects.get_or_create15:18
dmsimardThe label serializer is preventing me from passing just a string that would be the name, it really wants a dict with the name key15:19
dmsimardany ideas ?15:19
gvincent2sec15:20
dmsimardgvincent: it seems like this is close to what I'm looking for https://stackoverflow.com/questions/40060332/django-rest-framework-default-serializer-for-foreign-key-field15:30
dmsimardthe to_representation part15:31
gvincentre15:34
gvincentdmsimard, I don't understand The label serializer is preventing me from passing just a string15:36
gvincentfor which field?15:36
dmsimardgvincent: http://paste.openstack.org/raw/751525/15:36
gvincentdmsimard, you need to overwrite create on playbook serializer15:38
dmsimardI already am but I think it's the LabelSerializer in PlaybookSerializer that is causing the issue15:38
dmsimardif I remove the LabelSerializer, it changes the error to "Incorrect type. Expected pk value, received str."15:39
gvincentdmsimard,15:40
gvincenthttps://www.django-rest-framework.org/api-guide/relations/#slugrelatedfield15:40
dmsimardoh, let me try that.15:40
gvincentlabels = serializers.SlugRelatedField(15:43
gvincent        many=True,15:43
gvincent        queryset=Label.objects.all(),15:43
gvincent        slug_field='text'15:43
gvincent    )15:43
gvincentor something like that15:43
gvincentI need to go15:43
gvincentfeel free to put a -1 review with the test red, I can have a look on monday15:44
dmsimardgvincent: np, I'll do some work with that. It sort of works but we need to create the label if it doesn't exist15:44
dmsimardi.e, "Object with name=test-label does not exist."15:44
dmsimardbut getting closer15:44
gvincentdmsimard, so read_only=True,15:44
*** dbpiv has quit IRC15:46
dmsimardit works \o/16:10
dmsimardgvincent: <3 thanks16:10
gvincentyour welcome16:10
gvincentyou're*16:11
dmsimardit is super clean too16:11
dmsimardno need to override the create method16:11
gvincentwith read_only=True?16:11
gvincentlabel are not created?16:12
dmsimardgvincent: need a slugrelatedfield that supports get_or_create, e.g https://stackoverflow.com/a/2801189616:13
gvincentah yes ok16:13
gvincentI understand16:13
gvincentdmsimard, I will implement https://github.com/ansible-community/ara-web/issues/716:15
dmsimardsure16:16
dmsimardI wanted to give a shot at implementing the file/host facts modals16:16
gvincentIt's a good idea to regroup everythink by task16:16
dmsimardbut I lost patience trying to figure it out haha16:16
gvincentI think I can do it locally without modifying the API16:17
gvincenthaha ;)16:17
gvincentI'm in my new house now, I have more time to work on ara16:17
gvincentsorry for my absence16:17
dmsimardgvincent: the problem with that is that the list of results is only available in the detailed task view16:17
dmsimardi.e, https://api.demo.recordsansible.org/api/v1/tasks doesn't provide the list of results16:17
dmsimardhowever https://api.demo.recordsansible.org/api/v1/results provides their parent task16:18
dmsimardanyway, let me know if you have questions16:18
dmsimardhappy weekend :D16:18
*** ktibi has quit IRC16:19
openstackgerritDavid Moreau Simard proposed recordsansible/ara feature/1.0: Remove the description field from the label model  https://review.opendev.org/65983416:46
openstackgerritDavid Moreau Simard proposed recordsansible/ara feature/1.0: Add support for specifying playbook labels as Ansible variables  https://review.opendev.org/65983516:46
openstackgerritDavid Moreau Simard proposed recordsansible/ara feature/1.0: Add missing test for patching a playbook name  https://review.opendev.org/65983616:47
openstackgerritDavid Moreau Simard proposed recordsansible/ara feature/1.0: Add missing test for patching a playbook name  https://review.opendev.org/65983616:48
openstackgerritDavid Moreau Simard proposed recordsansible/ara feature/1.0: Remove the description field from the label model  https://review.opendev.org/65983417:20
openstackgerritMerged recordsansible/ara feature/1.0: Add missing test for patching a playbook name  https://review.opendev.org/65983617:33
openstackgerritMerged recordsansible/ara feature/1.0: Remove the description field from the label model  https://review.opendev.org/65983417:47
apollo13dmsimard: does zuul support running docker containers? if yes we can probably relatively easily build an ara exectuable17:49
dmsimardapollo13: zuul executes arbitrary code on VMs, it can do whatever you throw at it17:50
dmsimardfor the postgresql integration tests, the job installs docker, spins up a postgre container and uses it17:50
dmsimardit's a bit finicky because the ansible that zuul provides doesn't have the docker python lib, for example17:50
dmsimardso you can run docker shell commands but not the docker ansible modules17:51
apollo13hehe, so if I write a bash script that performs the building you will do the CI for me? :)17:51
dmsimardapollo13: https://github.com/ansible-community/ara/blob/d04d5d21fe02d7d612a9a1efaee2ae7acbbbe392/tests/with_postgresql.yaml#L34-L6217:51
apollo13actually I probably can write the ansible stuff too, might just need help with zuul oddities17:51
dmsimardapollo13: start with the thing that builds your thing17:51
apollo13yeah17:52
dmsimardand then I can point you in the right direction17:52
apollo13will give it a shot over the next days17:52
dmsimard++17:52
apollo13having an executable + aa systemd service fail as only requirement for ara server seems a nice achievement17:52
dmsimardFWIW I've been meaning to try https://github.com/ansible-community/ansible-bender which could supposedly build us container images straight from our existing roles and playbooks17:53
apollo13interesting17:53
apollo13so much to do, so much to try :D17:53
dmsimardlast time I tried it I think I ran into this bug https://github.com/ansible/ansible/pull/5581617:53
dmsimardwell, that's the PR of the bug17:54
dmsimardlarsks: ^ thanks for that btw, need to try it :p17:54
apollo13ok, onto the bus, cy…17:55
dmsimardapollo13: yeah, it never occurred to me to make binary blobs17:55
dmsimardIt's not like we're writing golang or anything :p17:55
dmsimardhave a nice weekend o/17:55
*** gvincent has quit IRC20:08
dmsimardI put a database from https://review.opendev.org/#/c/659835/ up on the live demo, we now have labels https://api.demo.recordsansible.org/api/v1/labels22:14
dmsimardI need to figure out how to make the label field searchable22:20
dmsimardfound it \o/22:30

Generated by irclog2html.py 2.15.3 by Marius Gedminas - find it at mg.pov.lt!