mirror of
				https://github.com/ARM-software/devlib.git
				synced 2025-11-04 07:51:21 +00:00 
			
		
		
		
	collector/dmesg: DmesgCollector: Avoid not rooted targets
Fail early if the target is not rooted, as root is required by DmesgCollector.start() anyway.
This commit is contained in:
		
				
					committed by
					
						
						Marc Bonnici
					
				
			
			
				
	
			
			
			
						parent
						
							bbc891341c
						
					
				
				
					commit
					b6d1863e77
				
			@@ -21,6 +21,7 @@ from datetime import timedelta
 | 
				
			|||||||
from devlib.collector import (CollectorBase, CollectorOutput,
 | 
					from devlib.collector import (CollectorBase, CollectorOutput,
 | 
				
			||||||
                              CollectorOutputEntry)
 | 
					                              CollectorOutputEntry)
 | 
				
			||||||
from devlib.target import KernelConfigTristate
 | 
					from devlib.target import KernelConfigTristate
 | 
				
			||||||
 | 
					from devlib.exception import TargetStableError
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class KernelLogEntry(object):
 | 
					class KernelLogEntry(object):
 | 
				
			||||||
@@ -153,6 +154,10 @@ class DmesgCollector(CollectorBase):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    def __init__(self, target, level=LOG_LEVELS[-1], facility='kern'):
 | 
					    def __init__(self, target, level=LOG_LEVELS[-1], facility='kern'):
 | 
				
			||||||
        super(DmesgCollector, self).__init__(target)
 | 
					        super(DmesgCollector, self).__init__(target)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if not target.is_rooted:
 | 
				
			||||||
 | 
					            raise TargetStableError('Cannot collect dmesg on non-rooted target')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        self.output_path = None
 | 
					        self.output_path = None
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if level not in self.LOG_LEVELS:
 | 
					        if level not in self.LOG_LEVELS:
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user