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

lifecycle: don't clean priming area if the snap is being tried #2143

Merged
merged 5 commits into from Jun 7, 2018

Conversation

kyrofa
Copy link
Contributor

@kyrofa kyrofa commented May 23, 2018

  • Have you followed the guidelines for contributing?
  • Have you signed the CLA?
  • If this is a bugfix. Have you checked that there is a bug report open for the issue you are trying to fix on bug reports?
  • If this is a new feature. Have you discussed the design on the forum?
  • Have you successfully run ./runtests.sh static?
  • Have you successfully run ./runtests.sh unit?

Currently, if one uses 'snap try' and then runs 'snapcraft clean', one must 'snap try' again once the snap has been re-primed. This PR fixes LP: #1774015 by being smarter about this: checking to see if the priming area is being used by 'snap try', and if so, not removing it when cleaning, just its contents. Then once the snap has been re-primed, it'll just start working again, no 'snap try' required.

Currently, if one uses 'snap try' and then runs 'snapcraft clean', one
must 'snap try' again once the snap has been re-primed. Be smarter about
this: check to see if the priming area is being used by 'snap try', and
if so, don't remove it when cleaning, just remove its contents. Then
once the snap has been re-primed, it'll just start working again, no
'snap try' required.

Signed-off-by: Kyle Fazzari <kyrofa@ubuntu.com>
@codecov-io
Copy link

codecov-io commented May 23, 2018

Codecov Report

Merging #2143 into master will increase coverage by 0.02%.
The diff coverage is 96.25%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2143      +/-   ##
==========================================
+ Coverage   91.32%   91.35%   +0.02%     
==========================================
  Files         193      194       +1     
  Lines       12168    12244      +76     
  Branches     1814     1820       +6     
==========================================
+ Hits        11113    11186      +73     
- Misses        714      716       +2     
- Partials      341      342       +1
Impacted Files Coverage Δ
snapcraft/internal/mountinfo.py 100% <100%> (ø)
snapcraft/internal/errors.py 99.5% <100%> (+0.03%) ⬆️
snapcraft/internal/lifecycle/_clean.py 88.13% <85.71%> (-0.98%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4b66366...6222cd4. Read the comment docs.

Copy link
Collaborator

@sergiusens sergiusens left a comment

Choose a reason for hiding this comment

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

This is missing a test with a bad mountline in order to trigger a potential KeyError from initializing Mount.
Looks good otherwise.

with contextlib.suppress(FileNotFoundError):
with open(mountinfo_file) as f:
for row in csv.reader(f, delimiter=' '):
mount = Mount(row)
Copy link
Collaborator

Choose a reason for hiding this comment

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

this can raise a KeyError, if catched, warn and continue would be my choice.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch, thank you. Fixed.

@kyrofa kyrofa dismissed sergiusens’s stale review May 31, 2018 15:53

Fixed, please take another pass.

Copy link
Collaborator

@sergiusens sergiusens left a comment

Choose a reason for hiding this comment

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

Thanks

We are missing tests for the actual error classes under test errors. I just noticed that, sorry about not noticing before. I leave it to you to add and merge at your convenience.

@kyrofa kyrofa force-pushed the bugfix/clean_prime_of_tried branch from 751a404 to 6222cd4 Compare June 7, 2018 15:13
@sergiusens sergiusens merged commit fa84691 into canonical:master Jun 7, 2018
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.

None yet

3 participants