looker-open-source / looker_deployer

A tool to help deploy objects from one Looker instance to another
Apache License 2.0
56 stars 25 forks source link

KeyError:‘results’ in deploy_code file stopping deployment -> Fix to try-except block? #131

Closed brigitteq closed 1 year ago

brigitteq commented 1 year ago

@drstrangelooker I am getting a KeyError:‘results’ when trying to deploy hub code for just our QA stack.I’ve narrowed down the line of code to come from the deploy_code py file here (see pictured)

Can we submit a hotfix to update this line of code to skip this for QA via a try-except block instead? image

Also, can you tell me what “results” is supposed to be looking for? I think this will always error for QA but we don’t want it to stop our hub code deployment.

megfordpix commented 1 year ago

We are also seeing this issue. It looks like the response json is returning {'operations': [{'error': False}]} I am implementing a work-around for this for now because our code appears to be deploying successfully, and the response that you are checking for here https://github.com/looker-open-source/looker_deployer/blob/main/looker_deployer/commands/deploy_code.py#L85 isn't used anywhere else in the code.

brigitteq commented 1 year ago

@megfordpix @drstrangelooker This error is actually related to the latest looker release. It was only erroring on our QA stack before since our QA stack gets the latest release first.

I've updated what I know in the code to look for the api 4.0 where possible but still getting the above error. Any luck?

drstrangelooker commented 1 year ago

I'm changing this simply to

results = r.json()["operations"][0]

So that the message will have either the result or the error: "false"

megfordpix commented 1 year ago

@drstrangelooker if the result is error: "false" does that indicate that the code has not synced?

drstrangelooker commented 1 year ago

No. That indicates that there were no errors. The error state is False.

On Thu, Jul 6, 2023 at 7:14 PM megfordpix @.***> wrote:

@drstrangelooker https://github.com/drstrangelooker if the result is error: "false" does that indicate that the code has not synced?

— Reply to this email directly, view it on GitHub https://github.com/looker-open-source/looker_deployer/issues/131#issuecomment-1624188605, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACSDEEKSFUJMODHCE4K2LRDXO4FBRANCNFSM6AAAAAAZXJC4AU . You are receiving this because you were mentioned.Message ID: @.***>

megfordpix commented 1 year ago

@drstrangelooker Thanks! I figured, but just wanted to verify.