Skip to content
This repository has been archived by the owner on Nov 8, 2022. It is now read-only.

Commit

Permalink
Remove unecessary changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
nanliu committed Nov 19, 2016
1 parent dfb2393 commit 23841ed
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 23 deletions.
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,6 @@ $ cp snapteld /usr/local/sbin
$ cp snaptel /usr/local/bin
```

If you installed snap-telemetry package, please make sure `/usr/local/bin:/usr/local/sbin` is part of your $PATH and has higher priority than `/usr/bin:/usr/sbin`, or invoke the snap-telemetry snapteld/snaptel binary using fully qualified path.

NOTE: snap-telemetry packages prior to 0.19.0 installed `/usr/local/bin/{snapctl|snapd}` and these binaries have been renamed to `snaptel` and `snapteld`. snap-telemetry packages prior to 0.18.0 symlinked `/usr/bin/{snapctl|snapd}` to `/opt/snap/bin/{snapctl|snapd}` and may cause conflicts with [Ubuntu's `snapteld` package](http://packages.ubuntu.com/xenial-updates/snapd). Ubuntu 16.04.1 [snapteld package version 2.13+](https://launchpad.net/ubuntu/+source/snapd) installs snapd/snapctl binary in /usr/bin. These executables are not related to snap-telemetry. Running `snapctl` from snapd package will result in the following error message:

```
Expand Down Expand Up @@ -155,7 +153,7 @@ $ systemctl start snap-telemetry
If you installed Snap from binary, you can start Snap daemon via the command:
```
$ sudo mkdir -p /var/log/snap
$ sudo snapteld --plugin-trust 0 --log-level 1 -o /var/log/snap &
$ sudo snapteld --plugin-trust 0 --log-level 1 --log-path /var/log/snap &
```

To view the service logs:
Expand Down
41 changes: 21 additions & 20 deletions snapteld.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ const (
tribe.CONFIG_CONSTRAINTS +
`}` +
`}`
logModule = "snapteld"
)

type coreModule interface {
Expand Down Expand Up @@ -389,7 +390,7 @@ func action(ctx *cli.Context) error {
log.WithFields(
log.Fields{
"block": "main",
"_module": "snapteld",
"_module": logModule,
}).Fatal("need keyring file when trust is on (--keyring-file or -k)")
}
for _, k := range keyrings {
Expand All @@ -398,7 +399,7 @@ func action(ctx *cli.Context) error {
log.WithFields(
log.Fields{
"block": "main",
"_module": "snapteld",
"_module": logModule,
"error": err.Error(),
"keyringPath": keyringPath,
}).Fatal("Unable to determine absolute path to keyring file")
Expand All @@ -408,7 +409,7 @@ func action(ctx *cli.Context) error {
log.WithFields(
log.Fields{
"block": "main",
"_module": "snapteld",
"_module": logModule,
"error": err.Error(),
"keyringPath": keyringPath,
}).Fatal("bad keyring file")
Expand All @@ -420,7 +421,7 @@ func action(ctx *cli.Context) error {
log.WithFields(
log.Fields{
"_block": "main",
"_module": "snapteld",
"_module": logModule,
"error": err.Error(),
"keyringPath": keyringPath,
}).Fatal(err)
Expand All @@ -438,7 +439,7 @@ func action(ctx *cli.Context) error {
log.WithFields(
log.Fields{
"block": "main",
"_module": "snapteld",
"_module": logModule,
"error": err.Error(),
"keyringPath": keyringPath,
}).Warning("unable to open keyring file. not adding to keyring path")
Expand All @@ -455,7 +456,7 @@ func action(ctx *cli.Context) error {
log.WithFields(
log.Fields{
"block": "main",
"_module": "snapteld",
"_module": logModule,
"error": err.Error(),
"keyringPath": keyringPath,
}).Fatal("unable to open keyring file.")
Expand All @@ -470,7 +471,7 @@ func action(ctx *cli.Context) error {
log.WithFields(
log.Fields{
"block": "main",
"_module": "snapteld",
"_module": logModule,
}).Info("snapteld started", `
ss ss
odyssyhhyo oyhysshhoyo
Expand Down Expand Up @@ -863,14 +864,14 @@ func setMaxProcs(maxProcs int) {
log.WithFields(
log.Fields{
"_block": "main",
"_module": "snapteld",
"_module": logModule,
"maxprocs": maxProcs,
}).Error("Trying to set GOMAXPROCS to an invalid value")
_maxProcs = 1
log.WithFields(
log.Fields{
"_block": "main",
"_module": "snapteld",
"_module": logModule,
"maxprocs": _maxProcs,
}).Warning("Setting GOMAXPROCS to 1")
_maxProcs = 1
Expand All @@ -880,14 +881,14 @@ func setMaxProcs(maxProcs int) {
log.WithFields(
log.Fields{
"_block": "main",
"_module": "snapteld",
"_module": logModule,
"maxprocs": maxProcs,
}).Error("Trying to set GOMAXPROCS larger than number of CPUs available on system")
_maxProcs = numProcs
log.WithFields(
log.Fields{
"_block": "main",
"_module": "snapteld",
"_module": logModule,
"maxprocs": _maxProcs,
}).Warning("Setting GOMAXPROCS to number of CPUs on host")
}
Expand All @@ -900,7 +901,7 @@ func setMaxProcs(maxProcs int) {
log.WithFields(
log.Fields{
"block": "main",
"_module": "snapteld",
"_module": logModule,
"given maxprocs": _maxProcs,
"real maxprocs": actualNumProcs,
}).Warning("not using given maxprocs")
Expand Down Expand Up @@ -970,7 +971,7 @@ func startModule(m coreModule) error {
log.WithFields(
log.Fields{
"block": "main",
"_module": "snapteld",
"_module": logModule,
"snap-module": m.Name(),
}).Info("module started")
}
Expand All @@ -981,7 +982,7 @@ func printErrorAndExit(name string, err error) {
log.WithFields(
log.Fields{
"block": "main",
"_module": "snapteld",
"_module": logModule,
"error": err.Error(),
"snap-module": name,
}).Fatal("error starting module")
Expand All @@ -997,14 +998,14 @@ func startInterruptHandling(modules ...coreModule) {
log.WithFields(
log.Fields{
"block": "main",
"_module": "snapteld",
"_module": logModule,
}).Info("shutting down modules")

for _, m := range modules {
log.WithFields(
log.Fields{
"block": "main",
"_module": "snapteld",
"_module": logModule,
"snap-module": m.Name(),
}).Info("stopping module")
m.Stop()
Expand All @@ -1014,7 +1015,7 @@ func startInterruptHandling(modules ...coreModule) {
log.WithFields(
log.Fields{
"block": "main",
"_module": "snapteld",
"_module": logModule,
"signal": sig.String(),
}).Info("restarting app")
// and restart the app (with the current configuration)
Expand All @@ -1026,7 +1027,7 @@ func startInterruptHandling(modules ...coreModule) {
log.WithFields(
log.Fields{
"block": "main",
"_module": "snapteld",
"_module": logModule,
"signal": sig.String(),
}).Info("exiting on signal")
os.Exit(0)
Expand Down Expand Up @@ -1056,15 +1057,15 @@ func validateLevelSettings(logLevel, pluginTrust int) {
log.WithFields(
log.Fields{
"block": "main",
"_module": "snapteld",
"_module": logModule,
"level": logLevel,
}).Fatal("log level was invalid (needs: 1-5)")
}
if pluginTrust < 0 || pluginTrust > 2 {
log.WithFields(
log.Fields{
"block": "main",
"_module": "snapteld",
"_module": logModule,
"level": pluginTrust,
}).Fatal("Plugin trust was invalid (needs: 0-2)")
}
Expand Down

0 comments on commit 23841ed

Please sign in to comment.