]> ruderich.org/simon Gitweb - safcm/safcm.git/commitdiff
safcm: shorten error message on file conflict
authorSimon Ruderich <simon@ruderich.org>
Sun, 9 May 2021 10:55:54 +0000 (12:55 +0200)
committerSimon Ruderich <simon@ruderich.org>
Sun, 9 May 2021 13:21:13 +0000 (15:21 +0200)
It's obvious that the message talks about "files" because the path is
given immediately afterwards.

cmd/safcm/sync_sync.go
cmd/safcm/sync_sync_test.go

index 88c93beb85c5c39fbdb1a73c3c80f0dab1842d0f..385cfd9a2494bef298a2633bfee634c992e9bf36 100644 (file)
@@ -241,7 +241,7 @@ func (s *Sync) checkFileConflict(group string, path string, file *safcm.File,
                return nil
        }
 
-       return fmt.Errorf("groups %s and %s both provide file %q\n"+
+       return fmt.Errorf("groups %s and %s both provide %q\n"+
                "Use 'group_priority' in config.yaml to declare preference",
                group, old.OrigGroup, path)
 }
index f0e7524e8186a6d803c6d8e5ac326e95f722a93e..e50a7284d1843f26138d693bce78af4df5bfd9b9 100644 (file)
@@ -267,7 +267,7 @@ func TestHostSyncReq(t *testing.T) {
                                "host1.example.org: <nil> 3 host groups: all dns host1.example.org",
                                "host1.example.org: <nil> 3 host group priorities (descending): host1.example.org",
                        },
-                       fmt.Errorf("groups dns and all both provide file \"/etc/resolv.conf\"\nUse 'group_priority' in config.yaml to declare preference"),
+                       fmt.Errorf("groups dns and all both provide \"/etc/resolv.conf\"\nUse 'group_priority' in config.yaml to declare preference"),
                },
                {
                        "conflict: file from detected group",
@@ -282,7 +282,7 @@ func TestHostSyncReq(t *testing.T) {
                                "host2.example.org: <nil> 3 host groups: all detected_other host2.example.org other",
                                "host2.example.org: <nil> 3 host group priorities (descending): host2.example.org",
                        },
-                       fmt.Errorf("groups other and all both provide file \"/etc/resolv.conf\"\nUse 'group_priority' in config.yaml to declare preference"),
+                       fmt.Errorf("groups other and all both provide \"/etc/resolv.conf\"\nUse 'group_priority' in config.yaml to declare preference"),
                },
 
                {
@@ -296,7 +296,7 @@ func TestHostSyncReq(t *testing.T) {
                                "host1.example.org: <nil> 3 host groups: all dns host1.example.org",
                                "host1.example.org: <nil> 3 host group priorities (descending): host1.example.org",
                        },
-                       fmt.Errorf("groups dns and all both provide file \"/etc\"\nUse 'group_priority' in config.yaml to declare preference"),
+                       fmt.Errorf("groups dns and all both provide \"/etc\"\nUse 'group_priority' in config.yaml to declare preference"),
                },
                {
                        "conflict: dir from detected group",
@@ -311,7 +311,7 @@ func TestHostSyncReq(t *testing.T) {
                                "host2.example.org: <nil> 3 host groups: all detected_other host2.example.org other",
                                "host2.example.org: <nil> 3 host group priorities (descending): host2.example.org",
                        },
-                       fmt.Errorf("groups other and all both provide file \"/etc\"\nUse 'group_priority' in config.yaml to declare preference"),
+                       fmt.Errorf("groups other and all both provide \"/etc\"\nUse 'group_priority' in config.yaml to declare preference"),
                },
 
                {