Skip to content

Commit

Permalink
Merge pull request #267 from openlawlibrary/ndusan/validation-cleanup…
Browse files Browse the repository at this point in the history
…-fix-264

`taf repo validate` cleanup fix
  • Loading branch information
n-dusan authored Aug 5, 2022
2 parents 9c1f780 + 2cbfa9b commit ef53125
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@ and this project adheres to [Semantic Versioning][semver].

### Fixed

- Do not remove authentication repository folder when running `taf repo validate` ([267])
- fix git push - remove pygit2 push implementation which does not fully support ssh ([263])
- Warn when git object cleanup fails (`idx`,`pack`) and include cleanup warning message ([259])


[267]: https://github.com/openlawlibrary/taf/pull/267
[266]: https://github.com/openlawlibrary/taf/pull/266
[263]: https://github.com/openlawlibrary/taf/pull/263
[261]: https://github.com/openlawlibrary/taf/pull/261
Expand Down
9 changes: 4 additions & 5 deletions taf/updater/updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -635,11 +635,6 @@ def _commits_ret(commits, existing_repo, update_successful):

try:
commits = None
users_repo_existed = False

# first clone the validation repository in temp. this is needed because tuf expects auth_repo_name to be valid (not None)
# and in the right format (seperated by '/'). this approach covers a case where we don't know authentication repo path upfront.
auth_repo_name = _clone_validation_repo(url, auth_repo_name, default_branch)
# check whether the directory that runs clone exists or contains additional files.
# we need to check the state of folder before running tuf. Resolves issue #22
# if auth_repo_name isn't specified then the current directory doesn't contain additional files.
Expand All @@ -649,6 +644,10 @@ def _commits_ret(commits, existing_repo, update_successful):
else True
)

# first clone the validation repository in temp. this is needed because tuf expects auth_repo_name to be valid (not None)
# and in the right format (seperated by '/'). this approach covers a case where we don't know authentication repo path upfront.
auth_repo_name = _clone_validation_repo(url, auth_repo_name, default_branch)

repository_updater = tuf_updater.Updater(
auth_repo_name, repository_mirrors, GitUpdater
)
Expand Down
2 changes: 1 addition & 1 deletion taf/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ def on_rm_error(_func, path, _exc_info):
os.unlink(path)
except (OSError, PermissionError) as e:
taf_logger.warning(
"Failed to clean up temporary update files: {}. This is a known issue when running TAF in a subprocess. You could consider upgrading taf to see if cleanup errors persist",
"WARNING: Failed to clean up temporary update files: {}. This is a known issue when running TAF in a subprocess. You could consider upgrading taf to see if cleanup errors persist",
e,
)
pass
Expand Down

0 comments on commit ef53125

Please sign in to comment.