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

Remove existing file during build-disk #1857

Merged
merged 2 commits into from
Nov 21, 2023

Conversation

frelon
Copy link
Contributor

@frelon frelon commented Nov 15, 2023

The first commit makes build-disk command behave like build-iso in that it will remove an existing raw disk before writing the new disk and log a warning.

Second commit changes the build-iso Makefile target to use the toolkit image instead of the target derivative image to be consistent with build-disk target

This commit makes build-disk command behave like build-iso in that it
will remove an existing raw disk before writing the new disk and log a
warning.

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>
@frelon frelon requested a review from a team as a code owner November 15, 2023 12:52
@codecov-commenter
Copy link

codecov-commenter commented Nov 15, 2023

Codecov Report

Attention: 6 lines in your changes are missing coverage. Please review.

Comparison is base (e732621) 75.35% compared to head (b779089) 75.29%.

Files Patch % Lines
pkg/action/build-disk.go 0.00% 5 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1857      +/-   ##
==========================================
- Coverage   75.35%   75.29%   -0.06%     
==========================================
  Files          67       67              
  Lines        6820     6825       +5     
==========================================
  Hits         5139     5139              
- Misses       1311     1315       +4     
- Partials      370      371       +1     

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

Copy link
Contributor

@davidcassany davidcassany left a comment

Choose a reason for hiding this comment

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

With the exception of the second commit all good to me.

Regarding the second commit (c8b76f2) I have mixed feelings with it. My idea to solve that, was to add a new RunNoError (or similar) into the runner interface and in that interface simply log as warnings any error, but never return error. Which would still call it always but do not present it as an error in logs.

Note this error message is also present on install processes, which is also ugly. There the suggested approach here would still log the red ugly error.

So probably I'd be more in favor of log it as a warning|debug message. I have an implementation here. Probably we can leave that for a separate PR.

@frelon
Copy link
Contributor Author

frelon commented Nov 21, 2023

Regarding the second commit (c8b76f2) I have mixed feelings with it. My idea to solve that, was to add a new RunNoError (or similar) into the runner interface and in that interface simply log as warnings any error, but never return error. Which would still call it always but do not present it as an error in logs.

That feels so hacky though.. We could consider moving the logging out of the runner for this reason, but I do think that only running partx on files in /dev makes sense. Will have to try it with the install command also to see what happens!

@frelon
Copy link
Contributor Author

frelon commented Nov 21, 2023

For now I could remove the second commit to get the other changes merged!

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>
@frelon frelon force-pushed the build-disk-overwrite branch from 10193dd to b779089 Compare November 21, 2023 13:04
@frelon frelon enabled auto-merge (squash) November 21, 2023 13:04
@davidcassany
Copy link
Contributor

davidcassany commented Nov 21, 2023

Regarding the second commit (c8b76f2) I have mixed feelings with it. My idea to solve that, was to add a new RunNoError (or similar) into the runner interface and in that interface simply log as warnings any error, but never return error. Which would still call it always but do not present it as an error in logs.

That feels so hacky though.. We could consider moving the logging out of the runner for this reason, but I do think that only running partx on files in /dev makes sense. Will have to try it with the install command also to see what happens!

Well, I am not convinced either, but this isn't much different than calling Run and ignore the error. On exception based languages I'd code Run with a flag RaiseOnError defaulting to true. Anyway as long as I am aware this is only happening for partx that I am aware of and I'd like to apply the best effort run concept (swallow errors) for blkdeactivate calls, this way we can drop LVM requirement from the spec and simply keep it as a recommended tool.

Another option could be turning all runner logs into debug level.

Alternatively we could also have a quiet flag we set and unset on the call we want to ignore any kind of message.

I think having the logger within the runner is helpful for debugging purposes as we see the exact commands that are executed.

@frelon frelon merged commit 6358862 into rancher:main Nov 21, 2023
14 checks passed
@frelon frelon deleted the build-disk-overwrite branch November 21, 2023 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants