56 Commits

Author SHA1 Message Date
Michael Vogt
277eb06412 many: replace use of "sanity" with more inclusive naming
This commit replaces the use of "sanity" with more inclusive
naming.

When `sanity` is used in a more general sense either `validity`
or `quick` is used.
2022-03-14 18:22:34 +01:00
Miguel Pires
db9c63b734 many: remove unused code 2021-08-26 18:24:02 +01:00
Samuele Pedroni
54e84fb8db many: fix imports order (according to gci)
had to make the comment in wrappers/services_test.go a one-liner
otherwise half of it is lost

last set of files needing changing (as per current master)
2021-06-16 09:54:31 +02:00
Maciej Borzecki
edb5b48580 errtracker: use a helper for checking whether snapd reexeced
Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2020-06-22 11:56:33 +02:00
Michael Vogt
0b71b24fd7 errtracker: add missing mocks
The errtracker checks if whopsie is enabled. This check is not
properly mocked so this fails on systems where this is disabled.

This commit fixes the missing mock.
2020-03-25 16:48:20 +01:00
Samuele Pedroni
c30b43760c many: introduce snapdenv and snapdenv.Testing
introduce a new package snapdenv to present the common env options
for snapd components

start with snadpenv.Testing exposing SNAPPY_TESTING

it doesn't make sense for *util packages to use snapdenv directly,
as a consequence move (Set)UserAgent from httputil to snapdenv
2020-03-15 16:40:25 +01:00
Arda Güçlü
174bd05417 fixme: rename ubuntu*architectures to dpkg*architectures 2019-08-26 22:20:59 +03:00
Pawel Stolowski
b7f406de47 Unit test. 2019-03-14 14:50:22 +01:00
Pawel Stolowski
e520646dfe Fix panic caused by db.Close() if db coudln't be opened. 2019-03-14 14:42:28 +01:00
Michael Vogt
7e8384c9f6 errtracker: add missing error details 2018-09-27 11:05:29 +02:00
John R. Lenton
c15d1d41b7 many: move Uname to osutil, for more DRY and easier porting.
Before this there was an Uname implementation in arch and one in
release (the implementation is slightly tricky because
syscall.Utsname's internals are arch-dependent). This drops both in
favour of a new one in osutil, in order to keep syscalls limited to
this package as much as possible.
2018-08-20 16:13:13 +01:00
Michael Vogt
2cc3480fa1 errtracker: do not send duplicated reports (#5263)
* errtracker: do not send duplicated reports

This will add a 7 day history for the error tracker. It will not
send the same report over and over again but instead skip reports
that were already send.

Reviews asked for locking and this means we need something better
than the hand implmented DB. Switch to boltdb because we already
use it for the advisor interface.
2018-06-07 21:41:40 +02:00
Michael Vogt
ac83fbddce Merge remote-tracking branch 'upstream/master' into whoopsie-dupsie 2018-04-10 09:15:58 +02:00
Michael Vogt
2940f1c4d3 errtracker: check for whoopsie.service instead of reading /etc/whoopsie
The whoopsie upstream asked us to check for whoopsie.service instead
of reading /etc/whoopsie when checking if whoopsie is enabled or not.

This PR implements this check by doing what `whoopsie-preferences`
is doing when checking if whoopsie is enabled or not.
2018-04-10 09:11:13 +02:00
Michael Vogt
d5d8b7ba52 errtracker: make TestJournalErrorSilentError work on gccgo
The error from SIGTERM is slightly different with gccgo so we
need to adjust the TestJournalErrorSilentError test for this

See
https://launchpadlibrarian.net/363432841/buildlog_ubuntu-xenial-powerpc.snapd_2.32.3_BUILDING.txt.gz
for the powerpc build failure.
2018-04-05 22:52:46 +02:00
John Lenton
59e945a49d errtracker: add more fields to aid debugging
* errtracker: add more fields to aid debugging
* errtracker: ship more of PATH
* errtracker: further tweak new data collectors (thanks zyga, mvo)
* errtracker: address nitpicks from zyga :-)
2018-04-05 08:33:11 +02:00
Michael Vogt
4a60c3ef87 address review feedback 2018-03-14 12:04:27 +01:00
Michael Vogt
7aa27a37ea errtracker: respect the /etc/whoopsie configuration
We must support the settings of the user about sending problem
reports. This is implemented on Ubuntu via the /etc/whoopsie
configuration and that config is controllable via the
gnome-control-center.

We should probably also have our own internal configuration
(snapd.problem_reports={true,false}?). But that will be a
followup PR.
2018-03-14 11:52:16 +01:00
Michael Vogt
76a42789f3 errtracker: include detected virtualisation 2018-01-24 18:16:05 +01:00
Michael Vogt
0cecd0ff69 cmd, errtracker: get rid of SNAP_DID_REEXEC environment
The SNAP_DID_REEXEC environment caused two bugs already, one with
classic confinement snapd and one in the error tracker. Instead
of relying on this we inspect the /proc/self/exe now to see if
snapd did reexec or not.
2017-11-20 13:14:46 +01:00
Michael Vogt
7ef6dc1f96 Repair script status reports are honored even if the script errors
This means that even if the repair script errors the status (e.g.
"done" or "skip") is honored if it was send over the status-fd.
2017-09-01 10:45:34 +02:00
Michael Vogt
b3fb1ceb3e add new "ProblemType: Repair" to errtracker and use it when reporting repair script failures 2017-09-01 09:26:18 +02:00
Michael Vogt
941ca54de0 Include /etc/apparmor.d/usr.lib.snap-confine md5sum in err reports
This is needed because on ubuntu 14.04 we ship snap-confine
(without .real).
2017-06-08 12:09:32 +02:00
Zygmunt Krynicki
41eb7a10d6 errtracker: report if snapd did re-execute itself
Re-execution affects which internal tools and which snapd is used.
while the current error report shows us hashes of both distribution
and core snapd we always need to guess which one is being used
by inspecting the version string. This makes it more obvious.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
2017-06-01 19:19:05 +02:00
Zygmunt Krynicki
8911fd203b errtracker: include bits of snap-confine apparmor profile (#3421)
This patch extends the error report with information about the used
snap-confine apparmor profile (as expressed by the text of the file) as
well as hint of partial dpkg update.

Partial or failed updates can leave the old (previous) apparmor profile
of snap-confine around (since it is tagged as a conffile) and
subsequently cause any snap execution to fail with access to
"/run/snapd/lock" directory.

To test the theory we will now measure the hashes of the current and any
.dpkg-new versions of the apparmor profile of snap-confine and attach
them to the report.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
2017-06-01 17:40:22 +02:00