Skip to content

[229] Fix issue with --version option - #256

Merged
borland667 merged 1 commit into
masterfrom
229-fix-issue-with-version
Apr 18, 2024
Merged

borland667 merged 1 commit into
masterfrom
229-fix-issue-with-version

Conversation

@borland667

@borland667 borland667 commented Mar 19, 2024 •

Copy link
Copy Markdown
Contributor

What?

  • When trying to access the root variable and and exception happened, root cannot be accessed because it does not exist.
  • We have to use else there so we only try to access root when there is no exception happening.
  • New get_project_root_or_current_dir_path method to get the root of the project path.

Why?

  • To avoid issues when running leverage --version. Otherwise the command would just exit with an unhandled exception like it is described in the issue.

References

  • Use closes #229

Before release

Review the checklist here

Comment thread leverage/path.py Resolved
@borland667
borland667 force-pushed the 229-fix-issue-with-version branch 2 times, most recently from f6f82f2 to 1916c82 Compare March 21, 2024 16:56
@exequielrafaela exequielrafaela added bug Something isn't working patch labels Mar 25, 2024
@juanmatias

Copy link
Copy Markdown
Contributor

@borland667
Sorry I'm a bit out of this right now...
But I have a question... why we are returning the pwd if no project root is found?
I mean, binbash Leverage is intended to be used inside a Leverage project context.... isn't it ok returning an error if no root is detected?

@borland667
borland667 force-pushed the 229-fix-issue-with-version branch from 1916c82 to 691b38e Compare April 11, 2024 17:15
@coveralls

coveralls commented Apr 11, 2024 •

Copy link
Copy Markdown

Pull Request Test Coverage Report for Build 8650773559

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 130 unchanged lines in 3 files lost coverage.
  • Overall coverage increased (+0.2%) to 58.859%

Files with Coverage Reduction New Missed Lines %
path.py 19 73.33%
modules/project.py 50 30.86%
modules/credentials.py 61 54.13%
Totals Coverage Status
Change from base Build 8638597298: 0.2%
Covered Lines: 1243
Relevant Lines: 2019

💛 - Coveralls

@borland667
borland667 force-pushed the 229-fix-issue-with-version branch from 691b38e to daadd10 Compare April 11, 2024 17:23
@borland667 borland667 linked an issue Apr 17, 2024 that may be closed by this pull request
@borland667
borland667 merged commit d10afc8 into master Apr 18, 2024
@borland667
borland667 deleted the 229-fix-issue-with-version branch April 18, 2024 14:20
diego-ojeda-binbash added a commit that referenced this pull request Nov 15, 2026
…oject (#359)

- get_root_path runs git with LC_ALL=C, so "not a git repository" is
  recognized in any locale (#229), and turns any other git error (e.g.
  dubious ownership) into an ExitError with git's message instead of
  returning None, which made every command crash with a TypeError
- The import-time fallbacks catch that ExitError instead of TypeError
  (the workaround from #256); the command reports it when it loads the
  configuration
- State.paths raises "Out of Leverage project context" when no project
  was found, so tofu/terraform/kubectl/tfautomv fail with that message
  instead of an AttributeError. Commands that work anywhere (--version,
  --help, run) are unaffected

Closes #356

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working patch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug | leverage --version fails when OS locale is not english

6 participants