)]}'
{"nagios/plugins/query_elasticsearch.py":[{"author":{"_account_id":33519,"name":"Tin Lam","email":"tinlam@outlook.com","username":"tlam"},"change_message_id":"968fd291c2441c5df4c1fed4242bdce2caf54d5f","unresolved":true,"context_lines":[{"line_number":224,"context_line":"        pprint(data)"},{"line_number":225,"context_line":""},{"line_number":226,"context_line":"    try:"},{"line_number":227,"context_line":"        cacert \u003d os.getenv(\u0027CA_CERT_PATH\u0027, \"\")"},{"line_number":228,"context_line":"        if args.usr and args.pwd:"},{"line_number":229,"context_line":"            if cacert:"},{"line_number":230,"context_line":"                response \u003d requests.post(url, data\u003djson.dumps(data), timeout\u003dargs.timeout,"}],"source_content_type":"text/x-python","patch_set":1,"id":"6c6811d7_4dcc6774","line":227,"range":{"start_line":227,"start_character":7,"end_line":227,"end_character":46},"updated":"2021-06-28 21:52:13.000000000","message":"can\u0027t this be just:\n\n   cacert \u003d os.getenv(\u0027CA_CERT_PATH\u0027, False)\n\nand then you don\u0027t need all the if-else dealing with cacert as verify\u003dFalse just ignores the certificate","commit_id":"41a6c6728d9ff4dcea1a2db1cdc3e0137ea4b4be"},{"author":{"_account_id":24780,"name":"Sangeet Gupta","email":"sg774j@att.com","username":"sgupta"},"change_message_id":"fc2ec969858d24f876c26fb78c5d3e77f7a445e0","unresolved":true,"context_lines":[{"line_number":224,"context_line":"        pprint(data)"},{"line_number":225,"context_line":""},{"line_number":226,"context_line":"    try:"},{"line_number":227,"context_line":"        cacert \u003d os.getenv(\u0027CA_CERT_PATH\u0027, \"\")"},{"line_number":228,"context_line":"        if args.usr and args.pwd:"},{"line_number":229,"context_line":"            if cacert:"},{"line_number":230,"context_line":"                response \u003d requests.post(url, data\u003djson.dumps(data), timeout\u003dargs.timeout,"}],"source_content_type":"text/x-python","patch_set":1,"id":"58462ee2_b990c2c7","line":227,"range":{"start_line":227,"start_character":7,"end_line":227,"end_character":46},"in_reply_to":"12ba09b2_6413c6da","updated":"2021-06-28 23:26:53.000000000","message":"But then if the TLS is not enabled on the server, then the cert verification will fail if we use default value of True. Did you mean os.getenv(\u0027CA_CERT_PATH\u0027, False)? If yes, then it is same as setting cacert to false if path is not provided. I really do not see much issue with the code if we leave it the way it is.","commit_id":"41a6c6728d9ff4dcea1a2db1cdc3e0137ea4b4be"},{"author":{"_account_id":18250,"name":"Roy Tang","email":"roy.s.tang@att.com","username":"rt7380"},"change_message_id":"ab342b1fb94aabc0dc87c3e109c177d05fc98235","unresolved":true,"context_lines":[{"line_number":224,"context_line":"        pprint(data)"},{"line_number":225,"context_line":""},{"line_number":226,"context_line":"    try:"},{"line_number":227,"context_line":"        cacert \u003d os.getenv(\u0027CA_CERT_PATH\u0027, \"\")"},{"line_number":228,"context_line":"        if args.usr and args.pwd:"},{"line_number":229,"context_line":"            if cacert:"},{"line_number":230,"context_line":"                response \u003d requests.post(url, data\u003djson.dumps(data), timeout\u003dargs.timeout,"}],"source_content_type":"text/x-python","patch_set":1,"id":"92b8f5aa_23c5bb74","line":227,"range":{"start_line":227,"start_character":7,"end_line":227,"end_character":46},"in_reply_to":"58462ee2_b990c2c7","updated":"2021-06-29 04:55:16.000000000","message":"Tin has a point, if we use os.getenv(\u0027CA_CERT_PATH\u0027, False) instead, then it will return either the path or False, and these are the only things we want to set verify to anyway, hence eliminating the need for the if/else block?  Please do try to set it to False and see what happens.","commit_id":"41a6c6728d9ff4dcea1a2db1cdc3e0137ea4b4be"},{"author":{"_account_id":24780,"name":"Sangeet Gupta","email":"sg774j@att.com","username":"sgupta"},"change_message_id":"13d1c48834add60d4737c1a6f614bb76ac5c393d","unresolved":true,"context_lines":[{"line_number":224,"context_line":"        pprint(data)"},{"line_number":225,"context_line":""},{"line_number":226,"context_line":"    try:"},{"line_number":227,"context_line":"        cacert \u003d os.getenv(\u0027CA_CERT_PATH\u0027, \"\")"},{"line_number":228,"context_line":"        if args.usr and args.pwd:"},{"line_number":229,"context_line":"            if cacert:"},{"line_number":230,"context_line":"                response \u003d requests.post(url, data\u003djson.dumps(data), timeout\u003dargs.timeout,"}],"source_content_type":"text/x-python","patch_set":1,"id":"ef5983fc_d04b22f3","line":227,"range":{"start_line":227,"start_character":7,"end_line":227,"end_character":46},"in_reply_to":"6c6811d7_4dcc6774","updated":"2021-06-28 22:03:44.000000000","message":"verify – (optional) Either a boolean, in which case it controls whether we verify the server’s TLS certificate, or a string, in which case it must be a path to a CA bundle to use. Defaults to True.\n\nDefault is True was little confusing. If verify is not supplied, then is it doing TLS check? I can try to set it to false and see what happens.","commit_id":"41a6c6728d9ff4dcea1a2db1cdc3e0137ea4b4be"},{"author":{"_account_id":33519,"name":"Tin Lam","email":"tinlam@outlook.com","username":"tlam"},"change_message_id":"ebbe80d5041d442246f15054e14aa6889efc204b","unresolved":true,"context_lines":[{"line_number":224,"context_line":"        pprint(data)"},{"line_number":225,"context_line":""},{"line_number":226,"context_line":"    try:"},{"line_number":227,"context_line":"        cacert \u003d os.getenv(\u0027CA_CERT_PATH\u0027, \"\")"},{"line_number":228,"context_line":"        if args.usr and args.pwd:"},{"line_number":229,"context_line":"            if cacert:"},{"line_number":230,"context_line":"                response \u003d requests.post(url, data\u003djson.dumps(data), timeout\u003dargs.timeout,"}],"source_content_type":"text/x-python","patch_set":1,"id":"12ba09b2_6413c6da","line":227,"range":{"start_line":227,"start_character":7,"end_line":227,"end_character":46},"in_reply_to":"ef5983fc_d04b22f3","updated":"2021-06-28 22:39:55.000000000","message":"Good point, perhaps it should be os.getenv(\u0027CA_CERT_PATH\u0027, True), but my original point is to avoid sprawling of the if-else to make it easier to understand the logic.","commit_id":"41a6c6728d9ff4dcea1a2db1cdc3e0137ea4b4be"}]}
