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

[WIP] nydus-image: fix unpack from specify blob dir #1338

Closed
wants to merge 1 commit into from

Conversation

imeoer
Copy link
Collaborator

@imeoer imeoer commented Jun 26, 2023

Fix the panic when user specify --blob-dir on unpack:

$ nydus-image unpack --bootstrap /path/to/bootstrap \
    --blob-dir /path/to/blobs \
    --output /path/to/oci.tar

Error: fail to unpack

Caused by:
    both blob path or blob backend config are not specified

Relevant Issue (if applicable)

If there are Issues related to this PullRequest, please list it.

Details

Please describe the details of PullRequest.

Types of changes

What types of changes does your PullRequest introduce? Put an x in all the boxes that apply:

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation Update (if none of the other choices apply)

Checklist

Go over all the following points, and put an x in all the boxes that apply.

  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.

Fix the panic when user specify `--blob-dir` on unpack:

```
$ nydus-image unpack --bootstrap /path/to/bootstrap \
    --blob-dir /path/to/blobs \
    --output /path/to/oci.tar

Error: fail to unpack

Caused by:
    both blob path or blob backend config are not specified
```

Signed-off-by: Yan Song <[email protected]>
@imeoer imeoer requested a review from a team as a code owner June 26, 2023 07:53
@imeoer imeoer requested review from jiangliu, changweige and adamqqqplay and removed request for a team June 26, 2023 07:53
@codecov
Copy link

codecov bot commented Jun 26, 2023

Codecov Report

Merging #1338 (0da98ad) into master (65cf530) will decrease coverage by 0.06%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1338      +/-   ##
==========================================
- Coverage   45.68%   45.63%   -0.06%     
==========================================
  Files         123      123              
  Lines       37266    37305      +39     
  Branches    37266    37305      +39     
==========================================
- Hits        17026    17024       -2     
- Misses      19342    19383      +41     
  Partials      898      898              
Impacted Files Coverage Δ
rafs/src/metadata/cached_v5.rs 58.52% <0.00%> (-0.98%) ⬇️
rafs/src/metadata/direct_v5.rs 56.44% <ø> (ø)
rafs/src/metadata/direct_v6.rs 6.51% <0.00%> (-0.07%) ⬇️
rafs/src/metadata/inode.rs 47.50% <0.00%> (ø)
rafs/src/metadata/mod.rs 53.81% <ø> (ø)
rafs/src/mock/mock_inode.rs 0.00% <0.00%> (ø)
src/bin/nydus-image/main.rs 40.71% <0.00%> (-0.09%) ⬇️
src/bin/nydus-image/unpack/mod.rs 0.00% <0.00%> (ø)

... and 2 files with indirect coverage changes

@adamqqqplay
Copy link
Member

Really helpful fix, I thought it was a problem with my usage, so I could only use the --blob parameter instead of --blob-dir.

Thanks a lot!

None => Self::get_backend(matches, "unpacker").ok(),
None => {
Some(BlobFactory::new_backend(
config.backend.as_ref().unwrap(),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it safe to unwrap() here? Or should we check and return error code instead?

@jiangliu
Copy link
Collaborator

Otherwise LGTM!

@imeoer
Copy link
Collaborator Author

imeoer commented Oct 16, 2023

Fixed in master.

@imeoer imeoer closed this Oct 16, 2023
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.

3 participants