Skip to content

Commit

Permalink
Better info messages when target config is out of sync
Browse files Browse the repository at this point in the history
  • Loading branch information
kelseyhightower committed Nov 1, 2013
1 parent 37412dd commit db338ee
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion template_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func (t *TemplateResource) sync() error {
log.Error(err.Error())
}
if !ok {
log.Info(t.Dest + " not in sync")
log.Info("syncing " + t.Dest)
if t.CheckCmd != "" {
if err := t.check(); err != nil {
return errors.New("Config check failed: " + err.Error())
Expand Down Expand Up @@ -271,6 +271,18 @@ func sameConfig(src, dest string) (bool, error) {
if err != nil {
return false, err
}
if d.Uid != s.Uid {
log.Info(fmt.Sprintf("%s has UID %d should be %d", dest, d.Uid, s.Uid))
}
if d.Gid != s.Gid {
log.Info(fmt.Sprintf("%s has GID %d should be %d", dest, d.Gid, s.Gid))
}
if d.Mode != s.Mode {
log.Info(fmt.Sprintf("%s has mode %s should be %s", dest, os.FileMode(d.Mode), os.FileMode(s.Mode)))
}
if d.Md5 != s.Md5 {
log.Info(fmt.Sprintf("%s has md5sum %s should be %s", dest, d.Md5, s.Md5))
}
if d.Uid != s.Uid || d.Gid != s.Gid || d.Mode != s.Mode || d.Md5 != s.Md5 {
return false, nil
}
Expand Down

0 comments on commit db338ee

Please sign in to comment.