X-Git-Url: https://ruderich.org/simon/gitweb/?a=blobdiff_plain;f=cmd%2Fsafcm%2Fsync_sync.go;h=8b4cec45d0ba837cc490ac332a9b5d124883c136;hb=20686d0d25d7d22f577fc80df31c192b6a88d318;hp=e84b7f416c07b84df027f017c826d8b381324d4a;hpb=f2f2bc47e8729548f3c10117f7f008b547c4afc5;p=safcm%2Fsafcm.git diff --git a/cmd/safcm/sync_sync.go b/cmd/safcm/sync_sync.go index e84b7f4..8b4cec4 100644 --- a/cmd/safcm/sync_sync.go +++ b/cmd/safcm/sync_sync.go @@ -19,6 +19,7 @@ package main import ( "fmt" + "math" "os" "path/filepath" "sort" @@ -44,26 +45,9 @@ func (s *Sync) hostSync(conn *rpc.Conn, detectedGroups []string) error { } // Display changes - var changes []string - if len(resp.FileChanges) > 0 { - changes = append(changes, - s.formatFileChanges(resp.FileChanges)) - } - if len(resp.PackageChanges) > 0 { - changes = append(changes, - s.formatPackageChanges(resp.PackageChanges)) - } - if len(resp.ServiceChanges) > 0 { - changes = append(changes, - s.formatServiceChanges(resp.ServiceChanges)) - } - if len(resp.CommandChanges) > 0 { - changes = append(changes, - s.formatCommandChanges(resp.CommandChanges)) - } - if len(changes) > 0 { - s.logf(safcm.LogInfo, true, "%s", - "\n"+strings.Join(changes, "\n")) + changes := s.formatChanges(resp) + if changes != "" { + s.logf(safcm.LogInfo, true, "%s", changes) } if resp.Error != "" { @@ -108,7 +92,7 @@ func (s *Sync) hostSyncReq(detectedGroups []string) ( allFiles := make(map[string]*safcm.File) allPackagesMap := make(map[string]bool) // map to deduplicate allServicesMap := make(map[string]bool) // map to deduplicate - var allCommands []string + var allCommands []*safcm.Command for _, group := range groups { // Skip non-existent group directories @@ -205,10 +189,10 @@ func (s *Sync) resolveHostGroups(detectedGroups []string) ( // Early entries have higher priorities groupPriority := make(map[string]int) for i, x := range s.config.GroupOrder { - groupPriority[x] = i + 1 + groupPriority[x] = math.MinInt32 + i + 1 } // Host itself always has highest priority - groupPriority[s.host.Name] = -1 + groupPriority[s.host.Name] = math.MinInt32 // Sort groups after priority and name sort.Slice(groups, func(i, j int) bool {