lordgamez commented on code in PR #1867:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1867#discussion_r1768744718
##########
docker/test/integration/cluster/checkers/ElasticSearchChecker.py:
##########
@@ -20,27 +20,30 @@ def __init__(self, container_communicator):
self.container_communicator = container_communicator
def is_elasticsearch_empty(self, container_name):
- (code, output) =
self.container_communicator.execute_command(container_name, ["curl", "-u",
"elastic:password", "-k", "-XGET", "https://localhost:9200/_search"])
+ (code, output) =
self.container_communicator.execute_command(container_name, ["curl", "-s",
"-u", "elastic:password", "-k", "-XGET", "https://localhost:9200/_search"])
return code == 0 and '"hits":[]' in output
def create_doc_elasticsearch(self, container_name, index_name, doc_id):
(code, output) =
self.container_communicator.execute_command(container_name, ["/bin/bash", "-c",
-
"curl -u elastic:password -k -XPUT https://localhost:9200/" + index_name
+ "/_doc/" + doc_id + " -H Content-Type:application/json
-d'{\"field1\":\"value1\"}'"])
+
"curl -s -u elastic:password -k -XPUT https://localhost:9200/" +
index_name + "/_doc/" + doc_id + " -H Content-Type:application/json
-d'{\"field1\":\"value1\"}'"])
return code == 0 and ('"_id":"' + doc_id + '"') in output
def check_elastic_field_value(self, container_name, index_name, doc_id,
field_name, field_value):
(code, output) =
self.container_communicator.execute_command(container_name, ["/bin/bash", "-c",
-
"curl -u elastic:password -k -XGET https://localhost:9200/" + index_name
+ "/_doc/" + doc_id])
+
"curl -s -u elastic:password -k -XGET https://localhost:9200/" +
index_name + "/_doc/" + doc_id])
return code == 0 and (field_name + '":"' + field_value) in output
def elastic_generate_apikey(self, elastic_container_name):
- (_, output) =
self.container_communicator.execute_command(elastic_container_name,
["/bin/bash", "-c",
-
"curl -u elastic:password -k -XPOST
https://localhost:9200/_security/api_key -H Content-Type:application/json
-d'{\"name\":\"my-api-key\",\"expiration\":\"1d\",\"role_descriptors\":{\"role-a\":
{\"cluster\": [\"all\"],\"index\": [{\"names\": [\"my_index\"],\"privileges\":
[\"all\"]}]}}}'"])
+ (code, output) =
self.container_communicator.execute_command(elastic_container_name,
["/bin/bash", "-c",
+
"curl -s -u elastic:password -k -XPOST
https://localhost:9200/_security/api_key -H Content-Type:application/json
-d'{\"name\":\"my-api-key\",\"expiration\":\"1d\",\"role_descriptors\":{\"role-a\":
{\"cluster\": [\"all\"],\"index\": [{\"names\": [\"my_index\"],\"privileges\":
[\"all\"]}]}}}'"])
+ if code != 0:
+ return None
output_lines = output.splitlines()
+ print(output_lines)
Review Comment:
Good catch I left that there by mistake when debugging. I don't think it's
needed there anymore, and if we want to log any debug messages that should be
done through the `logging` library.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]