Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Steampipe should return file not found as error when the input file does not exist. Closes #1752 #3767

Conversation

pskrbasu
Copy link
Contributor

@pskrbasu pskrbasu commented Aug 24, 2023

  • file not found
    Screenshot 2023-08-25 at 2 29 56 PM

  • empty file
    Screenshot 2023-08-25 at 4 35 24 PM

  • query resource not found in mod
    Screenshot 2023-08-25 at 4 36 44 PM

  • cant open file
    Screenshot 2023-08-25 at 5 56 53 PM

@pskrbasu pskrbasu added the bug Something isn't working label Aug 24, 2023
@pskrbasu pskrbasu self-assigned this Aug 24, 2023
@pskrbasu pskrbasu changed the title Steampipe should return file not found as error when the input filename is not found. Closes #1752 Steampipe should return file not found as error when the input file does not exist. Closes #1752 Aug 24, 2023
@pskrbasu pskrbasu force-pushed the 1752-running-steampipe-query-file_not_foundsql-should-return-a-file-not-found-error branch from 3f2aa99 to d811405 Compare August 25, 2023 10:19
Copy link
Contributor

@kaidaguerre kaidaguerre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we have screenshots of the various errors

if err != nil {
return nil, nil, fmt.Errorf("error opening file '%s': %s", sqlString, err.Error())
}
fileQuery, fileExists, err := w.getQueryFromFile(filePath)
if fileExists {
if err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move error check before if fileExists

// (just return the empty query - it will be filtered above)
}
return fileQuery, nil, nil
}
// sqlString is not a file name that exists
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// sqlString is not a file name that exists => // the argument cannot be resolved as an existing file

@kaidaguerre kaidaguerre merged commit 06860e5 into v0.20.x Aug 25, 2023
48 checks passed
@kaidaguerre kaidaguerre deleted the 1752-running-steampipe-query-file_not_foundsql-should-return-a-file-not-found-error branch August 25, 2023 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Running 'steampipe query file_not_found.sql' should return a file not found error
2 participants