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

Autoremove reporting #11

Merged
merged 8 commits into from Jul 26, 2017
Merged

Conversation

simpoir
Copy link
Contributor

@simpoir simpoir commented Jul 18, 2017

This changes adds client bits to report autoremovable packages back to landscape-server so it can act on them. lp:1208393

Testing:

sudo apt-get install sl && sudo apt-mark auto sl && apt-get autoremove --dry-run
sudo ./scripts/landscape-client -c root-client.conf
accept in landscape, wait forever for package data to sync or not (server doesn't know about that field)
/tmp/landscape-root/package-reporter.log should queue autoremovable once (those are diffs)
grep autoremovable /tmp/landscape-root/broker.log # shows package report being sent even if currently ignored by servers

Copy link
Contributor

@ericsnowcurrently ericsnowcurrently left a comment

Choose a reason for hiding this comment

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

Mostly LGTM.


self.store.set_hash_ids({HASH1: 1, HASH2: 2, HASH3: 3})
self.store.add_available([1, 2, 3])
self.store.add_autoremovable([1, 2])
Copy link
Contributor

Choose a reason for hiding this comment

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

It may be worth adding a note here pointing out that add_installed() is never called, which is why not-autoremovable is what it is.

FWIW, I also find this approach to exercising not-autoremovable to be a little odd. At what point would the store mark a package as auto-removable but not installed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Don't confuse the client store state with the apt package status. Unless the apt package is marked auto and not depended upon, it would still be flagged as not-autoremovable. It's true that in practice the installed state will come with autoremovable state in the store, but I don't care about exercising that path in this test.

I'll add a comment. on the logic

Copy link
Contributor

Choose a reason for hiding this comment

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

sounds good

@simpoir simpoir merged commit 4807ca5 into canonical:master Jul 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants