pull request to add SLES variant OS SLES_SAP support (#672)
* add SLES_SAP fix * add SLES_SAP version regexp
This commit is contained in:
		
				
					committed by
					
						
						Kota Kanbe
					
				
			
			
				
	
			
			
			
						parent
						
							3144faae5d
						
					
				
				
					commit
					ced6114a95
				
			
							
								
								
									
										12
									
								
								scan/suse.go
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								scan/suse.go
									
									
									
									
									
								
							@@ -46,18 +46,26 @@ func detectSUSE(c config.ServerInfo) (itsMe bool, suse osTypeInterface) {
 | 
			
		||||
					name = config.OpenSUSE
 | 
			
		||||
				} else if strings.Contains(r.Stdout, `NAME="SLES"`) {
 | 
			
		||||
					name = config.SUSEEnterpriseServer
 | 
			
		||||
				}else if strings.Contains(r.Stdout, `NAME="SLES_SAP"`) {
 | 
			
		||||
					name = config.SUSEEnterpriseServer
 | 
			
		||||
				} else {
 | 
			
		||||
					util.Log.Warn("Failed to parse SUSE edition: %s", r)
 | 
			
		||||
					return true, suse
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				re := regexp.MustCompile(`VERSION_ID=\"(\d+\.\d+|\d+)\"`)
 | 
			
		||||
				re := regexp.MustCompile(`VERSION_ID=\"(\d+\.\d+\.\d+\.\d+|\d+\.\d+|\d+|)\"`)
 | 
			
		||||
				result := re.FindStringSubmatch(strings.TrimSpace(r.Stdout))
 | 
			
		||||
				if len(result) != 2 {
 | 
			
		||||
					util.Log.Warn("Failed to parse SUSE Linux version: %s", r)
 | 
			
		||||
					return true, suse
 | 
			
		||||
				}
 | 
			
		||||
				suse.setDistro(name, result[1])
 | 
			
		||||
				version := ""
 | 
			
		||||
				if len(result[1]) <= 4 {
 | 
			
		||||
					version = result[1]
 | 
			
		||||
				} else {
 | 
			
		||||
					version = result[1][0:4]
 | 
			
		||||
				}
 | 
			
		||||
				suse.setDistro(name, version)
 | 
			
		||||
				return true, suse
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user