65 Commits

Author SHA1 Message Date
Samuele Pedroni
f2cdb6dd92 asserts,interfaces,snap: fix imports order (according to gci) 2021-06-14 20:54:41 +02:00
Ian Johnson
7ef81d7ab2 many: fix new ineffassign warnings
For some reason all of a sudden these were flagged by the latest/stable go snap
in CI:

Checking for ineffective assignments
/home/runner/work/snapd/snapd/src/github.com/snapcore/snapd/interfaces/repo_test.go:2088:2: ineffectual assignment to conn
/home/runner/work/snapd/snapd/src/github.com/snapcore/snapd/interfaces/hotplug/deviceinfo_test.go:88:2: ineffectual assignment to di
/home/runner/work/snapd/snapd/src/github.com/snapcore/snapd/overlord/devicestate/devicestate_serial_test.go:664:2: ineffectual assignment to device

Signed-off-by: Ian Johnson <ian.johnson@canonical.com>
2021-02-25 18:19:56 -06:00
Ian Johnson
bb412a7e2f many: properly mock /proc/self/mountinfo now
Also some drive-bys:
* gadget: eliminate setUpWritableFallback and mockProcSelfFilesystem helpers and
  just use osutil.MockMountInfo instead
* overlord: eliminate restoreBackends and TearDownTest, use AddCleanup from
  testutil.BaseTest instead
* selinux/tests: eliminate test about failing to read MountInfo, this is now
  hard to mock and isn't generally likely to happen unless procfs is not
  mounted, so just drop this test
* selinux: eliminate selinux.MockMountInfo and use osutil.MockMountInfo instead

Signed-off-by: Ian Johnson <ian.johnson@canonical.com>
2020-04-07 09:31:42 -05:00
Pawel Stolowski
376dc0aa9a Use unicode for ... for HotplugKey and also for HotplugDeviceInfo. 2019-04-10 10:30:35 +02:00
Pawel Stolowski
4e2233d76d Introduce HotplugKey as a distinct type and pass it everywhere in hotplug code instead of plain strings. Provide ShortString method to use in task/change summaries. 2019-04-08 12:30:55 +02:00
Pawel Stolowski
9edad2e815 Added test for ShortString. 2019-04-04 14:07:40 +02:00
Pawel Stolowski
d653261c60 Fix typo. 2019-04-04 09:55:24 +02:00
Pawel Stolowski
28a77f4181 Further tweaks to HotplugDeviceInfo string repr: omit parts that are not available (no '?'). Truncate model/vendor at 70 chars. Provide ShortString method with more aggresive truncation (16 chars) and use it for task/change summaries. 2019-04-04 09:44:09 +02:00
Pawel Stolowski
959da5c9e0 Changed HotplugDeviceInfo String format to "devname|devpath (MODEL|VENDOR; serial: SERIAL)". Prefer ID_SERIAL_SHORT over ID_SERIAL and truncate model/vendor. 2019-04-03 13:26:56 +02:00
Pawel Stolowski
3b637d4863 Added comments regarding devname and devpath. 2019-04-03 09:22:03 +02:00
Pawel Stolowski
04edcbd6e2 Prefer ID_VENDOR over ID_VENDOR_ID and ID_MODEL over ID_MODEL_ID. Simplified attribute check to just check if it's not empty. 2019-03-29 14:34:13 +01:00
Pawel Stolowski
8c00ccd39b Tweak hotplug-related log messages and task summaries to use HotplugDeviceInfo.String() for better description of the affected device. 2019-03-29 11:04:49 +01:00
Pawel Stolowski
a7df4547d1 Implemented String() method for HotplugDeviceInfo. 2019-03-29 10:16:38 +01:00
Pawel Stolowski
52bfac41da Added comments to clarify some aspects. 2019-02-14 14:44:26 +01:00
Pawel Stolowski
cbf113fcf4 Merge branch 'master' into hotplug 2019-02-11 16:51:22 +01:00
Pawel Stolowski
3261baf5cf 2018 -> 2019. 2019-02-11 15:01:08 +00:00
Pawel Stolowski
ac6f6497f8 Merge branch 'simplify-hotplug-slot-spec' into hotplug 2019-02-11 14:36:08 +01:00
Pawel Stolowski
928385a442 No need to copy attrs since normalize does that already. 2019-02-08 17:18:02 +01:00
Pawel Stolowski
5b49cff1d4 Renamed RequestedSlotSpec to ProposedSlot. Removed Specification type. 2019-02-08 16:24:35 +01:00
Pawel Stolowski
f7f24f34b6 Merge branch 'hotplug-add-slot-handler' into hotplug 2019-02-06 11:13:53 +01:00
Pawel Stolowski
bb629a481a Review feedback. 2019-02-04 15:11:51 +01:00
Pawel Stolowski
ce59059845 Merge branch 'hotplug-add-slot-handler' into hotplug 2019-02-01 11:20:20 +01:00
Pawel Stolowski
e54691cb00 Make HotplugDeviceInfo marshall to/from json. 2019-02-01 11:18:42 +01:00
Pawel Stolowski
7f06eb9bde HandledByGadget predicate. 2019-01-15 17:02:06 +01:00
Samuele Pedroni
307008e52c some small doc comment fixes 2018-11-12 18:01:58 +01:00