@@ -92,7 +92,7 @@ func Initialize() {
9292
9393 Namespace = os .Getenv ("NAMESPACE" )
9494 if Namespace == "" {
95- log .Error ("NAMESPACE env var is required" )
95+ log .Error ("NAMESPACE environment variable is required" )
9696 os .Exit (2 )
9797 }
9898 log .Info ("Namespace is [" + Namespace + "]" )
@@ -180,7 +180,7 @@ func initConfig() {
180180 os .Exit (2 )
181181 }
182182 }
183- log .Infof ("BasicAuth is %v\n " , BasicAuth )
183+ log .Infof ("BasicAuth is %v" , BasicAuth )
184184
185185 if ! validStorageSettings () {
186186 log .Error ("Storage Settings are not defined correctly, can't continue" )
@@ -245,7 +245,7 @@ func validateCredentials() error {
245245 var err error
246246
247247 for _ , v := range Credentials {
248- log .Infof ("validating user %s and role %s " , v .Username , v .Role )
248+ log .Infof ("validating user %s and role %s" , v .Username , v .Role )
249249 if RoleMap [v .Role ] == nil {
250250 errMsg := fmt .Sprintf ("role not found on pgouser user [%s], invalid role was [%s]" , v .Username , v .Role )
251251 log .Error (errMsg )
@@ -280,11 +280,11 @@ func BasicAuthzCheck(username, perm string) bool {
280280 if creds == (CredentialDetail {}) {
281281 //this means username not found in pgouser file
282282 //should not happen at this point in code!
283- log .Error ("%s not found in pgouser file\n " , username )
283+ log .Error ("%s not found in pgouser file" , username )
284284 return false
285285 }
286286
287- log .Infof (" BasicAuthzCheck %s %s %v\n " , creds .Role , perm , HasPerm (creds .Role , perm ))
287+ log .Infof ("BasicAuthzCheck %s %s %v" , creds .Role , perm , HasPerm (creds .Role , perm ))
288288 return HasPerm (creds .Role , perm )
289289
290290}
@@ -295,34 +295,34 @@ func Authn(perm string, w http.ResponseWriter, r *http.Request) error {
295295
296296 username , password , authOK := r .BasicAuth ()
297297 if AuditFlag {
298- log .Infof ("[audit] %s username=[%s] method=[%s] ip=[%s]\n " , perm , username , r .Method , r .RemoteAddr )
298+ log .Infof ("[audit] %s username=[%s] method=[%s] ip=[%s]" , perm , username , r .Method , r .RemoteAddr )
299299 }
300300
301- log .Debugf ("Authn Attempt %s username=[%s]\n " , perm , username )
301+ log .Debugf ("Authentication Attempt %s username=[%s]" , perm , username )
302302 if authOK == false {
303303 http .Error (w , "Not authorized" , 401 )
304304 return errors .New ("Not Authorized" )
305305 }
306306
307307 if ! BasicAuthCheck (username , password ) {
308- log .Errorf ("Authn Failed %s username=[%s]\n " , perm , username )
308+ log .Errorf ("Authentication Failed %s username=[%s]" , perm , username )
309309 http .Error (w , "Not authenticated in apiserver" , 401 )
310310 return errors .New ("Not Authenticated" )
311311 }
312312
313313 if ! BasicAuthzCheck (username , perm ) {
314- log .Errorf ("Authn Failed %s username=[%s]\n " , perm , username )
314+ log .Errorf ("Authentication Failed %s username=[%s]" , perm , username )
315315 http .Error (w , "Not authorized for this apiserver action" , 401 )
316- return errors .New ("Not Authorized for this apiserver action" )
316+ return errors .New ("Not authorized for this apiserver action" )
317317 }
318318
319- log .Debug ("Authn Success" )
319+ log .Debug ("Authentication Success" )
320320 return err
321321
322322}
323323
324324func validContainerResourcesSettings () bool {
325- log .Infof ("ContainerResources has %d definitions \n " , len (Pgo .ContainerResources ))
325+ log .Infof ("ContainerResources has %d definitions" , len (Pgo .ContainerResources ))
326326
327327 //validate any Container Resources in pgo.yaml for correct formats
328328 if ! IsValidContainerResourceValues () {
@@ -348,7 +348,7 @@ func validContainerResourcesSettings() bool {
348348}
349349
350350func validStorageSettings () bool {
351- log .Infof ("Storage has %d definitions\n " , len (Pgo .Storage ))
351+ log .Infof ("Storage has %d definitions" , len (Pgo .Storage ))
352352
353353 ps := Pgo .PrimaryStorage
354354 if IsValidStorageName (ps ) {
@@ -420,26 +420,26 @@ func IsValidContainerResourceValues() bool {
420420 var err error
421421
422422 for k , v := range Pgo .ContainerResources {
423- log .Infof ("Container Resources %s [%v]\n " , k , v )
423+ log .Infof ("Container Resources %s [%v]" , k , v )
424424 resources , _ := Pgo .GetContainerResource (k )
425425 _ , err = resource .ParseQuantity (resources .RequestsMemory )
426426 if err != nil {
427- log .Errorf ("%s.RequestsMemory value invalid format\n " , k )
427+ log .Errorf ("%s.RequestsMemory value invalid format" , k )
428428 return false
429429 }
430430 _ , err = resource .ParseQuantity (resources .RequestsCPU )
431431 if err != nil {
432- log .Errorf ("%s.RequestsCPU value invalid format\n " , k )
432+ log .Errorf ("%s.RequestsCPU value invalid format" , k )
433433 return false
434434 }
435435 _ , err = resource .ParseQuantity (resources .LimitsMemory )
436436 if err != nil {
437- log .Errorf ("%s.LimitsMemory value invalid format\n " , k )
437+ log .Errorf ("%s.LimitsMemory value invalid format" , k )
438438 return false
439439 }
440440 _ , err = resource .ParseQuantity (resources .LimitsCPU )
441441 if err != nil {
442- log .Errorf ("%s.LimitsCPU value invalid format\n " , k )
442+ log .Errorf ("%s.LimitsCPU value invalid format" , k )
443443 return false
444444 }
445445 }
0 commit comments