Warn on infrastructure-roles.yaml format violations (#177)

Emit a warning if there are unprocessed entries in the infrastructure-roles secret.
This commit is contained in:
zerg-junior 2017-12-15 17:21:41 +01:00 committed by Oleksii Kliukin
parent 5d5fa680a3
commit 3c178f68df
2 changed files with 12 additions and 0 deletions

View File

@ -1,5 +1,9 @@
apiVersion: v1
data:
# required format (w/o quotes): 'propertyNumber: value'
# allowed properties: 'user', 'password', 'inrole'
# numbers >= 1 are mandatory
# robot_zmon_acid_monitoring
user1: cm9ib3Rfem1vbl9hY2lkX21vbml0b3Jpbmc=
# robot_zmon

View File

@ -137,6 +137,8 @@ Users:
c.logger.Warningf("unknown key %q", p)
}
}
delete(data, key)
}
if t.Name != "" {
@ -144,6 +146,12 @@ Users:
}
}
if len(data) != 0 {
c.logger.Warningf("%d unprocessed entries in the infrastructure roles' secret", len(data))
c.logger.Info(`infrastructure role entries should be in the {key}{id} format, where {key} can be either of "user", "password", "inrole" and the {id} a monotonically increasing integer starting with 1`)
c.logger.Debugf("unprocessed entries: %#v", data)
}
return result, nil
}