From d961228e4fd8549b832fe88636072cb874b7fb0c Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Sun, 9 May 2021 12:55:54 +0200 Subject: [PATCH] safcm: shorten error message on file conflict It's obvious that the message talks about "files" because the path is given immediately afterwards. --- cmd/safcm/sync_sync.go | 2 +- cmd/safcm/sync_sync_test.go | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cmd/safcm/sync_sync.go b/cmd/safcm/sync_sync.go index 88c93be..385cfd9 100644 --- a/cmd/safcm/sync_sync.go +++ b/cmd/safcm/sync_sync.go @@ -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) } diff --git a/cmd/safcm/sync_sync_test.go b/cmd/safcm/sync_sync_test.go index f0e7524..e50a728 100644 --- a/cmd/safcm/sync_sync_test.go +++ b/cmd/safcm/sync_sync_test.go @@ -267,7 +267,7 @@ func TestHostSyncReq(t *testing.T) { "host1.example.org: 3 host groups: all dns host1.example.org", "host1.example.org: 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: 3 host groups: all detected_other host2.example.org other", "host2.example.org: 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: 3 host groups: all dns host1.example.org", "host1.example.org: 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: 3 host groups: all detected_other host2.example.org other", "host2.example.org: 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"), }, { -- 2.43.2