cmd/snap-update-ns: add logging to snap-update-ns #4104

Merged
merged 3 commits into from Nov 3, 2017

Conversation

Projects
None yet
3 participants
Contributor

zyga commented Oct 30, 2017

This branch adds a number of useful debug messages to snap-update-ns.
They can now be enabled by running with SNAPD_DEBUG=1 set.

Signed-off-by: Zygmunt Krynicki zygmunt.krynicki@canonical.com

codecov-io commented Oct 30, 2017

Codecov Report

Merging #4104 into master will decrease coverage by 0.09%.
The diff coverage is 12.24%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #4104     +/-   ##
=========================================
- Coverage   75.63%   75.53%   -0.1%     
=========================================
  Files         435      435             
  Lines       37666    37640     -26     
=========================================
- Hits        28489    28432     -57     
- Misses       7183     7217     +34     
+ Partials     1994     1991      -3
Impacted Files Coverage Δ
cmd/snap-update-ns/main.go 0% <0%> (ø) ⬆️
cmd/snap-update-ns/change.go 97.59% <100%> (+0.12%) ⬆️
wrappers/desktop.go 72.16% <0%> (-2.31%) ⬇️
overlord/assertstate/assertstate.go 76.76% <0%> (-0.84%) ⬇️
overlord/devicestate/devicemgr.go 74.14% <0%> (-0.44%) ⬇️
asserts/store_asserts.go 98.52% <0%> (-0.19%) ⬇️
overlord/auth/auth.go 72.07% <0%> (-0.13%) ⬇️
store/store.go 79.96% <0%> (-0.04%) ⬇️
overlord/devicestate/devicestate.go 75% <0%> (+0.69%) ⬆️

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 d1338ea...95b6c6d. Read the comment docs.

Nice! Approved, see just one small suggestion.

@@ -107,10 +112,14 @@ func run() error {
// symlinks or perform other malicious activity (such as attempting to
// introduce a symlink that would cause us to mount something other
// than what we expected).
+ logger.Debugf("freezing processes of snap %q", snapName)
if err := freezeSnapProcesses(opts.Positionals.SnapName); err != nil {
return err
@stolowski

stolowski Oct 31, 2017

Contributor

Would it make sense to log this err too?

@zyga

zyga Oct 31, 2017

Contributor

The error gets printed to stderr when the program fails, this error is propagated directly out of run and into main.

@zyga zyga added this to the 2.30 milestone Nov 2, 2017

zyga added some commits Oct 31, 2017

cmd: forward SNAP_DEBUG from snap-confine to snap-update-ns
This enables snap-update-ns' built-in logging facilities to be used.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
cmd/libsnap: consider both SNAP_CONFINE_DEBUG and SNAPD_DEBUG
This patch considers debugging to be active when either
SNAP_CONFINE_DEBUG or SNAPD_DEBUG is boolean-true. This will ease the
integration and consolidation around SNAPD_DEBUG later on.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
cmd/snap-update-ns: add logging to snap-update-ns
This patch adds a number of useful debug messages to snap-update-ns.
They can be enabled by running with SNAPD_DEBUG=1 set.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>

@zyga zyga merged commit 511e6a6 into snapcore:master Nov 3, 2017

1 of 7 checks passed

artful-amd64 autopkgtest running
Details
artful-i386 autopkgtest running
Details
xenial-amd64 autopkgtest running
Details
xenial-i386 autopkgtest running
Details
xenial-ppc64el autopkgtest running
Details
zesty-amd64 autopkgtest running
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@zyga zyga deleted the zyga:tweak/snap-update-ns-logging branch Nov 3, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment