-
Notifications
You must be signed in to change notification settings - Fork 50
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
fix: prevent creation of clones after reverting to previous snap revision #275
fix: prevent creation of clones after reverting to previous snap revision #275
Conversation
92c5b8d
to
2acfd6e
Compare
e6ec3cb
to
0b1a2bb
Compare
This is the best fix I could find for this bug. One issue here is that if someone reverts from a snap using We have two (unappealing?) options:
There might be a better fix that I'm missing... |
0b1a2bb
to
91869d2
Compare
@st3v3nmw unfortunately I think that we're just going to have to accept that older revisions of the snap are going to be broken in this regard - perhaps we could produce documentation on the problem somewhere and how it might be avoided or remedied? |
@@ -36,15 +36,14 @@ config_entries = [ | |||
("flush-interval", "flush_interval", None), | |||
("exchange-interval", "exchange_interval", None), | |||
("apt-update-interval", "apt_update_interval", None), | |||
("exchange-interval", "exchange_interval", None), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a related/intended change? If so, why is it related?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed it's repeated. It's on line 37 & 39. I removed the one in line 39.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. Thanks!
@Perfect5th, yes, I can talk to Yanisa to document this problem. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this looks good (and it tests out for me) with the provision that some kind of "FAQ" or "common issues" docs make it up somewhere to inform users why they might see this issue when reverting and what steps they should take to clear clones.
Hi @Perfect5th - can we merge please? |
Merged. I was under the impression that @st3v3nmw had merge rights on this repo, so I left it to him to merge. My mistake. |
Sorry I do not 😄. |
Reverting to a previous snap revision leads to duplicate machine entries because the snap's data is stored in
$SNAP_DATA
and not$SNAP_COMMON
. When the data is stored in$SNAP_DATA
, the snap starts seeing the old data from the previous revision of the snap. Since the state (message id, etc) doesn't match the one tracked by the server, a re-registration is requested leading to clones.The full bug report is available on Launchpad.
How to reproduce
stable
channel & register:Wait until the first full message exchange takes place i.e. the computer's info like Distribution, Hardware, etc are populated on Landscape.
Refresh to the distribution from the
edge
channel.$ snap refresh landscape-client --edge
stable
:Checking the snap's folders, you'll notice that they've diverged (revision
244
isstable
&299
isedge
). We moved from244
->299
->244
but244
still has files that are behind e.g.broker.bpickle
,monitor.bpickle
.Fix
We'll move the snap's data from the versioned
$SNAP_DATA
to$SNAP_COMMON
which doesn't change across snap revisions. We need to migrate the existing data using apost-refresh
hook & remove$SNAP_DATA/var/lib/landscape/client
from the current revision.To check if the migration works:
Remove
landscape-client
if it's still installed (we need to start on a blank slate) & repeat steps 1 & 2 from the How to reproduce section above. Please register the computer with a different computer title.Build the snap & install it:
Moving forward, the snaps will use
$SNAP_COMMON
.