mirror of
				https://github.com/ClusterCockpit/cc-metric-collector.git
				synced 2025-11-04 02:35:07 +01:00 
			
		
		
		
	Fix error print in LustreCollector
This commit is contained in:
		@@ -110,14 +110,16 @@ func (m *LustreCollector) Init(config json.RawMessage) error {
 | 
			
		||||
		"inode_permission": {"lustre_inode_permission": 1}}
 | 
			
		||||
 | 
			
		||||
	// Lustre file system statistics can only be queried by user root
 | 
			
		||||
	user, err := user.Current()
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		cclog.ComponentError(m.name, "Failed to get current user:", err.Error())
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	if user.Uid != "0" {
 | 
			
		||||
		cclog.ComponentError(m.name, "Lustre file system statistics can only be queried by user root:", err.Error())
 | 
			
		||||
		return err
 | 
			
		||||
	if !m.config.Sudo {
 | 
			
		||||
		user, err := user.Current()
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			cclog.ComponentError(m.name, "Failed to get current user:", err.Error())
 | 
			
		||||
			return err
 | 
			
		||||
		}
 | 
			
		||||
		if user.Uid != "0" {
 | 
			
		||||
			cclog.ComponentError(m.name, "Lustre file system statistics can only be queried by user root")
 | 
			
		||||
			return err
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	m.matches = make(map[string]map[string]int)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user