)]}'
{"plugins/modules/host_aggregate.py":[{"author":{"_account_id":27900,"name":"Artem Goncharov","email":"artem.goncharov@gmail.com","username":"gtema"},"change_message_id":"c4b8eff0ce93d94dbbfd2b9085ae0d1194bfb47b","unresolved":true,"context_lines":[{"line_number":126,"context_line":"    if hosts is None:"},{"line_number":127,"context_line":"        return"},{"line_number":128,"context_line":""},{"line_number":129,"context_line":"    if aggregate.hosts is None:"},{"line_number":130,"context_line":"        aggregate.hosts \u003d []"},{"line_number":131,"context_line":""},{"line_number":132,"context_line":"    hosts_to_add \u003d set(hosts) - set(aggregate.hosts)"}],"source_content_type":"text/x-python","patch_set":1,"id":"79174215_c440002f","line":129,"updated":"2021-05-28 16:11:18.000000000","message":"maybe we should instead change default argument value?","commit_id":"27becdedb87ca285209e2bb64aa944c502dcc8b6"},{"author":{"_account_id":32755,"name":"Christian Rohmann","email":"christian.rohmann@inovex.de","username":"frittentheke"},"change_message_id":"0b369d909f1767798c18e36ed6fd6c050d32910e","unresolved":false,"context_lines":[{"line_number":126,"context_line":"    if hosts is None:"},{"line_number":127,"context_line":"        return"},{"line_number":128,"context_line":""},{"line_number":129,"context_line":"    if aggregate.hosts is None:"},{"line_number":130,"context_line":"        aggregate.hosts \u003d []"},{"line_number":131,"context_line":""},{"line_number":132,"context_line":"    hosts_to_add \u003d set(hosts) - set(aggregate.hosts)"}],"source_content_type":"text/x-python","patch_set":1,"id":"e451bb45_d11ba1ee","line":129,"in_reply_to":"743dde45_af7c7c1b","updated":"2021-06-01 08:45:11.000000000","message":"Done","commit_id":"27becdedb87ca285209e2bb64aa944c502dcc8b6"},{"author":{"_account_id":32755,"name":"Christian Rohmann","email":"christian.rohmann@inovex.de","username":"frittentheke"},"change_message_id":"52d584ec2a582d6d1a0f013e78ccb9ad33710f25","unresolved":true,"context_lines":[{"line_number":126,"context_line":"    if hosts is None:"},{"line_number":127,"context_line":"        return"},{"line_number":128,"context_line":""},{"line_number":129,"context_line":"    if aggregate.hosts is None:"},{"line_number":130,"context_line":"        aggregate.hosts \u003d []"},{"line_number":131,"context_line":""},{"line_number":132,"context_line":"    hosts_to_add \u003d set(hosts) - set(aggregate.hosts)"}],"source_content_type":"text/x-python","patch_set":1,"id":"743dde45_af7c7c1b","line":129,"in_reply_to":"79174215_c440002f","updated":"2021-05-28 16:48:28.000000000","message":"Could you elaborate a bit more?\n\nDo you mean where create_aggregate is called to ensure the aggregate does have a hosts parameter?","commit_id":"27becdedb87ca285209e2bb64aa944c502dcc8b6"},{"author":{"_account_id":10969,"name":"Shnaidman Sagi (Sergey)","display_name":"Shnaidman Sagi","email":"sshnaidm@redhat.com","username":"sergsh"},"change_message_id":"b309fec91ba838b813768ee9a1ecb41bb9108d10","unresolved":true,"context_lines":[{"line_number":126,"context_line":"    if hosts is None:"},{"line_number":127,"context_line":"        return"},{"line_number":128,"context_line":""},{"line_number":129,"context_line":"    hosts_to_add \u003d set(hosts) - set(aggregate.get(\"hosts\", []))"},{"line_number":130,"context_line":"    for i in hosts_to_add:"},{"line_number":131,"context_line":"        cloud.add_host_to_aggregate(aggregate.id, i)"},{"line_number":132,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"194ab710_709995c4","line":129,"range":{"start_line":129,"start_character":32,"end_line":129,"end_character":62},"updated":"2021-06-02 13:06:13.000000000","message":"iirc:\n  \u003e\u003e aggregate \u003d {\"hosts\": None}\n  \u003e\u003e print(aggregate.get(\"hosts\", []))\n  \u003e\u003e None\n\nIt won\u0027t work that way.\nMaybe to change to:\n  hosts_to_add \u003d set(hosts) - set(aggregate.get(\"hosts\") or [])","commit_id":"47708e0172d19786e7d2429e9a97384b51e7aa37"},{"author":{"_account_id":32755,"name":"Christian Rohmann","email":"christian.rohmann@inovex.de","username":"frittentheke"},"change_message_id":"c2033373caafa49a4e8c993d88d22c05f4001470","unresolved":true,"context_lines":[{"line_number":126,"context_line":"    if hosts is None:"},{"line_number":127,"context_line":"        return"},{"line_number":128,"context_line":""},{"line_number":129,"context_line":"    hosts_to_add \u003d set(hosts) - set(aggregate.get(\"hosts\", []))"},{"line_number":130,"context_line":"    for i in hosts_to_add:"},{"line_number":131,"context_line":"        cloud.add_host_to_aggregate(aggregate.id, i)"},{"line_number":132,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"34de9ffb_b02c097c","line":129,"range":{"start_line":129,"start_character":32,"end_line":129,"end_character":62},"in_reply_to":"194ab710_709995c4","updated":"2021-06-02 13:33:32.000000000","message":"Thanks for reviewing my patch!\n\nYou example the aggregate does have a key \"hosts\" just with value None - that is just not the issue / bug I am trying to solve....\n\nIn the case of a newly created aggregate there simply is no key \"hosts\" (create_aggregate does not return it), and set() does require an iterable object, thus the error \"TypeError: \u0027NoneType\u0027 object is not iterable\" (https://storyboard.openstack.org/#!/story/2008925)\n\n\n  \u003e\u003e aggregate \u003d {\"id\": \"idofmyaggregate\", \"name\":\"nameofmyaggregate\"}\n  \u003e\u003e print (aggregate)\n  {\u0027id\u0027: \u0027idofmyaggregate\u0027, \u0027name\u0027: \u0027nameofmyaggregate\u0027}\n\n\n1) object.get() happily does return an empty array as \u0027default\u0027:\n\n  \u003e\u003e print (aggregate.get(\"hosts\"))\n  None\n  \u003e\u003e print (aggregate.get(\"hosts\", []))\n  []\n\n\n2) Receiving an empty array set will then produce an empty set:\n\n \u003e\u003e print (set(aggregate.get(\"hosts\")))\n  Traceback (most recent call last):\n    File \"\u003cstdin\u003e\", line 1, in \u003cmodule\u003e\n  TypeError: \u0027NoneType\u0027 object is not iterable\n\n \u003e\u003e print (set(aggregate.get(\"hosts\", [])))\n  set()\n\n\n\nIn any case, your suggestion would also allow for the key \"hosts\" to exist, but being of value None. This can either be considered to be more flexible in accepting input conditions, but at the same time is also less strict on allowed conditions (\"hosts\" key existing and not being an (empty) array at all).\n\nYou call, I gladly change this to your suggestion as it covers there initial bug as well.","commit_id":"47708e0172d19786e7d2429e9a97384b51e7aa37"},{"author":{"_account_id":10969,"name":"Shnaidman Sagi (Sergey)","display_name":"Shnaidman Sagi","email":"sshnaidm@redhat.com","username":"sergsh"},"change_message_id":"b51a2f6518b01e47d60d412acc31a4c8e9992df4","unresolved":true,"context_lines":[{"line_number":126,"context_line":"    if hosts is None:"},{"line_number":127,"context_line":"        return"},{"line_number":128,"context_line":""},{"line_number":129,"context_line":"    hosts_to_add \u003d set(hosts) - set(aggregate.get(\"hosts\", []))"},{"line_number":130,"context_line":"    for i in hosts_to_add:"},{"line_number":131,"context_line":"        cloud.add_host_to_aggregate(aggregate.id, i)"},{"line_number":132,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"33b9a7f3_db067a4b","line":129,"range":{"start_line":129,"start_character":32,"end_line":129,"end_character":62},"in_reply_to":"34de9ffb_b02c097c","updated":"2021-06-02 14:13:23.000000000","message":"Oh, I see what you mean, I thought it will be a \"host\" key always. In case it won\u0027t, your code is totally fine. Thanks for explanation.","commit_id":"47708e0172d19786e7d2429e9a97384b51e7aa37"},{"author":{"_account_id":10969,"name":"Shnaidman Sagi (Sergey)","display_name":"Shnaidman Sagi","email":"sshnaidm@redhat.com","username":"sergsh"},"change_message_id":"b309fec91ba838b813768ee9a1ecb41bb9108d10","unresolved":true,"context_lines":[{"line_number":133,"context_line":"    if not purge_hosts:"},{"line_number":134,"context_line":"        return"},{"line_number":135,"context_line":""},{"line_number":136,"context_line":"    hosts_to_remove \u003d set(aggregate.get(\"hosts\", [])) - set(hosts)"},{"line_number":137,"context_line":"    for i in hosts_to_remove:"},{"line_number":138,"context_line":"        cloud.remove_host_from_aggregate(aggregate.id, i)"},{"line_number":139,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"bd89315e_fc5b206b","line":136,"range":{"start_line":136,"start_character":39,"end_line":136,"end_character":52},"updated":"2021-06-02 13:06:13.000000000","message":"ditto","commit_id":"47708e0172d19786e7d2429e9a97384b51e7aa37"},{"author":{"_account_id":32755,"name":"Christian Rohmann","email":"christian.rohmann@inovex.de","username":"frittentheke"},"change_message_id":"c2033373caafa49a4e8c993d88d22c05f4001470","unresolved":false,"context_lines":[{"line_number":133,"context_line":"    if not purge_hosts:"},{"line_number":134,"context_line":"        return"},{"line_number":135,"context_line":""},{"line_number":136,"context_line":"    hosts_to_remove \u003d set(aggregate.get(\"hosts\", [])) - set(hosts)"},{"line_number":137,"context_line":"    for i in hosts_to_remove:"},{"line_number":138,"context_line":"        cloud.remove_host_from_aggregate(aggregate.id, i)"},{"line_number":139,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"040f3cc1_3e486089","line":136,"range":{"start_line":136,"start_character":39,"end_line":136,"end_character":52},"in_reply_to":"bd89315e_fc5b206b","updated":"2021-06-02 13:33:32.000000000","message":"Done","commit_id":"47708e0172d19786e7d2429e9a97384b51e7aa37"}]}
