]> ruderich.org/simon Gitweb - safcm/safcm.git/commitdiff
sync: shorten log messages by removing "info/sync remote:" prefix
authorSimon Ruderich <simon@ruderich.org>
Wed, 12 May 2021 06:22:17 +0000 (08:22 +0200)
committerSimon Ruderich <simon@ruderich.org>
Wed, 12 May 2021 06:25:36 +0000 (08:25 +0200)
The prefix provides little value as it already obvious what's happening
on the remote side and in which phase (info/sync). Keeping the log
messages shorter helps the user to focus on the important parts of the
message.

cmd/safcm-remote/info/info.go
cmd/safcm-remote/log/logger.go
cmd/safcm-remote/sync/commands_test.go
cmd/safcm-remote/sync/files_test.go
cmd/safcm-remote/sync/packages_debian_test.go
cmd/safcm-remote/sync/services_systemd_test.go
cmd/safcm-remote/sync/sync.go
cmd/safcm-remote/sync/sync_test.go
cmd/safcm/main_sync_test.go

index 4de44f3b0f42faaf7b6dfa7c5daaa2ecb4bf9ee2..15bf0489990eb2e9d75c5cf3316a5899f0c95a5a 100644 (file)
@@ -34,20 +34,18 @@ type Info struct {
        logger *log.Logger
 }
 
-const logPrefix = "info remote:"
-
 func Handle(req safcm.MsgInfoReq,
        runner run.Runner, fun log.LogFunc) safcm.MsgInfoResp {
 
        i := Info{
                req:    req,
-               logger: log.NewLogger(logPrefix, fun),
+               logger: log.NewLogger(fun),
        }
        i.cmd = run.NewCmd(runner, i.logger)
 
        err := i.handle()
        if err != nil {
-               i.resp.Error = fmt.Sprintf("%s %v", logPrefix, err)
+               i.resp.Error = fmt.Sprintf("%v", err)
        }
        return i.resp
 }
index 8bf0a43ee0506b94a5edb02fe42dbd473910ce21..b9fbcf36a03d4f8074a5c932528004973bb41050 100644 (file)
@@ -28,13 +28,11 @@ type LogFunc func(level safcm.LogLevel, msg string)
 
 type Logger struct {
        fun    LogFunc
-       prefix string
 }
 
-func NewLogger(prefix string, fun LogFunc) *Logger {
+func NewLogger(fun LogFunc) *Logger {
        return &Logger{
                fun:    fun,
-               prefix: prefix,
        }
 }
 
@@ -50,5 +48,5 @@ func (l *Logger) Debug2f(format string, a ...interface{}) {
 
 func (l *Logger) log(level safcm.LogLevel,
        format string, a ...interface{}) {
-       l.fun(level, l.prefix+" "+fmt.Sprintf(format, a...))
+       l.fun(level, fmt.Sprintf(format, a...))
 }
index f6293b48a99482c34f79a7d27ae764e409d0808f..0bd0949b020b922976744ea9f85e3beacf381cee 100644 (file)
@@ -85,8 +85,8 @@ func TestSyncCommands(t *testing.T) {
                                Env: env,
                        }},
                        []string{
-                               `3: sync remote: commands: running "/bin/sh" "-c" "echo; env | grep SAFCM_" (group)`,
-                               "5: sync remote: commands: command output:\nfake stdout/stderr",
+                               `3: commands: running "/bin/sh" "-c" "echo; env | grep SAFCM_" (group)`,
+                               "5: commands: command output:\nfake stdout/stderr",
                        },
                        safcm.MsgSyncResp{
                                CommandChanges: []safcm.CommandChange{
@@ -160,8 +160,8 @@ func TestSyncCommands(t *testing.T) {
                                Env: env,
                        }},
                        []string{
-                               `3: sync remote: commands: running "/bin/sh" "-c" "echo hi; false" (group)`,
-                               "5: sync remote: commands: command output:\nfake stdout/stderr",
+                               `3: commands: running "/bin/sh" "-c" "echo hi; false" (group)`,
+                               "5: commands: command output:\nfake stdout/stderr",
                        },
                        safcm.MsgSyncResp{
                                CommandChanges: []safcm.CommandChange{
@@ -271,11 +271,11 @@ func TestSyncCommands(t *testing.T) {
                                Env: env,
                        }},
                        []string{
-                               `3: sync remote: commands: running "/bin/sh" "-c" "echo first" (group1)`,
-                               "5: sync remote: commands: command output:\nfake stdout/stderr first",
-                               `3: sync remote: commands: running "/bin/sh" "-c" "echo second" (group2)`,
-                               "5: sync remote: commands: command output:\nfake stdout/stderr second",
-                               `3: sync remote: commands: running "/bin/sh" "-c" "false" (group3)`,
+                               `3: commands: running "/bin/sh" "-c" "echo first" (group1)`,
+                               "5: commands: command output:\nfake stdout/stderr first",
+                               `3: commands: running "/bin/sh" "-c" "echo second" (group2)`,
+                               "5: commands: command output:\nfake stdout/stderr second",
+                               `3: commands: running "/bin/sh" "-c" "false" (group3)`,
                        },
                        safcm.MsgSyncResp{
                                CommandChanges: []safcm.CommandChange{
@@ -388,12 +388,12 @@ func TestSyncCommands(t *testing.T) {
                                Env: env,
                        }},
                        []string{
-                               `3: sync remote: commands: running "/bin/sh" "-c" "echo trigger ." (".")`,
-                               "5: sync remote: commands: command output:\nfake stdout/stderr .",
-                               `3: sync remote: commands: running "/bin/sh" "-c" "echo trigger dir" ("dir")`,
-                               "5: sync remote: commands: command output:\nfake stdout/stderr dir",
-                               `3: sync remote: commands: running "/bin/sh" "-c" "echo; env | grep SAFCM_" (group)`,
-                               "5: sync remote: commands: command output:\nfake stdout/stderr",
+                               `3: commands: running "/bin/sh" "-c" "echo trigger ." (".")`,
+                               "5: commands: command output:\nfake stdout/stderr .",
+                               `3: commands: running "/bin/sh" "-c" "echo trigger dir" ("dir")`,
+                               "5: commands: command output:\nfake stdout/stderr dir",
+                               `3: commands: running "/bin/sh" "-c" "echo; env | grep SAFCM_" (group)`,
+                               "5: commands: command output:\nfake stdout/stderr",
                        },
                        safcm.MsgSyncResp{
                                CommandChanges: []safcm.CommandChange{
@@ -497,10 +497,10 @@ func TestSyncCommands(t *testing.T) {
                                Env: env,
                        }},
                        []string{
-                               `3: sync remote: commands: running "/bin/sh" "-c" "echo trigger ." (".")`,
-                               "5: sync remote: commands: command output:\nfake stdout/stderr .",
-                               `3: sync remote: commands: running "/bin/sh" "-c" "false" ("dir")`,
-                               "5: sync remote: commands: command output:\nfake stdout/stderr dir",
+                               `3: commands: running "/bin/sh" "-c" "echo trigger ." (".")`,
+                               "5: commands: command output:\nfake stdout/stderr .",
+                               `3: commands: running "/bin/sh" "-c" "false" ("dir")`,
+                               "5: commands: command output:\nfake stdout/stderr dir",
                        },
                        safcm.MsgSyncResp{
                                CommandChanges: []safcm.CommandChange{
index 57d27c7fa8e043b06543387a1a15a720fcdb0755..88a5b51f85cd3fa4a4d36f1422ecbe37424565de 100644 (file)
@@ -145,16 +145,16 @@ func TestSyncFiles(t *testing.T) {
                                },
                        },
                        []string{
-                               `4: sync remote: files: "." (group): unchanged`,
-                               `4: sync remote: files: "dir" (group): will create`,
-                               `3: sync remote: files: "dir" (group): creating`,
-                               `4: sync remote: files: "dir" (group): creating directory`,
-                               `4: sync remote: files: "dir" (group): chmodding drwxr-xr-x`,
-                               fmt.Sprintf(`4: sync remote: files: "dir" (group): chowning %d/%d`, uid, gid),
-                               `4: sync remote: files: "dir/file" (group): will create`,
-                               `3: sync remote: files: "dir/file" (group): creating`,
-                               `4: sync remote: files: "dir/file" (group): creating temporary file "dir/.file*"`,
-                               `4: sync remote: files: "dir/file" (group): renaming "dir/.fileRND"`,
+                               `4: files: "." (group): unchanged`,
+                               `4: files: "dir" (group): will create`,
+                               `3: files: "dir" (group): creating`,
+                               `4: files: "dir" (group): creating directory`,
+                               `4: files: "dir" (group): chmodding drwxr-xr-x`,
+                               fmt.Sprintf(`4: files: "dir" (group): chowning %d/%d`, uid, gid),
+                               `4: files: "dir/file" (group): will create`,
+                               `3: files: "dir/file" (group): creating`,
+                               `4: files: "dir/file" (group): creating temporary file "dir/.file*"`,
+                               `4: files: "dir/file" (group): renaming "dir/.fileRND"`,
                        },
                        nil,
                },
@@ -207,9 +207,9 @@ func TestSyncFiles(t *testing.T) {
                        },
                        safcm.MsgSyncResp{},
                        []string{
-                               `4: sync remote: files: "." (group): unchanged`,
-                               `4: sync remote: files: "dir" (group): unchanged`,
-                               `4: sync remote: files: "dir/file" (group): unchanged`,
+                               `4: files: "." (group): unchanged`,
+                               `4: files: "dir" (group): unchanged`,
+                               `4: files: "dir/file" (group): unchanged`,
                        },
                        nil,
                },
@@ -305,9 +305,9 @@ func TestSyncFiles(t *testing.T) {
                        },
                        safcm.MsgSyncResp{},
                        []string{
-                               `4: sync remote: files: "/" (group): unchanged`,
-                               `4: sync remote: files: "/etc" (group): unchanged`,
-                               `4: sync remote: files: "/tmp" (group): unchanged`,
+                               `4: files: "/" (group): unchanged`,
+                               `4: files: "/etc" (group): unchanged`,
+                               `4: files: "/tmp" (group): unchanged`,
                        },
                        nil,
                },
@@ -369,9 +369,9 @@ func TestSyncFiles(t *testing.T) {
                        },
                        safcm.MsgSyncResp{},
                        []string{
-                               `4: sync remote: files: "." (group): unchanged`,
-                               `4: sync remote: files: "dir" (group): unchanged`,
-                               `4: sync remote: files: "dir/file" (group): unchanged`,
+                               `4: files: "." (group): unchanged`,
+                               `4: files: "dir" (group): unchanged`,
+                               `4: files: "dir/file" (group): unchanged`,
                        },
                        nil,
                },
@@ -456,12 +456,12 @@ func TestSyncFiles(t *testing.T) {
                                },
                        },
                        []string{
-                               `4: sync remote: files: "." (group): permission differs drwxr-x--- -> drwx------`,
-                               `3: sync remote: files: "." (group): updating`,
-                               `4: sync remote: files: "." (group): chmodding drwx------`,
-                               `3: sync remote: files: ".": queuing trigger on "."`,
-                               `4: sync remote: files: "dir" (group): unchanged`,
-                               `4: sync remote: files: "dir/file" (group): unchanged`,
+                               `4: files: "." (group): permission differs drwxr-x--- -> drwx------`,
+                               `3: files: "." (group): updating`,
+                               `4: files: "." (group): chmodding drwx------`,
+                               `3: files: ".": queuing trigger on "."`,
+                               `4: files: "dir" (group): unchanged`,
+                               `4: files: "dir/file" (group): unchanged`,
                        },
                        nil,
                },
@@ -546,13 +546,13 @@ func TestSyncFiles(t *testing.T) {
                                },
                        },
                        []string{
-                               `4: sync remote: files: "." (group): unchanged`,
-                               `4: sync remote: files: "dir" (group): permission differs drwxr-x--- -> drwxr-xr-x`,
-                               `3: sync remote: files: "dir" (group): updating`,
-                               `4: sync remote: files: "dir" (group): chmodding drwxr-xr-x`,
-                               `3: sync remote: files: "dir": queuing trigger on "."`,
-                               `3: sync remote: files: "dir": queuing trigger on "dir"`,
-                               `4: sync remote: files: "dir/file" (group): unchanged`,
+                               `4: files: "." (group): unchanged`,
+                               `4: files: "dir" (group): permission differs drwxr-x--- -> drwxr-xr-x`,
+                               `3: files: "dir" (group): updating`,
+                               `4: files: "dir" (group): chmodding drwxr-xr-x`,
+                               `3: files: "dir": queuing trigger on "."`,
+                               `3: files: "dir": queuing trigger on "dir"`,
+                               `4: files: "dir/file" (group): unchanged`,
                        },
                        nil,
                },
@@ -631,15 +631,15 @@ func TestSyncFiles(t *testing.T) {
                                },
                        },
                        []string{
-                               `4: sync remote: files: "." (group): unchanged`,
-                               `4: sync remote: files: "dir" (group): unchanged`,
-                               `4: sync remote: files: "dir/file" (group): will create`,
-                               `3: sync remote: files: "dir/file" (group): creating`,
-                               `4: sync remote: files: "dir/file" (group): creating temporary file "dir/.file*"`,
-                               `4: sync remote: files: "dir/file" (group): renaming "dir/.fileRND"`,
-                               `3: sync remote: files: "dir/file": queuing trigger on "."`,
-                               `3: sync remote: files: "dir/file": queuing trigger on "dir"`,
-                               `3: sync remote: files: "dir/file": queuing trigger on "dir/file"`,
+                               `4: files: "." (group): unchanged`,
+                               `4: files: "dir" (group): unchanged`,
+                               `4: files: "dir/file" (group): will create`,
+                               `3: files: "dir/file" (group): creating`,
+                               `4: files: "dir/file" (group): creating temporary file "dir/.file*"`,
+                               `4: files: "dir/file" (group): renaming "dir/.fileRND"`,
+                               `3: files: "dir/file": queuing trigger on "."`,
+                               `3: files: "dir/file": queuing trigger on "dir"`,
+                               `3: files: "dir/file": queuing trigger on "dir/file"`,
                        },
                        nil,
                },
@@ -727,21 +727,21 @@ func TestSyncFiles(t *testing.T) {
                                },
                        },
                        []string{
-                               `4: sync remote: files: "." (group): unchanged`,
-                               `4: sync remote: files: "dir" (group): will create`,
-                               `3: sync remote: files: "dir" (group): creating`,
-                               `4: sync remote: files: "dir" (group): creating directory`,
-                               `4: sync remote: files: "dir" (group): chmodding drwxr-xr-x`,
-                               fmt.Sprintf(`4: sync remote: files: "dir" (group): chowning %d/%d`, uid, gid),
-                               `3: sync remote: files: "dir": queuing trigger on "."`,
-                               `3: sync remote: files: "dir": queuing trigger on "dir"`,
-                               `4: sync remote: files: "dir/file" (group): will create`,
-                               `3: sync remote: files: "dir/file" (group): creating`,
-                               `4: sync remote: files: "dir/file" (group): creating temporary file "dir/.file*"`,
-                               `4: sync remote: files: "dir/file" (group): renaming "dir/.fileRND"`,
-                               `4: sync remote: files: "dir/file": skipping trigger on ".", already active`,
-                               `4: sync remote: files: "dir/file": skipping trigger on "dir", already active`,
-                               `3: sync remote: files: "dir/file": queuing trigger on "dir/file"`,
+                               `4: files: "." (group): unchanged`,
+                               `4: files: "dir" (group): will create`,
+                               `3: files: "dir" (group): creating`,
+                               `4: files: "dir" (group): creating directory`,
+                               `4: files: "dir" (group): chmodding drwxr-xr-x`,
+                               fmt.Sprintf(`4: files: "dir" (group): chowning %d/%d`, uid, gid),
+                               `3: files: "dir": queuing trigger on "."`,
+                               `3: files: "dir": queuing trigger on "dir"`,
+                               `4: files: "dir/file" (group): will create`,
+                               `3: files: "dir/file" (group): creating`,
+                               `4: files: "dir/file" (group): creating temporary file "dir/.file*"`,
+                               `4: files: "dir/file" (group): renaming "dir/.fileRND"`,
+                               `4: files: "dir/file": skipping trigger on ".", already active`,
+                               `4: files: "dir/file": skipping trigger on "dir", already active`,
+                               `3: files: "dir/file": queuing trigger on "dir/file"`,
                        },
                        nil,
                },
@@ -809,15 +809,15 @@ func TestSyncFiles(t *testing.T) {
                                },
                        },
                        []string{
-                               `4: sync remote: files: "/" (group): unchanged`,
-                               `4: sync remote: files: "/tmp" (group): unchanged`,
-                               `4: sync remote: files: "/tmp/safcm-sync-files-test-file" (group): will create`,
-                               `3: sync remote: files: "/tmp/safcm-sync-files-test-file" (group): creating`,
-                               `4: sync remote: files: "/tmp/safcm-sync-files-test-file" (group): creating temporary file "/tmp/.safcm-sync-files-test-file*"`,
-                               `4: sync remote: files: "/tmp/safcm-sync-files-test-file" (group): renaming "/tmp/.safcm-sync-files-test-fileRND"`,
-                               `3: sync remote: files: "/tmp/safcm-sync-files-test-file": queuing trigger on "/"`,
-                               `3: sync remote: files: "/tmp/safcm-sync-files-test-file": queuing trigger on "/tmp"`,
-                               `3: sync remote: files: "/tmp/safcm-sync-files-test-file": queuing trigger on "/tmp/safcm-sync-files-test-file"`,
+                               `4: files: "/" (group): unchanged`,
+                               `4: files: "/tmp" (group): unchanged`,
+                               `4: files: "/tmp/safcm-sync-files-test-file" (group): will create`,
+                               `3: files: "/tmp/safcm-sync-files-test-file" (group): creating`,
+                               `4: files: "/tmp/safcm-sync-files-test-file" (group): creating temporary file "/tmp/.safcm-sync-files-test-file*"`,
+                               `4: files: "/tmp/safcm-sync-files-test-file" (group): renaming "/tmp/.safcm-sync-files-test-fileRND"`,
+                               `3: files: "/tmp/safcm-sync-files-test-file": queuing trigger on "/"`,
+                               `3: files: "/tmp/safcm-sync-files-test-file": queuing trigger on "/tmp"`,
+                               `3: files: "/tmp/safcm-sync-files-test-file": queuing trigger on "/tmp/safcm-sync-files-test-file"`,
                        },
                        nil,
                },
@@ -960,10 +960,10 @@ func TestSyncFile(t *testing.T) {
                                },
                        },
                        []string{
-                               `4: sync remote: files: "file" (group): will create`,
-                               `3: sync remote: files: "file" (group): creating`,
-                               `4: sync remote: files: "file" (group): creating temporary file ".file*"`,
-                               `4: sync remote: files: "file" (group): renaming "./.fileRND"`,
+                               `4: files: "file" (group): will create`,
+                               `3: files: "file" (group): creating`,
+                               `4: files: "file" (group): creating temporary file ".file*"`,
+                               `4: files: "file" (group): renaming "./.fileRND"`,
                        },
                        nil,
                },
@@ -999,9 +999,9 @@ func TestSyncFile(t *testing.T) {
                                },
                        },
                        []string{
-                               `4: sync remote: files: "file" (group): will create`,
-                               `3: sync remote: files: "file" (group): creating`,
-                               `4: sync remote: files: "file" (group): dry-run, skipping changes`,
+                               `4: files: "file" (group): will create`,
+                               `3: files: "file" (group): creating`,
+                               `4: files: "file" (group): dry-run, skipping changes`,
                        },
                        nil,
                },
@@ -1031,7 +1031,7 @@ func TestSyncFile(t *testing.T) {
                        },
                        safcm.MsgSyncResp{},
                        []string{
-                               `4: sync remote: files: "file" (group): unchanged`,
+                               `4: files: "file" (group): unchanged`,
                        },
                        nil,
                },
@@ -1063,7 +1063,7 @@ func TestSyncFile(t *testing.T) {
                        },
                        safcm.MsgSyncResp{},
                        []string{
-                               `4: sync remote: files: "file" (group): unchanged`,
+                               `4: files: "file" (group): unchanged`,
                        },
                        nil,
                },
@@ -1113,10 +1113,10 @@ func TestSyncFile(t *testing.T) {
                                },
                        },
                        []string{
-                               `4: sync remote: files: "file" (group): permission differs -rwxr-xr-x -> urwxr-xr-x`,
-                               `3: sync remote: files: "file" (group): updating`,
-                               `4: sync remote: files: "file" (group): creating temporary file ".file*"`,
-                               `4: sync remote: files: "file" (group): renaming "./.fileRND"`,
+                               `4: files: "file" (group): permission differs -rwxr-xr-x -> urwxr-xr-x`,
+                               `3: files: "file" (group): updating`,
+                               `4: files: "file" (group): creating temporary file ".file*"`,
+                               `4: files: "file" (group): renaming "./.fileRND"`,
                        },
                        nil,
                },
@@ -1171,10 +1171,10 @@ func TestSyncFile(t *testing.T) {
                                },
                        },
                        []string{
-                               `4: sync remote: files: "file" (group): content differs`,
-                               `3: sync remote: files: "file" (group): updating`,
-                               `4: sync remote: files: "file" (group): creating temporary file ".file*"`,
-                               `4: sync remote: files: "file" (group): renaming "./.fileRND"`,
+                               `4: files: "file" (group): content differs`,
+                               `3: files: "file" (group): updating`,
+                               `4: files: "file" (group): creating temporary file ".file*"`,
+                               `4: files: "file" (group): renaming "./.fileRND"`,
                        },
                        nil,
                },
@@ -1218,10 +1218,10 @@ func TestSyncFile(t *testing.T) {
                                },
                        },
                        []string{
-                               `4: sync remote: files: "link" (group): will create`,
-                               `3: sync remote: files: "link" (group): creating`,
-                               `4: sync remote: files: "link" (group): creating temporary symlink ".linkRND"`,
-                               `4: sync remote: files: "link" (group): renaming ".linkRND"`,
+                               `4: files: "link" (group): will create`,
+                               `3: files: "link" (group): creating`,
+                               `4: files: "link" (group): creating temporary symlink ".linkRND"`,
+                               `4: files: "link" (group): renaming ".linkRND"`,
                        },
                        nil,
                },
@@ -1269,11 +1269,11 @@ func TestSyncFile(t *testing.T) {
                                },
                        },
                        []string{
-                               `4: sync remote: files: "link" (group): will create`,
-                               `3: sync remote: files: "link" (group): creating`,
-                               `4: sync remote: files: "link" (group): creating temporary symlink ".linkRND"`,
-                               `4: sync remote: files: "link" (group): creating temporary symlink ".linkRND"`,
-                               `4: sync remote: files: "link" (group): renaming ".linkRND"`,
+                               `4: files: "link" (group): will create`,
+                               `3: files: "link" (group): creating`,
+                               `4: files: "link" (group): creating temporary symlink ".linkRND"`,
+                               `4: files: "link" (group): creating temporary symlink ".linkRND"`,
+                               `4: files: "link" (group): renaming ".linkRND"`,
                        },
                        nil,
                },
@@ -1309,9 +1309,9 @@ func TestSyncFile(t *testing.T) {
                                },
                        },
                        []string{
-                               `4: sync remote: files: "link" (group): will create`,
-                               `3: sync remote: files: "link" (group): creating`,
-                               `4: sync remote: files: "link" (group): dry-run, skipping changes`,
+                               `4: files: "link" (group): will create`,
+                               `3: files: "link" (group): creating`,
+                               `4: files: "link" (group): dry-run, skipping changes`,
                        },
                        nil,
                },
@@ -1341,7 +1341,7 @@ func TestSyncFile(t *testing.T) {
                        },
                        safcm.MsgSyncResp{},
                        []string{
-                               `4: sync remote: files: "link" (group): unchanged`,
+                               `4: files: "link" (group): unchanged`,
                        },
                        nil,
                },
@@ -1395,10 +1395,10 @@ func TestSyncFile(t *testing.T) {
                                },
                        },
                        []string{
-                               `4: sync remote: files: "link" (group): content differs`,
-                               `3: sync remote: files: "link" (group): updating`,
-                               `4: sync remote: files: "link" (group): creating temporary symlink ".linkRND"`,
-                               `4: sync remote: files: "link" (group): renaming ".linkRND"`,
+                               `4: files: "link" (group): content differs`,
+                               `3: files: "link" (group): updating`,
+                               `4: files: "link" (group): creating temporary symlink ".linkRND"`,
+                               `4: files: "link" (group): renaming ".linkRND"`,
                        },
                        nil,
                },
@@ -1440,11 +1440,11 @@ func TestSyncFile(t *testing.T) {
                                },
                        },
                        []string{
-                               `4: sync remote: files: "dir" (group): will create`,
-                               `3: sync remote: files: "dir" (group): creating`,
-                               `4: sync remote: files: "dir" (group): creating directory`,
-                               `4: sync remote: files: "dir" (group): chmodding drwx---r-x`,
-                               fmt.Sprintf(`4: sync remote: files: "dir" (group): chowning %d/%d`, uid, gid),
+                               `4: files: "dir" (group): will create`,
+                               `3: files: "dir" (group): creating`,
+                               `4: files: "dir" (group): creating directory`,
+                               `4: files: "dir" (group): chmodding drwx---r-x`,
+                               fmt.Sprintf(`4: files: "dir" (group): chowning %d/%d`, uid, gid),
                        },
                        nil,
                },
@@ -1479,9 +1479,9 @@ func TestSyncFile(t *testing.T) {
                                },
                        },
                        []string{
-                               `4: sync remote: files: "dir" (group): will create`,
-                               `3: sync remote: files: "dir" (group): creating`,
-                               `4: sync remote: files: "dir" (group): dry-run, skipping changes`,
+                               `4: files: "dir" (group): will create`,
+                               `3: files: "dir" (group): creating`,
+                               `4: files: "dir" (group): dry-run, skipping changes`,
                        },
                        nil,
                },
@@ -1509,7 +1509,7 @@ func TestSyncFile(t *testing.T) {
                        },
                        safcm.MsgSyncResp{},
                        []string{
-                               `4: sync remote: files: "dir" (group): unchanged`,
+                               `4: files: "dir" (group): unchanged`,
                        },
                        nil,
                },
@@ -1557,9 +1557,9 @@ func TestSyncFile(t *testing.T) {
                                },
                        },
                        []string{
-                               `4: sync remote: files: "dir" (group): permission differs dtr-x------ -> dgrwxr-xr-x`,
-                               `3: sync remote: files: "dir" (group): updating`,
-                               `4: sync remote: files: "dir" (group): chmodding dgrwxr-xr-x`,
+                               `4: files: "dir" (group): permission differs dtr-x------ -> dgrwxr-xr-x`,
+                               `3: files: "dir" (group): updating`,
+                               `4: files: "dir" (group): chmodding dgrwxr-xr-x`,
                        },
                        nil,
                },
@@ -1613,12 +1613,12 @@ func TestSyncFile(t *testing.T) {
                                },
                        },
                        []string{
-                               `4: sync remote: files: "path" (group): type differs ---------- -> d---------`,
-                               `3: sync remote: files: "path" (group): updating`,
-                               `4: sync remote: files: "path" (group): removing (due to type change)`,
-                               `4: sync remote: files: "path" (group): creating directory`,
-                               `4: sync remote: files: "path" (group): chmodding drwxr-x--x`,
-                               fmt.Sprintf(`4: sync remote: files: "path" (group): chowning %d/%d`, uid, gid),
+                               `4: files: "path" (group): type differs ---------- -> d---------`,
+                               `3: files: "path" (group): updating`,
+                               `4: files: "path" (group): removing (due to type change)`,
+                               `4: files: "path" (group): creating directory`,
+                               `4: files: "path" (group): chmodding drwxr-x--x`,
+                               fmt.Sprintf(`4: files: "path" (group): chowning %d/%d`, uid, gid),
                        },
                        nil,
                },
@@ -1673,10 +1673,10 @@ func TestSyncFile(t *testing.T) {
                                },
                        },
                        []string{
-                               `4: sync remote: files: "path" (group): type differs ---------- -> L---------`,
-                               `3: sync remote: files: "path" (group): updating`,
-                               `4: sync remote: files: "path" (group): creating temporary symlink ".pathRND"`,
-                               `4: sync remote: files: "path" (group): renaming ".pathRND"`,
+                               `4: files: "path" (group): type differs ---------- -> L---------`,
+                               `3: files: "path" (group): updating`,
+                               `4: files: "path" (group): creating temporary symlink ".pathRND"`,
+                               `4: files: "path" (group): renaming ".pathRND"`,
                        },
                        nil,
                },
@@ -1731,10 +1731,10 @@ func TestSyncFile(t *testing.T) {
                                },
                        },
                        []string{
-                               `4: sync remote: files: "path" (group): type differs L--------- -> ----------`,
-                               `3: sync remote: files: "path" (group): updating`,
-                               `4: sync remote: files: "path" (group): creating temporary file ".path*"`,
-                               `4: sync remote: files: "path" (group): renaming "./.pathRND"`,
+                               `4: files: "path" (group): type differs L--------- -> ----------`,
+                               `3: files: "path" (group): updating`,
+                               `4: files: "path" (group): creating temporary file ".path*"`,
+                               `4: files: "path" (group): renaming "./.pathRND"`,
                        },
                        nil,
                },
@@ -1786,12 +1786,12 @@ func TestSyncFile(t *testing.T) {
                                },
                        },
                        []string{
-                               `4: sync remote: files: "path" (group): type differs L--------- -> d---------`,
-                               `3: sync remote: files: "path" (group): updating`,
-                               `4: sync remote: files: "path" (group): removing (due to type change)`,
-                               `4: sync remote: files: "path" (group): creating directory`,
-                               `4: sync remote: files: "path" (group): chmodding drwxr-x--x`,
-                               fmt.Sprintf(`4: sync remote: files: "path" (group): chowning %d/%d`, uid, gid),
+                               `4: files: "path" (group): type differs L--------- -> d---------`,
+                               `3: files: "path" (group): updating`,
+                               `4: files: "path" (group): removing (due to type change)`,
+                               `4: files: "path" (group): creating directory`,
+                               `4: files: "path" (group): chmodding drwxr-x--x`,
+                               fmt.Sprintf(`4: files: "path" (group): chowning %d/%d`, uid, gid),
                        },
                        nil,
                },
@@ -1841,11 +1841,11 @@ func TestSyncFile(t *testing.T) {
                                },
                        },
                        []string{
-                               `4: sync remote: files: "path" (group): type differs d--------- -> ----------`,
-                               `3: sync remote: files: "path" (group): updating`,
-                               `4: sync remote: files: "path" (group): removing (due to type change)`,
-                               `4: sync remote: files: "path" (group): creating temporary file ".path*"`,
-                               `4: sync remote: files: "path" (group): renaming "./.pathRND"`,
+                               `4: files: "path" (group): type differs d--------- -> ----------`,
+                               `3: files: "path" (group): updating`,
+                               `4: files: "path" (group): removing (due to type change)`,
+                               `4: files: "path" (group): creating temporary file ".path*"`,
+                               `4: files: "path" (group): renaming "./.pathRND"`,
                        },
                        nil,
                },
@@ -1895,11 +1895,11 @@ func TestSyncFile(t *testing.T) {
                                },
                        },
                        []string{
-                               `4: sync remote: files: "path" (group): type differs d--------- -> L---------`,
-                               `3: sync remote: files: "path" (group): updating`,
-                               `4: sync remote: files: "path" (group): removing (due to type change)`,
-                               `4: sync remote: files: "path" (group): creating temporary symlink ".pathRND"`,
-                               `4: sync remote: files: "path" (group): renaming ".pathRND"`,
+                               `4: files: "path" (group): type differs d--------- -> L---------`,
+                               `3: files: "path" (group): updating`,
+                               `4: files: "path" (group): removing (due to type change)`,
+                               `4: files: "path" (group): creating temporary symlink ".pathRND"`,
+                               `4: files: "path" (group): renaming ".pathRND"`,
                        },
                        nil,
                },
@@ -1949,10 +1949,10 @@ func TestSyncFile(t *testing.T) {
                                },
                        },
                        []string{
-                               `4: sync remote: files: "path" (group): type differs p--------- -> ----------`,
-                               `3: sync remote: files: "path" (group): updating`,
-                               `4: sync remote: files: "path" (group): creating temporary file ".path*"`,
-                               `4: sync remote: files: "path" (group): renaming "./.pathRND"`,
+                               `4: files: "path" (group): type differs p--------- -> ----------`,
+                               `3: files: "path" (group): updating`,
+                               `4: files: "path" (group): creating temporary file ".path*"`,
+                               `4: files: "path" (group): renaming "./.pathRND"`,
                        },
                        nil,
                },
@@ -2002,10 +2002,10 @@ func TestSyncFile(t *testing.T) {
                                },
                        },
                        []string{
-                               `4: sync remote: files: "path" (group): type differs p--------- -> L---------`,
-                               `3: sync remote: files: "path" (group): updating`,
-                               `4: sync remote: files: "path" (group): creating temporary symlink ".pathRND"`,
-                               `4: sync remote: files: "path" (group): renaming ".pathRND"`,
+                               `4: files: "path" (group): type differs p--------- -> L---------`,
+                               `3: files: "path" (group): updating`,
+                               `4: files: "path" (group): creating temporary symlink ".pathRND"`,
+                               `4: files: "path" (group): renaming ".pathRND"`,
                        },
                        nil,
                },
@@ -2053,12 +2053,12 @@ func TestSyncFile(t *testing.T) {
                                },
                        },
                        []string{
-                               `4: sync remote: files: "path" (group): type differs p--------- -> d---------`,
-                               `3: sync remote: files: "path" (group): updating`,
-                               `4: sync remote: files: "path" (group): removing (due to type change)`,
-                               `4: sync remote: files: "path" (group): creating directory`,
-                               `4: sync remote: files: "path" (group): chmodding drwxr-x--x`,
-                               fmt.Sprintf(`4: sync remote: files: "path" (group): chowning %d/%d`, uid, gid),
+                               `4: files: "path" (group): type differs p--------- -> d---------`,
+                               `3: files: "path" (group): updating`,
+                               `4: files: "path" (group): removing (due to type change)`,
+                               `4: files: "path" (group): creating directory`,
+                               `4: files: "path" (group): chmodding drwxr-x--x`,
+                               fmt.Sprintf(`4: files: "path" (group): chowning %d/%d`, uid, gid),
                        },
                        nil,
                },
@@ -2108,10 +2108,10 @@ func TestSyncFile(t *testing.T) {
                                },
                        },
                        []string{
-                               `4: sync remote: files: "path" (group): type differs ---------- -> L---------`,
-                               `3: sync remote: files: "path" (group): updating`,
-                               `4: sync remote: files: "path" (group): creating temporary symlink ".pathRND"`,
-                               `4: sync remote: files: "path" (group): renaming ".pathRND"`,
+                               `4: files: "path" (group): type differs ---------- -> L---------`,
+                               `3: files: "path" (group): updating`,
+                               `4: files: "path" (group): creating temporary symlink ".pathRND"`,
+                               `4: files: "path" (group): renaming ".pathRND"`,
                        },
                        nil,
                },
@@ -2189,9 +2189,9 @@ file
                                },
                        },
                        []string{
-                               `4: sync remote: files: "file" (group): content differs`,
-                               `3: sync remote: files: "file" (group): updating`,
-                               `4: sync remote: files: "file" (group): dry-run, skipping changes`,
+                               `4: files: "file" (group): content differs`,
+                               `3: files: "file" (group): updating`,
+                               `4: files: "file" (group): dry-run, skipping changes`,
                        },
                        nil,
                },
@@ -2244,9 +2244,9 @@ file
                                },
                        },
                        []string{
-                               `4: sync remote: files: "file" (group): content differs`,
-                               `3: sync remote: files: "file" (group): updating`,
-                               `4: sync remote: files: "file" (group): dry-run, skipping changes`,
+                               `4: files: "file" (group): content differs`,
+                               `3: files: "file" (group): updating`,
+                               `4: files: "file" (group): dry-run, skipping changes`,
                        },
                        nil,
                },
@@ -2303,9 +2303,9 @@ file
                                },
                        },
                        []string{
-                               `4: sync remote: files: "file" (group): content differs`,
-                               `3: sync remote: files: "file" (group): updating`,
-                               `4: sync remote: files: "file" (group): dry-run, skipping changes`,
+                               `4: files: "file" (group): content differs`,
+                               `3: files: "file" (group): updating`,
+                               `4: files: "file" (group): dry-run, skipping changes`,
                        },
                        nil,
                },
@@ -2362,9 +2362,9 @@ file
                                },
                        },
                        []string{
-                               `4: sync remote: files: "file" (group): content differs`,
-                               `3: sync remote: files: "file" (group): updating`,
-                               `4: sync remote: files: "file" (group): dry-run, skipping changes`,
+                               `4: files: "file" (group): content differs`,
+                               `3: files: "file" (group): updating`,
+                               `4: files: "file" (group): dry-run, skipping changes`,
                        },
                        nil,
                },
index a51a6a9d3f319abc966fbcec473a2c4e3a103d0d..97b8c6182d3f6a9727c05a680bb034ddabb04fff 100644 (file)
@@ -73,9 +73,9 @@ install ok installed  package-two
                                Stderr: &bytes.Buffer{},
                        }},
                        []string{
-                               "4: sync remote: packages: checking package-one package-two (debian detected)",
-                               `4: sync remote: packages: running "/usr/bin/dpkg-query" "--show" "--showformat=${Status}\\t${Package}\\n"`,
-                               `5: sync remote: packages: command stdout:
+                               "4: packages: checking package-one package-two (debian detected)",
+                               `4: packages: running "/usr/bin/dpkg-query" "--show" "--showformat=${Status}\\t${Package}\\n"`,
+                               `5: packages: command stdout:
 install ok installed   golang
 install ok installed   golang-1.16
 install ok installed   golang-1.16-doc
@@ -137,9 +137,9 @@ install ok installed        package-two
                                ),
                        }},
                        []string{
-                               "4: sync remote: packages: checking package-one package-two package-three (debian detected)",
-                               `4: sync remote: packages: running "/usr/bin/dpkg-query" "--show" "--showformat=${Status}\\t${Package}\\n"`,
-                               `5: sync remote: packages: command stdout:
+                               "4: packages: checking package-one package-two package-three (debian detected)",
+                               `4: packages: running "/usr/bin/dpkg-query" "--show" "--showformat=${Status}\\t${Package}\\n"`,
+                               `5: packages: command stdout:
 install ok installed   golang
 install ok installed   golang-1.16
 install ok installed   golang-1.16-doc
@@ -147,9 +147,9 @@ install ok installed        golang-1.16-go
 install ok installed   golang-1.16-src
 install ok installed   package-two
 `,
-                               "3: sync remote: packages: installing package-one package-three",
-                               `4: sync remote: packages: running "/usr/bin/apt-get" "install" "--assume-yes" "--no-upgrade" "--no-install-recommends" "-o" "Dpkg::Options::=--force-confdef" "-o" "Dpkg::Options::=--force-confold" "package-one" "package-three"`,
-                               "5: sync remote: packages: command output:\nfake stdout/stderr",
+                               "3: packages: installing package-one package-three",
+                               `4: packages: running "/usr/bin/apt-get" "install" "--assume-yes" "--no-upgrade" "--no-install-recommends" "-o" "Dpkg::Options::=--force-confdef" "-o" "Dpkg::Options::=--force-confold" "package-one" "package-three"`,
+                               "5: packages: command output:\nfake stdout/stderr",
                        },
                        safcm.MsgSyncResp{
                                PackageChanges: []safcm.PackageChange{
@@ -213,18 +213,18 @@ install ok installed      golang-1.16-src
                                ),
                        }},
                        []string{
-                               "4: sync remote: packages: checking package-one package-two (debian detected)",
-                               `4: sync remote: packages: running "/usr/bin/dpkg-query" "--show" "--showformat=${Status}\\t${Package}\\n"`,
-                               `5: sync remote: packages: command stdout:
+                               "4: packages: checking package-one package-two (debian detected)",
+                               `4: packages: running "/usr/bin/dpkg-query" "--show" "--showformat=${Status}\\t${Package}\\n"`,
+                               `5: packages: command stdout:
 install ok installed   golang
 install ok installed   golang-1.16
 install ok installed   golang-1.16-doc
 install ok installed   golang-1.16-go
 install ok installed   golang-1.16-src
 `,
-                               "3: sync remote: packages: installing package-one package-two",
-                               `4: sync remote: packages: running "/usr/bin/apt-get" "install" "--assume-yes" "--no-upgrade" "--no-install-recommends" "-o" "Dpkg::Options::=--force-confdef" "-o" "Dpkg::Options::=--force-confold" "package-one" "package-two"`,
-                               "5: sync remote: packages: command output:\nfake stdout/stderr",
+                               "3: packages: installing package-one package-two",
+                               `4: packages: running "/usr/bin/apt-get" "install" "--assume-yes" "--no-upgrade" "--no-install-recommends" "-o" "Dpkg::Options::=--force-confdef" "-o" "Dpkg::Options::=--force-confold" "package-one" "package-two"`,
+                               "5: packages: command output:\nfake stdout/stderr",
                        },
                        safcm.MsgSyncResp{
                                PackageChanges: []safcm.PackageChange{
@@ -269,9 +269,9 @@ install ok installed        golang-1.16-src
                                Stderr: &bytes.Buffer{},
                        }},
                        []string{
-                               "4: sync remote: packages: checking package-one package-two (debian detected)",
-                               `4: sync remote: packages: running "/usr/bin/dpkg-query" "--show" "--showformat=${Status}\\t${Package}\\n"`,
-                               `5: sync remote: packages: command stdout:
+                               "4: packages: checking package-one package-two (debian detected)",
+                               `4: packages: running "/usr/bin/dpkg-query" "--show" "--showformat=${Status}\\t${Package}\\n"`,
+                               `5: packages: command stdout:
 install ok installed   golang
 install ok installed   golang-1.16
 install ok installed   golang-1.16-doc
index cf0f4ab1de543c99738873fbcf4c11747bfaffa2..5aa36cd7bc38019eac8d947d374876cf05bf4f7b 100644 (file)
@@ -75,9 +75,9 @@ LoadError=
                                Stderr: &bytes.Buffer{},
                        }},
                        []string{
-                               "4: sync remote: services: checking service-one service-two (systemd detected)",
-                               `4: sync remote: services: running "/bin/systemctl" "show" "--property=ActiveState,UnitFileState,LoadError" "--" "service-one" "service-two"`,
-                               `5: sync remote: services: command stdout:
+                               "4: services: checking service-one service-two (systemd detected)",
+                               `4: services: running "/bin/systemctl" "show" "--property=ActiveState,UnitFileState,LoadError" "--" "service-one" "service-two"`,
+                               `5: services: command stdout:
 ActiveState=active
 UnitFileState=enabled
 LoadError=
@@ -125,9 +125,9 @@ LoadError= ""
                                Stderr: &bytes.Buffer{},
                        }},
                        []string{
-                               "4: sync remote: services: checking service-one service-two (systemd detected)",
-                               `4: sync remote: services: running "/bin/systemctl" "show" "--property=ActiveState,UnitFileState,LoadError" "--" "service-one" "service-two"`,
-                               `5: sync remote: services: command stdout:
+                               "4: services: checking service-one service-two (systemd detected)",
+                               `4: services: running "/bin/systemctl" "show" "--property=ActiveState,UnitFileState,LoadError" "--" "service-one" "service-two"`,
+                               `5: services: command stdout:
 ActiveState=active
 UnitFileState=enabled
 LoadError= ""
@@ -175,9 +175,9 @@ LoadError=
                                Stderr: &bytes.Buffer{},
                        }},
                        []string{
-                               "4: sync remote: services: checking service-does-not-exist service-two (systemd detected)",
-                               `4: sync remote: services: running "/bin/systemctl" "show" "--property=ActiveState,UnitFileState,LoadError" "--" "service-does-not-exist" "service-two"`,
-                               `5: sync remote: services: command stdout:
+                               "4: services: checking service-does-not-exist service-two (systemd detected)",
+                               `4: services: running "/bin/systemctl" "show" "--property=ActiveState,UnitFileState,LoadError" "--" "service-does-not-exist" "service-two"`,
+                               `5: services: command stdout:
 ActiveState=inactive
 UnitFileState=
 LoadError=org.freedesktop.systemd1.NoSuchUnit "Unit service-does-not-exist.service not found."
@@ -269,9 +269,9 @@ LoadError=
                                Stderr: &bytes.Buffer{},
                        }},
                        []string{
-                               "4: sync remote: services: checking service-one service-two service-three (systemd detected)",
-                               `4: sync remote: services: running "/bin/systemctl" "show" "--property=ActiveState,UnitFileState,LoadError" "--" "service-one" "service-two" "service-three"`,
-                               `5: sync remote: services: command stdout:
+                               "4: services: checking service-one service-two service-three (systemd detected)",
+                               `4: services: running "/bin/systemctl" "show" "--property=ActiveState,UnitFileState,LoadError" "--" "service-one" "service-two" "service-three"`,
+                               `5: services: command stdout:
 ActiveState=inactive
 UnitFileState=enabled
 LoadError=
@@ -284,12 +284,12 @@ ActiveState=failed
 UnitFileState=disabled
 LoadError=
 `,
-                               `4: sync remote: services: running "/bin/systemctl" "daemon-reload"`,
-                               "3: sync remote: services: starting service-one service-three",
-                               `4: sync remote: services: running "/bin/systemctl" "start" "--" "service-one" "service-three"`,
-                               "3: sync remote: services: enabling service-two service-three",
-                               `4: sync remote: services: running "/bin/systemctl" "enable" "--" "service-two" "service-three"`,
-                               "5: sync remote: services: command stderr:\nfake stderr",
+                               `4: services: running "/bin/systemctl" "daemon-reload"`,
+                               "3: services: starting service-one service-three",
+                               `4: services: running "/bin/systemctl" "start" "--" "service-one" "service-three"`,
+                               "3: services: enabling service-two service-three",
+                               `4: services: running "/bin/systemctl" "enable" "--" "service-two" "service-three"`,
+                               "5: services: command stderr:\nfake stderr",
                        },
                        safcm.MsgSyncResp{
                                ServiceChanges: []safcm.ServiceChange{
@@ -352,9 +352,9 @@ LoadError=
                                Stderr: &bytes.Buffer{},
                        }},
                        []string{
-                               "4: sync remote: services: checking service-one service-two service-three (systemd detected)",
-                               `4: sync remote: services: running "/bin/systemctl" "show" "--property=ActiveState,UnitFileState,LoadError" "--" "service-one" "service-two" "service-three"`,
-                               `5: sync remote: services: command stdout:
+                               "4: services: checking service-one service-two service-three (systemd detected)",
+                               `4: services: running "/bin/systemctl" "show" "--property=ActiveState,UnitFileState,LoadError" "--" "service-one" "service-two" "service-three"`,
+                               `5: services: command stdout:
 ActiveState=inactive
 UnitFileState=enabled
 LoadError=
@@ -457,9 +457,9 @@ LoadError=
                                Stderr: &bytes.Buffer{},
                        }},
                        []string{
-                               "4: sync remote: services: checking service-one service-two service-three (systemd detected)",
-                               `4: sync remote: services: running "/bin/systemctl" "show" "--property=ActiveState,UnitFileState,LoadError" "--" "service-one" "service-two" "service-three"`,
-                               `5: sync remote: services: command stdout:
+                               "4: services: checking service-one service-two service-three (systemd detected)",
+                               `4: services: running "/bin/systemctl" "show" "--property=ActiveState,UnitFileState,LoadError" "--" "service-one" "service-two" "service-three"`,
+                               `5: services: command stdout:
 ActiveState=inactive
 UnitFileState=enabled
 LoadError=
@@ -472,10 +472,10 @@ ActiveState=failed
 UnitFileState=disabled
 LoadError=
 `,
-                               `4: sync remote: services: running "/bin/systemctl" "daemon-reload"`,
-                               "3: sync remote: services: starting service-one service-three",
-                               `4: sync remote: services: running "/bin/systemctl" "start" "--" "service-one" "service-three"`,
-                               "5: sync remote: services: command stderr:\nfake stderr",
+                               `4: services: running "/bin/systemctl" "daemon-reload"`,
+                               "3: services: starting service-one service-three",
+                               `4: services: running "/bin/systemctl" "start" "--" "service-one" "service-three"`,
+                               "5: services: command stderr:\nfake stderr",
                        },
                        safcm.MsgSyncResp{
                                ServiceChanges: []safcm.ServiceChange{
index 706791f3969e0dbc98e02d9b0d5f6a9b873ebbb3..91e24fda2bdbedd4c8bda6c34beed69f2ec4c1ce 100644 (file)
@@ -40,41 +40,39 @@ type Sync struct {
        log *log.Logger
 }
 
-const logPrefix = "sync remote:"
-
 func Handle(req safcm.MsgSyncReq,
        runner run.Runner, fun log.LogFunc) safcm.MsgSyncResp {
 
        s := &Sync{
                req: req,
-               log: log.NewLogger(logPrefix, fun),
+               log: log.NewLogger(fun),
        }
        s.cmd = run.NewCmd(runner, s.log)
 
        err := s.setDefaults()
        if err != nil {
-               s.resp.Error = fmt.Sprintf("%s %s", logPrefix, err)
+               s.resp.Error = fmt.Sprintf("%s", err)
                return s.resp
        }
 
        err = s.syncFiles()
        if err != nil {
-               s.resp.Error = fmt.Sprintf("%s files: %s", logPrefix, err)
+               s.resp.Error = fmt.Sprintf("files: %s", err)
                return s.resp
        }
        err = s.syncPackages()
        if err != nil {
-               s.resp.Error = fmt.Sprintf("%s packages: %s", logPrefix, err)
+               s.resp.Error = fmt.Sprintf("packages: %s", err)
                return s.resp
        }
        err = s.syncServices()
        if err != nil {
-               s.resp.Error = fmt.Sprintf("%s services: %s", logPrefix, err)
+               s.resp.Error = fmt.Sprintf("services: %s", err)
                return s.resp
        }
        err = s.syncCommands()
        if err != nil {
-               s.resp.Error = fmt.Sprintf("%s commands: %s", logPrefix, err)
+               s.resp.Error = fmt.Sprintf("commands: %s", err)
                return s.resp
        }
        return s.resp
index 17ba044b2e5e75d44530809d055ab9a600054d4c..2571340d43d7fce341c1ca693ea1bd3af9f310f3 100644 (file)
@@ -123,7 +123,7 @@ func prepareSync(req safcm.MsgSyncReq, runner *testRunner) (
                res.wg.Done()
        }()
 
-       logger := log.NewLogger(logPrefix,
+       logger := log.NewLogger(
                func(level safcm.LogLevel, msg string) {
                        res.ch <- fmt.Sprintf("%d: %s", level, msg)
                })
index 8726307cba408a1002722bd2a7dc1e17d09ee524..16aad166cb5c854842453f89659901dfd959f3d7 100644 (file)
@@ -177,9 +177,9 @@ func TestSyncSshEndToEnd(t *testing.T) {
                        `<LOG>[info]    [no-changes.example.org] remote helper upload in progress
 <LOG>[verbose] [no-changes.example.org] host groups: all <DET> <DET> no-changes.example.org
 <LOG>[verbose] [no-changes.example.org] host group priorities (descending): no-changes.example.org
-<LOG>[debug]   [no-changes.example.org] sync remote: files: "/" (no-changes.example.org): unchanged
-<LOG>[debug]   [no-changes.example.org] sync remote: files: "/etc" (no-changes.example.org): unchanged
-<LOG>[debug]   [no-changes.example.org] sync remote: files: "/tmp" (no-changes.example.org): unchanged
+<LOG>[debug]   [no-changes.example.org] files: "/" (no-changes.example.org): unchanged
+<LOG>[debug]   [no-changes.example.org] files: "/etc" (no-changes.example.org): unchanged
+<LOG>[debug]   [no-changes.example.org] files: "/tmp" (no-changes.example.org): unchanged
 <LOG>[info]    [no-changes.example.org] no changes
 `,
                        nil,
@@ -202,9 +202,9 @@ func TestSyncSshEndToEnd(t *testing.T) {
                        `<LOG>[info]    [no-changes.example.org] remote helper upload in progress
 <LOG>[verbose] [no-changes.example.org] host groups: all <DET> <DET> no-changes.example.org
 <LOG>[verbose] [no-changes.example.org] host group priorities (descending): no-changes.example.org
-<LOG>[debug]   [no-changes.example.org] sync remote: files: "/" (no-changes.example.org): unchanged
-<LOG>[debug]   [no-changes.example.org] sync remote: files: "/etc" (no-changes.example.org): unchanged
-<LOG>[debug]   [no-changes.example.org] sync remote: files: "/tmp" (no-changes.example.org): unchanged
+<LOG>[debug]   [no-changes.example.org] files: "/" (no-changes.example.org): unchanged
+<LOG>[debug]   [no-changes.example.org] files: "/etc" (no-changes.example.org): unchanged
+<LOG>[debug]   [no-changes.example.org] files: "/tmp" (no-changes.example.org): unchanged
 <LOG>[info]    [no-changes.example.org] no changes
 `,
                        nil,
@@ -260,10 +260,10 @@ executed 2 command(s):
                        `<LOG>[info]    [no-effect-commands.example.org] remote helper upload in progress
 <LOG>[verbose] [no-effect-commands.example.org] host groups: all <DET> <DET> no-effect-commands.example.org
 <LOG>[verbose] [no-effect-commands.example.org] host group priorities (descending): no-effect-commands.example.org
-<LOG>[verbose] [no-effect-commands.example.org] sync remote: commands: running "/bin/sh" "-c" "echo this is a command" (no-effect-commands.example.org)
-<LOG>[debug2]  [no-effect-commands.example.org] sync remote: commands: command output:
+<LOG>[verbose] [no-effect-commands.example.org] commands: running "/bin/sh" "-c" "echo this is a command" (no-effect-commands.example.org)
+<LOG>[debug2]  [no-effect-commands.example.org] commands: command output:
 this is a command
-<LOG>[verbose] [no-effect-commands.example.org] sync remote: commands: running "/bin/sh" "-c" "true" (no-effect-commands.example.org)
+<LOG>[verbose] [no-effect-commands.example.org] commands: running "/bin/sh" "-c" "true" (no-effect-commands.example.org)
 <LOG>[info]    [no-effect-commands.example.org] 
 executed 2 command(s):
 "echo this is a command":
@@ -313,7 +313,7 @@ executed 2 command(s):
    > this is a command
 "echo failing; false", failed: "exit status 1":
    > failing
-<LOG>[error]   [no-effect-commands-failing.example.org] sync remote: commands: "echo failing; false" failed: exit status 1
+<LOG>[error]   [no-effect-commands-failing.example.org] commands: "echo failing; false" failed: exit status 1
 `,
                        fmt.Errorf("exit status 1"),
                },
@@ -325,11 +325,11 @@ executed 2 command(s):
                        `<LOG>[info]    [no-effect-commands-failing.example.org] remote helper upload in progress
 <LOG>[verbose] [no-effect-commands-failing.example.org] host groups: all <DET> <DET> no-effect-commands-failing.example.org
 <LOG>[verbose] [no-effect-commands-failing.example.org] host group priorities (descending): no-effect-commands-failing.example.org
-<LOG>[verbose] [no-effect-commands-failing.example.org] sync remote: commands: running "/bin/sh" "-c" "echo this is a command" (no-effect-commands-failing.example.org)
-<LOG>[debug2]  [no-effect-commands-failing.example.org] sync remote: commands: command output:
+<LOG>[verbose] [no-effect-commands-failing.example.org] commands: running "/bin/sh" "-c" "echo this is a command" (no-effect-commands-failing.example.org)
+<LOG>[debug2]  [no-effect-commands-failing.example.org] commands: command output:
 this is a command
-<LOG>[verbose] [no-effect-commands-failing.example.org] sync remote: commands: running "/bin/sh" "-c" "echo failing; false" (no-effect-commands-failing.example.org)
-<LOG>[debug2]  [no-effect-commands-failing.example.org] sync remote: commands: command output:
+<LOG>[verbose] [no-effect-commands-failing.example.org] commands: running "/bin/sh" "-c" "echo failing; false" (no-effect-commands-failing.example.org)
+<LOG>[debug2]  [no-effect-commands-failing.example.org] commands: command output:
 failing
 <LOG>[info]    [no-effect-commands-failing.example.org] 
 executed 2 command(s):
@@ -337,7 +337,7 @@ executed 2 command(s):
    > this is a command
 "echo failing; false", failed: "exit status 1":
    > failing
-<LOG>[error]   [no-effect-commands-failing.example.org] sync remote: commands: "echo failing; false" failed: exit status 1
+<LOG>[error]   [no-effect-commands-failing.example.org] commands: "echo failing; false" failed: exit status 1
 `,
                        fmt.Errorf("exit status 1"),
                },