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

Verify location before addition #188

Merged
merged 11 commits into from
Oct 23, 2024
Merged

Verify location before addition #188

merged 11 commits into from
Oct 23, 2024

Conversation

richfitz
Copy link
Member

Merge after #185, contains those commits.

This PR adds new arguments verify and quiet to orderly_location_add:

  • verify will try and connect to the location before addition, erroring (and therefore making no changes) if it is misconfigured
  • quiet uses the same approach as Make pulling metadata more chatty #185 for controlling how chatty we are while we do this

This PR also fixes a small logic error in save_token where we say "Defaults to TRUE if NULL" - this looks to have been lost at some point and it remains as NULL until referenced within if () at which point we threw an error. Now set set save_token to the value of is.null(token)

Copy link

codecov bot commented Oct 21, 2024

Codecov Report

Attention: Patch coverage is 96.22642% with 2 lines in your changes missing coverage. Please review.

Project coverage is 99.45%. Comparing base (1abea95) to head (713dc52).
Report is 49 commits behind head on main.

Files with missing lines Patch % Lines
R/location.R 97.50% 1 Missing ⚠️
R/util.R 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #188      +/-   ##
==========================================
- Coverage   99.89%   99.45%   -0.44%     
==========================================
  Files          40       41       +1     
  Lines        3746     3680      -66     
==========================================
- Hits         3742     3660      -82     
- Misses          4       20      +16     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@richfitz richfitz force-pushed the mrc-5900 branch 2 times, most recently from f8a39a5 to e26864e Compare October 22, 2024 14:34
@richfitz richfitz marked this pull request as ready for review October 22, 2024 14:39
@richfitz
Copy link
Member Author

That coverage report from codecov is out of date and not being updated for its own mysterious reasons

@richfitz richfitz requested a review from plietar October 22, 2024 16:21
Copy link
Member

@plietar plietar left a comment

Choose a reason for hiding this comment

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

I like this, especially since it means it will perform and cache authentication when adding the location, not randomly later on.

I would expect this to do a bit more than just calling authorize(). If you hit the root of the API there's a basic JSON document:

dput(orderly_location_packit("https://packit.dide.ic.ac.uk/reside/")$client$request("/"))
#> list(status = "success", data = list(schema_version = "0.1.1"), errors = NULL)

Checking the status is good enough. This should work on both packit and outpack_server.

For a path location it should retain the existing root_open behaviour.

if (type == "path") {
assert_scalar_character(args$path, name = "path")
root_open(args$path, require_orderly = FALSE)
Copy link
Member

Choose a reason for hiding this comment

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

As far as I can tell this means there's no more validation of path locations, since the location_path class does not have an authorize method.

Copy link
Member Author

Choose a reason for hiding this comment

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

there was, but it was not at all obvious. I've added a verify method which makes this much less weird, though we'll need to add that to the other location types (e.g., ssh) soon too.

Copy link
Member

@plietar plietar left a comment

Choose a reason for hiding this comment

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

Hit the wrong radio button

@richfitz richfitz requested a review from plietar October 22, 2024 20:37
@richfitz richfitz merged commit 36a60a4 into main Oct 23, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants