-
Notifications
You must be signed in to change notification settings - Fork 66
Conversation
|
||
r = go "#{@protocol}://#{@hostname}:#{@qconsole_port}/v1/eval", "post", headers, params | ||
|
||
raise ExitException.new(JSON.pretty_generate(JSON.parse(r.body))) if r.body.match(/\{"error"/) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you verify that this line works as intended? I'm ignorant of the output of /v1/eval.
I'm amazed, is that all? I'm kinda missing context like db or app-server selection. We have a lot of code that picks targets explicitly. Does that still work? I guess we could run self-test to see what comes out of that, but also thinking of app_specific, in which exec of queries is used a lot.. |
def parse_multipart(body)
if (body.match("^\r\n--"))
# Extract the delimiter from the response.
delimiter = body.split("\r\n")[1].strip
parts = body.split(delimiter)
# The first part will always be an empty string. Just remove it.
parts.shift
# The last part will be the "--". Just remove it.
parts.pop
# Get rid of part headers
parts = parts.map{ |part| part.split("\r\n\r\n")[1].strip }
# Return all parts as one long string, like we were used to.
return parts.join("\n")
else
return body
end
end
def parse_body(body)
parse_multipart(parse_json(body))
end And then replace references to This should be enough to at least get self-test working. Worked for me locally. |
Still want to look a bit closer to that context stuff. Stay tuned.. |
I searched through the Roxy code, and the app_name parameter is not used internally. db_name is though, so we need to leverage the database param of /v1/eval.. |
I filed an RFE to request server context support for /v1/eval. In meantime, I suggest we add the following to the top of if properties[:app_name] != nil
raise ExitException.new("Executing queries with an app_name (currently) not supported with ML8+")
end And for database support we only need this between if properties[:db_name] != nil
params[:database] = properties[:db_name]
end |
@dmcassel Did you incorporate my suggestions yet? |
Okay, I made @grtjn's suggested updates. self-test on ml7 ran successfully, passed my testing on ml8 and ml9. |
Commits look clean, I'll try to give it a spin asap.. |
Yep, self-test runs clean at my end too.. Just wondering, we may wanna apply parse_body to the result of eval itself as well, otherwise this might fail?
(this line exists in execute_query_5, execute_query_7, and execute_query_8) |
@grtjn I set up bootstrap to fail a couple different ways, but saw no change when I modified or even removed that line from execute_query_8. The errors were displayed correctly. Not sure what kind of error gets to that line, but it doesn't seem to need the change. |
good enough for me.. |
let's wait no longer, merging now.. |
Thanks @grtjn! |
Addresses #612 and #596. Uses /v1/eval for MarkLogic 8 and MarkLogic 9.