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:
		
							parent
							
								
									5d5fa680a3
								
							
						
					
					
						commit
						3c178f68df
					
				|  | @ -1,5 +1,9 @@ | ||||||
| apiVersion: v1 | apiVersion: v1 | ||||||
| data: | data: | ||||||
|  |   # required format (w/o quotes): 'propertyNumber: value' | ||||||
|  |   # allowed properties: 'user', 'password', 'inrole' | ||||||
|  |   # numbers >= 1 are mandatory | ||||||
|  |    | ||||||
|   # robot_zmon_acid_monitoring |   # robot_zmon_acid_monitoring | ||||||
|   user1: cm9ib3Rfem1vbl9hY2lkX21vbml0b3Jpbmc= |   user1: cm9ib3Rfem1vbl9hY2lkX21vbml0b3Jpbmc= | ||||||
|   # robot_zmon |   # robot_zmon | ||||||
|  |  | ||||||
|  | @ -137,6 +137,8 @@ Users: | ||||||
| 					c.logger.Warningf("unknown key %q", p) | 					c.logger.Warningf("unknown key %q", p) | ||||||
| 				} | 				} | ||||||
| 			} | 			} | ||||||
|  | 
 | ||||||
|  | 			delete(data, key) | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		if t.Name != "" { | 		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 | 	return result, nil | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue