)]}'
{"plugins/modules/baremetal_node_vifs.py":[{"author":{"_account_id":11655,"name":"Julia Kreger","email":"juliaashleykreger@gmail.com","username":"jkreger","status":"Flying to the moon with a Jetpack!"},"change_message_id":"090d643fbbde300d13735441d4c79d8136d7e058","unresolved":true,"context_lines":[{"line_number":2,"context_line":"---"},{"line_number":3,"context_line":"module: baremetal_node_vifs"},{"line_number":4,"context_line":"short_description: Attach and detach a virtual interface to or from a baremetal node."},{"line_number":5,"context_line":"author: OpenStack Ansible SIG"},{"line_number":6,"context_line":"description:"},{"line_number":7,"context_line":"    - Attach and detach a VIF to or from a baremetal node in Ironic."},{"line_number":8,"context_line":"options:"}],"source_content_type":"text/x-python","patch_set":2,"id":"8a095f8a_c9f2a2d2","line":5,"updated":"2021-02-09 16:58:14.000000000","message":"So you can put your name here :)","commit_id":"621370ba47c78bb39a9ec3b7eb277f108b293ed1"},{"author":{"_account_id":11655,"name":"Julia Kreger","email":"juliaashleykreger@gmail.com","username":"jkreger","status":"Flying to the moon with a Jetpack!"},"change_message_id":"a112e548ef6bd264f7afc18cf607317a2be3904b","unresolved":true,"context_lines":[{"line_number":44,"context_line":"    uuid: \"d44666e1-35b3-4f6b-acb0-88ab7052da69\""},{"line_number":45,"context_line":"    vif: {"},{"line_number":46,"context_line":"      vif_id: \"1974dcfa-836f-41b2-b541-686c100900e5\""},{"line_number":47,"context_line":"    }"},{"line_number":48,"context_line":"\u0027\u0027\u0027"},{"line_number":49,"context_line":""},{"line_number":50,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"4a6c9378_84fa6efe","line":47,"updated":"2021-02-09 16:40:13.000000000","message":"- openstack.cloud.baremetal_node_vifs:\n    cloud: \"openstack\"\n    uuid: \"d44666e1-35b3-4f6b-acb0-88ab7052da69\"\n    vifs:\n      - 1974dcfa-836f-41b2-b541-686c100900e5\n      - 2234dcfb-436f-31b1-b547-686c122911e7\n    state: present\n\nOr maybe:\n- openstack.cloud.baremetal_node_vifs:\n    cloud: \"openstack\"\n    uuid: \"d44666e1-35b3-4f6b-acb0-88ab7052da69\"\n    vifs:\n      - 1974dcfa-836f-41b2-b541-686c100900e5\n      - 2234dcfb-436f-31b1-b547-686c122911e7\n    state: absent\n\nor maybe even this to delete all of the vifs.\n\n- openstack.cloud.baremetal_node_vifs:\n    cloud: \"openstack\"\n    uuid: \"d44666e1-35b3-4f6b-acb0-88ab7052da69\"\n    state: absent","commit_id":"621370ba47c78bb39a9ec3b7eb277f108b293ed1"},{"author":{"_account_id":11655,"name":"Julia Kreger","email":"juliaashleykreger@gmail.com","username":"jkreger","status":"Flying to the moon with a Jetpack!"},"change_message_id":"5595fd561ed9be167928668d562008f2fe8d9b0f","unresolved":true,"context_lines":[{"line_number":44,"context_line":"    uuid: \"d44666e1-35b3-4f6b-acb0-88ab7052da69\""},{"line_number":45,"context_line":"    vif: {"},{"line_number":46,"context_line":"      vif_id: \"1974dcfa-836f-41b2-b541-686c100900e5\""},{"line_number":47,"context_line":"    }"},{"line_number":48,"context_line":"\u0027\u0027\u0027"},{"line_number":49,"context_line":""},{"line_number":50,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"65a1fdd2_b87f5d41","line":47,"in_reply_to":"4a6c9378_84fa6efe","updated":"2021-02-09 16:57:33.000000000","message":"module.params[\u0027vifs\u0027][0] \u003c-- should be the first element\nmodule.params[\u0027vifs\u0027][1] \u003c-- should be the second element\n\n\nSo with the above example, the second element should have value \"2234dcfb-436f-31b1-b547-686c122911e7\"\n\nSo you can also find out if there are any vifs defined by basing logic with\n\nlen(module.params[\u0027vifs\u0027]) which in the first two examples in my prior comment should return an integer of 2. For my 3rd example, the length should be 0.","commit_id":"621370ba47c78bb39a9ec3b7eb277f108b293ed1"},{"author":{"_account_id":11655,"name":"Julia Kreger","email":"juliaashleykreger@gmail.com","username":"jkreger","status":"Flying to the moon with a Jetpack!"},"change_message_id":"0cdd37da33b353bdfe33205e0ff5c50c46ca6f67","unresolved":true,"context_lines":[{"line_number":126,"context_line":""},{"line_number":127,"context_line":"def main():"},{"line_number":128,"context_line":"    argument_spec \u003d ironic_argument_spec("},{"line_number":129,"context_line":"        uuid\u003ddict(required\u003dFalse),"},{"line_number":130,"context_line":"        name\u003ddict(required\u003dFalse),"},{"line_number":131,"context_line":"        vifs\u003ddict(type\u003d\u0027list\u0027, required\u003dFalse, default\u003d[], elements\u003d\u0027str\u0027),"},{"line_number":132,"context_line":"        vif\u003ddict(type\u003d\u0027dict\u0027, required\u003dFalse),"}],"source_content_type":"text/x-python","patch_set":2,"id":"1c87c1b6_96972c43","line":129,"updated":"2021-02-09 16:49:43.000000000","message":"We\u0027re missing a state flag. \"absent\", \"present\" are the two state indicators which can help guide the module if it should add/remove vifs.","commit_id":"621370ba47c78bb39a9ec3b7eb277f108b293ed1"},{"author":{"_account_id":11655,"name":"Julia Kreger","email":"juliaashleykreger@gmail.com","username":"jkreger","status":"Flying to the moon with a Jetpack!"},"change_message_id":"0cdd37da33b353bdfe33205e0ff5c50c46ca6f67","unresolved":true,"context_lines":[{"line_number":129,"context_line":"        uuid\u003ddict(required\u003dFalse),"},{"line_number":130,"context_line":"        name\u003ddict(required\u003dFalse),"},{"line_number":131,"context_line":"        vifs\u003ddict(type\u003d\u0027list\u0027, required\u003dFalse, default\u003d[], elements\u003d\u0027str\u0027),"},{"line_number":132,"context_line":"        vif\u003ddict(type\u003d\u0027dict\u0027, required\u003dFalse),"},{"line_number":133,"context_line":"    )"},{"line_number":134,"context_line":"    module_kwargs \u003d openstack_module_kwargs()"},{"line_number":135,"context_line":"    module \u003d IronicModule(argument_spec, **module_kwargs)"}],"source_content_type":"text/x-python","patch_set":2,"id":"fc2a1abe_64a724c1","line":132,"range":{"start_line":132,"start_character":0,"end_line":132,"end_character":46},"updated":"2021-02-09 16:49:43.000000000","message":"I think this is redundant and not needed, if your using vifs as the primary indicator.","commit_id":"621370ba47c78bb39a9ec3b7eb277f108b293ed1"},{"author":{"_account_id":11655,"name":"Julia Kreger","email":"juliaashleykreger@gmail.com","username":"jkreger","status":"Flying to the moon with a Jetpack!"},"change_message_id":"0cdd37da33b353bdfe33205e0ff5c50c46ca6f67","unresolved":true,"context_lines":[{"line_number":166,"context_line":""},{"line_number":167,"context_line":"    except sdk.exceptions.OpenStackCloudException as e:"},{"line_number":168,"context_line":"        module.fail_json(msg\u003dstr(e))"},{"line_number":169,"context_line":""},{"line_number":170,"context_line":""},{"line_number":171,"context_line":"if __name__ \u003d\u003d \"__main__\":"},{"line_number":172,"context_line":"    main()"}],"source_content_type":"text/x-python","patch_set":2,"id":"38f51426_1a878faf","line":169,"updated":"2021-02-09 16:49:43.000000000","message":"Your missing a \"general\" exit_json command that uses the changed variable to report success and if anything changed. Adding a exit_json at the end of the method will resolve the pep8 error as well.","commit_id":"621370ba47c78bb39a9ec3b7eb277f108b293ed1"},{"author":{"_account_id":11655,"name":"Julia Kreger","email":"juliaashleykreger@gmail.com","username":"jkreger","status":"Flying to the moon with a Jetpack!"},"change_message_id":"f689f3f84a74b11629ffcadc806dde3d0685d90c","unresolved":true,"context_lines":[{"line_number":49,"context_line":"    cloud: \"openstack\""},{"line_number":50,"context_line":"    uuid: \"d44666e1-35b3-4f6b-acb0-88ab7052da69\""},{"line_number":51,"context_line":"    vifs:"},{"line_number":52,"context_line":"      - 1974dcfa-836f-41b2-b541-686c100900e5"},{"line_number":53,"context_line":"    state: present"},{"line_number":54,"context_line":"\u0027\u0027\u0027"},{"line_number":55,"context_line":""}],"source_content_type":"text/x-python","patch_set":6,"id":"0555a372_a1096f14","line":52,"updated":"2021-02-11 16:41:10.000000000","message":"This would make the element a string, and for what it is worth, I think you do need to put quotation marks around UUID values. I think the the yaml parser thinks it is a number which can cause failures.\n\nAlso, looking at the this it is a string which does not match the module paramters.","commit_id":"6505e8175c32b65d7c8c73a960c9cd3909401185"},{"author":{"_account_id":11655,"name":"Julia Kreger","email":"juliaashleykreger@gmail.com","username":"jkreger","status":"Flying to the moon with a Jetpack!"},"change_message_id":"f689f3f84a74b11629ffcadc806dde3d0685d90c","unresolved":true,"context_lines":[{"line_number":94,"context_line":"        vifs_params \u003d module.params[\u0027vifs\u0027]"},{"line_number":95,"context_line":"        vif_id \u003d vifs_params[len(vifs_params) - 1]"},{"line_number":96,"context_line":"        if vif_id is not None:"},{"line_number":97,"context_line":"            cloud.baremetal.attach_vif_to_node("},{"line_number":98,"context_line":"                node[\u0027uuid\u0027],"},{"line_number":99,"context_line":"                vif_id,"},{"line_number":100,"context_line":"                retry_on_conflict\u003dTrue"}],"source_content_type":"text/x-python","patch_set":6,"id":"34ded4bd_98d21055","line":97,"updated":"2021-02-11 16:41:10.000000000","message":"Maybe instead of just trying the last element, but iterate through all of the list and attempt to attach them.\n\nThe other option is ask the API for a list and compare, either way is fine, but I think the first is likely a little more pythonic.","commit_id":"6505e8175c32b65d7c8c73a960c9cd3909401185"},{"author":{"_account_id":11655,"name":"Julia Kreger","email":"juliaashleykreger@gmail.com","username":"jkreger","status":"Flying to the moon with a Jetpack!"},"change_message_id":"91b62d1813b0fb18411b47be2b7c700341045924","unresolved":true,"context_lines":[{"line_number":104,"context_line":""},{"line_number":105,"context_line":""},{"line_number":106,"context_line":"def _detach_vif_from_node(module, cloud, node):"},{"line_number":107,"context_line":"    if _is_true("},{"line_number":108,"context_line":"        module.params[\u0027state\u0027]"},{"line_number":109,"context_line":"        and module.params[\u0027vifs\u0027]"},{"line_number":110,"context_line":"    ):"}],"source_content_type":"text/x-python","patch_set":6,"id":"10bd47cb_94331659","line":107,"range":{"start_line":107,"start_character":7,"end_line":107,"end_character":16},"updated":"2021-02-11 17:07:06.000000000","message":"Make this a _is_false check as it will match on \"absent\"","commit_id":"6505e8175c32b65d7c8c73a960c9cd3909401185"},{"author":{"_account_id":11655,"name":"Julia Kreger","email":"juliaashleykreger@gmail.com","username":"jkreger","status":"Flying to the moon with a Jetpack!"},"change_message_id":"f689f3f84a74b11629ffcadc806dde3d0685d90c","unresolved":true,"context_lines":[{"line_number":123,"context_line":"def _list_node_vifs(module, cloud, node):"},{"line_number":124,"context_line":"    if _is_true(module.params[\u0027vifs\u0027]):"},{"line_number":125,"context_line":"        result \u003d cloud.baremetal.list_node_vifs(node[\u0027uuid\u0027])"},{"line_number":126,"context_line":"        module.exit_json(result)"},{"line_number":127,"context_line":""},{"line_number":128,"context_line":""},{"line_number":129,"context_line":"def main():"}],"source_content_type":"text/x-python","patch_set":6,"id":"f84dff82_4a084a0e","line":126,"updated":"2021-02-11 16:41:10.000000000","message":"Oh! I see your exiting json here with result. Could you double check that your returning the list properly so it becomes facts about the node that a user can collect and then use to make decisions or future actions.\n\nhttps://docs.ansible.com/ansible/latest/reference_appendices/common_return_values.html#ansible-facts","commit_id":"6505e8175c32b65d7c8c73a960c9cd3909401185"},{"author":{"_account_id":11655,"name":"Julia Kreger","email":"juliaashleykreger@gmail.com","username":"jkreger","status":"Flying to the moon with a Jetpack!"},"change_message_id":"f689f3f84a74b11629ffcadc806dde3d0685d90c","unresolved":true,"context_lines":[{"line_number":130,"context_line":"    argument_spec \u003d ironic_argument_spec("},{"line_number":131,"context_line":"        uuid\u003ddict(required\u003dFalse),"},{"line_number":132,"context_line":"        name\u003ddict(required\u003dFalse),"},{"line_number":133,"context_line":"        vifs\u003ddict(type\u003d\u0027list\u0027, required\u003dFalse, default\u003d[], elements\u003d\u0027dict\u0027),"},{"line_number":134,"context_line":"        state\u003ddict(required\u003dFalse, default\u003d\u0027present\u0027),"},{"line_number":135,"context_line":"    )"},{"line_number":136,"context_line":"    module_kwargs \u003d openstack_module_kwargs()"}],"source_content_type":"text/x-python","patch_set":6,"id":"a8d23a29_438fe7c4","line":133,"range":{"start_line":133,"start_character":59,"end_line":133,"end_character":74},"updated":"2021-02-11 16:41:10.000000000","message":"I believe the elements are str or strings. 😊","commit_id":"6505e8175c32b65d7c8c73a960c9cd3909401185"},{"author":{"_account_id":11655,"name":"Julia Kreger","email":"juliaashleykreger@gmail.com","username":"jkreger","status":"Flying to the moon with a Jetpack!"},"change_message_id":"f689f3f84a74b11629ffcadc806dde3d0685d90c","unresolved":true,"context_lines":[{"line_number":164,"context_line":"            changed \u003d True"},{"line_number":165,"context_line":"            node \u003d cloud.get_machine(node_id)"},{"line_number":166,"context_line":""},{"line_number":167,"context_line":"        _list_node_vifs(module, cloud, node)"},{"line_number":168,"context_line":""},{"line_number":169,"context_line":"        module.exit_json(changed\u003dchanged, msg\u003d\u0027success\u0027)"},{"line_number":170,"context_line":""}],"source_content_type":"text/x-python","patch_set":6,"id":"c5fa82c2_3bad4dbb","line":167,"updated":"2021-02-11 16:41:10.000000000","message":"So the user is not going to see this data, so maybe gather the list and return \"attached_vifs\" as a fact using exit_json?","commit_id":"6505e8175c32b65d7c8c73a960c9cd3909401185"},{"author":{"_account_id":11655,"name":"Julia Kreger","email":"juliaashleykreger@gmail.com","username":"jkreger","status":"Flying to the moon with a Jetpack!"},"change_message_id":"0ececbce94eb9abff264594bd065f03a713d8c75","unresolved":true,"context_lines":[{"line_number":89,"context_line":"def _attach_vif_to_node(module, cloud, node):"},{"line_number":90,"context_line":"    if _is_true("},{"line_number":91,"context_line":"        module.params[\u0027state\u0027]"},{"line_number":92,"context_line":"        and module.params[\u0027vifs\u0027]"},{"line_number":93,"context_line":"    ):"},{"line_number":94,"context_line":"        vifs_params \u003d module.params[\u0027vifs\u0027]"},{"line_number":95,"context_line":"        if len(vifs_params) !\u003d 0:"}],"source_content_type":"text/x-python","patch_set":10,"id":"4ab30b8a_07d716b1","line":92,"range":{"start_line":92,"start_character":5,"end_line":92,"end_character":33},"updated":"2021-02-16 16:26:41.000000000","message":"So, this is not going to behave as expected.\n\nIn essence what is happening, \"string\" and \"string\" \u003d\u003d true. It will always be true here. I think you want:\n\n if _is_true(module.params[\u0027state\u0027]) and mdoule.params[\u0027vifs\u0027]:","commit_id":"c666bec799f9bf04dd041f0b77148579be8a5dd9"},{"author":{"_account_id":11655,"name":"Julia Kreger","email":"juliaashleykreger@gmail.com","username":"jkreger","status":"Flying to the moon with a Jetpack!"},"change_message_id":"0ececbce94eb9abff264594bd065f03a713d8c75","unresolved":true,"context_lines":[{"line_number":107,"context_line":""},{"line_number":108,"context_line":"def _detach_vif_from_node(module, cloud, node):"},{"line_number":109,"context_line":"    if ("},{"line_number":110,"context_line":"        _is_true(module.params[\u0027vifs\u0027])"},{"line_number":111,"context_line":"        and _is_false(module.params[\u0027state\u0027])"},{"line_number":112,"context_line":"    ):"},{"line_number":113,"context_line":"        vifs_params \u003d module.params[\u0027vifs\u0027]"}],"source_content_type":"text/x-python","patch_set":10,"id":"2d488608_cea48754","line":110,"range":{"start_line":110,"start_character":9,"end_line":110,"end_character":39},"updated":"2021-02-16 16:26:41.000000000","message":"I\u0027m not sure what your gaining here with _is_true. I\u0027m not sure it would ever succeed. Have you tried pasting the _is_true method in this file into your python editor and trying to use the method with an empty list?","commit_id":"c666bec799f9bf04dd041f0b77148579be8a5dd9"},{"author":{"_account_id":11655,"name":"Julia Kreger","email":"juliaashleykreger@gmail.com","username":"jkreger","status":"Flying to the moon with a Jetpack!"},"change_message_id":"c7574ed9425fbe30d4c7b20ab4b1a883acc490b2","unresolved":true,"context_lines":[{"line_number":1,"context_line":"DOCUMENTATION \u003d \u0027\u0027\u0027"},{"line_number":2,"context_line":"---"},{"line_number":3,"context_line":"module: baremetal_node_vifs"},{"line_number":4,"context_line":"short_description: Attach and detach a VIF to or from a baremetal node."}],"source_content_type":"text/x-python","patch_set":13,"id":"bef9203f_e9e8c892","line":1,"updated":"2021-02-17 15:53:48.000000000","message":"FYI, the linter has identified six issues to be resolved:\n\n 2021-02-17 12:11:36.980980 | ubuntu-bionic | ERROR: Found 6 validate-modules issue(s) which need to be resolved:\n2021-02-17 12:11:36.981131 | ubuntu-bionic | ERROR: plugins/modules/baremetal_node_vifs.py:0:0: doc-missing-type: Argument \u0027ironic_url\u0027 in argument_spec uses default type (\u0027str\u0027) but documentation doesn\u0027t define type\n2021-02-17 12:11:36.981195 | ubuntu-bionic | ERROR: plugins/modules/baremetal_node_vifs.py:0:0: doc-missing-type: Argument \u0027state\u0027 in argument_spec uses default type (\u0027str\u0027) but documentation doesn\u0027t define type\n2021-02-17 12:11:36.981254 | ubuntu-bionic | ERROR: plugins/modules/baremetal_node_vifs.py:0:0: invalid-documentation: DOCUMENTATION.author: Invalid author for dictionary value @ data[\u0027author\u0027]. Got \u0027Tosin Farai\u0027\n2021-02-17 12:11:36.981311 | ubuntu-bionic | ERROR: plugins/modules/baremetal_node_vifs.py:0:0: missing-gplv3-license: GPLv3 license header not found in the first 20 lines of the module\n2021-02-17 12:11:36.981371 | ubuntu-bionic | ERROR: plugins/modules/baremetal_node_vifs.py:0:0: missing-python-interpreter: Interpreter line is not \"#!/usr/bin/python\"\n2021-02-17 12:11:36.981431 | ubuntu-bionic | ERROR: plugins/modules/baremetal_node_vifs.py:0:0: undocumented-parameter: Argument \u0027ironic_url\u0027 is listed in the argument_spec, but not documented in the module documentation","commit_id":"4573f587be1dd4f2fd3d3e57b0dd3abb8f83a59d"},{"author":{"_account_id":11655,"name":"Julia Kreger","email":"juliaashleykreger@gmail.com","username":"jkreger","status":"Flying to the moon with a Jetpack!"},"change_message_id":"c7574ed9425fbe30d4c7b20ab4b1a883acc490b2","unresolved":true,"context_lines":[{"line_number":89,"context_line":"def _attach_vif_to_node(module, cloud, node):"},{"line_number":90,"context_line":"    if ("},{"line_number":91,"context_line":"        _is_true(module.params[\u0027state\u0027])"},{"line_number":92,"context_line":"        and len(module.params[\u0027vifs\u0027]) !\u003d 0"},{"line_number":93,"context_line":"    ):"},{"line_number":94,"context_line":"        vifs_params \u003d module.params[\u0027vifs\u0027]"},{"line_number":95,"context_line":"        for vif_id in vifs_params:"}],"source_content_type":"text/x-python","patch_set":13,"id":"65cfe052_d0304820","line":92,"range":{"start_line":92,"start_character":12,"end_line":92,"end_character":15},"updated":"2021-02-17 15:53:48.000000000","message":"Nit: I\u0027d remove len() from this.","commit_id":"4573f587be1dd4f2fd3d3e57b0dd3abb8f83a59d"},{"author":{"_account_id":11655,"name":"Julia Kreger","email":"juliaashleykreger@gmail.com","username":"jkreger","status":"Flying to the moon with a Jetpack!"},"change_message_id":"c7574ed9425fbe30d4c7b20ab4b1a883acc490b2","unresolved":true,"context_lines":[{"line_number":89,"context_line":"def _attach_vif_to_node(module, cloud, node):"},{"line_number":90,"context_line":"    if ("},{"line_number":91,"context_line":"        _is_true(module.params[\u0027state\u0027])"},{"line_number":92,"context_line":"        and len(module.params[\u0027vifs\u0027]) !\u003d 0"},{"line_number":93,"context_line":"    ):"},{"line_number":94,"context_line":"        vifs_params \u003d module.params[\u0027vifs\u0027]"},{"line_number":95,"context_line":"        for vif_id in vifs_params:"}],"source_content_type":"text/x-python","patch_set":13,"id":"0b6d211e_e3adc52e","line":92,"range":{"start_line":92,"start_character":38,"end_line":92,"end_character":43},"updated":"2021-02-17 15:53:48.000000000","message":"nit: I believe !\u003d0 is redundant","commit_id":"4573f587be1dd4f2fd3d3e57b0dd3abb8f83a59d"}]}
