mirror of
				https://github.com/moby/moby.git
				synced 2022-11-09 12:21:53 -05:00 
			
		
		
		
	Fix post config verification without flags.
- Set the daemon log level to what's set in the configuration. - Enable TLS when TLSVerify is enabled. Signed-off-by: David Calavera <david.calavera@gmail.com>
This commit is contained in:
		
							parent
							
								
									97d84623cf
								
							
						
					
					
						commit
						ba01d9f9d6
					
				
					 4 changed files with 176 additions and 19 deletions
				
			
		| 
						 | 
				
			
			@ -55,16 +55,7 @@ func init() {
 | 
			
		|||
func postParseCommon() {
 | 
			
		||||
	cmd := commonFlags.FlagSet
 | 
			
		||||
 | 
			
		||||
	if commonFlags.LogLevel != "" {
 | 
			
		||||
		lvl, err := logrus.ParseLevel(commonFlags.LogLevel)
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			fmt.Fprintf(os.Stderr, "Unable to parse logging level: %s\n", commonFlags.LogLevel)
 | 
			
		||||
			os.Exit(1)
 | 
			
		||||
		}
 | 
			
		||||
		logrus.SetLevel(lvl)
 | 
			
		||||
	} else {
 | 
			
		||||
		logrus.SetLevel(logrus.InfoLevel)
 | 
			
		||||
	}
 | 
			
		||||
	setDaemonLogLevel(commonFlags.LogLevel)
 | 
			
		||||
 | 
			
		||||
	// Regardless of whether the user sets it to true or false, if they
 | 
			
		||||
	// specify --tlsverify at all then we need to turn on tls
 | 
			
		||||
| 
						 | 
				
			
			@ -93,3 +84,16 @@ func postParseCommon() {
 | 
			
		|||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func setDaemonLogLevel(logLevel string) {
 | 
			
		||||
	if logLevel != "" {
 | 
			
		||||
		lvl, err := logrus.ParseLevel(logLevel)
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			fmt.Fprintf(os.Stderr, "Unable to parse logging level: %s\n", logLevel)
 | 
			
		||||
			os.Exit(1)
 | 
			
		||||
		}
 | 
			
		||||
		logrus.SetLevel(lvl)
 | 
			
		||||
	} else {
 | 
			
		||||
		logrus.SetLevel(logrus.InfoLevel)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue