How to use _follow_symlink method in autotest

Best Python code snippet using autotest_python Github


Full Screen

...245 '''246 self.path = path247 self.global_options_to_add = {}248 self.global_options_to_remove = {}249 self._follow_symlink()250 def _follow_symlink(self):251 '''252 Dereference the path if it's a symlink and make it absolute253 elilo.conf usually is a symlink to the EFI boot partition, so we254 better follow it to the proper location.255 '''256 if os.path.islink(self.path):257 self.path_link = self.path258 self.path = os.path.realpath(self.path_link)259 self.path = os.path.abspath(self.path)260 def add_global_option(self, key, val=None):261 '''262 Adds a global option to the updated elilo configuration file263 :type key: string264 :param key: option name...

Full Screen

Full Screen Github


Full Screen

...92 def is_file(self, path_object):93 return == pytsk3.TSK_FS_META_TYPE_REG94 def is_symlink(self, path_object):95 return == pytsk3.TSK_FS_META_TYPE_LNK96 def _follow_symlink(self, parent, path_object):97 # TODO: attempt to follow symlinks with TSK98 #99 # As a temporary fix, downgrade all links to OSFileSystem so that100 # they are still collected101 return OSFileSystem('/').get_fullpath(path_object.path)102 def list_directory(self, path_object):103 if path_object.path in self._entries_cache:104 return self._entries_cache[path_object.path]105 else:106 # Make sure we do not keep more than 10 000 entries in the cache107 if len(self._entries_cache_last) >= 10000:108 first = self._entries_cache_last.popleft()109 del self._entries_cache[first]110 entries = []111 directory = path_object.obj112 if not isinstance(directory, pytsk3.Directory):113 if not self.is_directory(path_object):114 return115 directory = path_object.obj.as_directory()116 for entry in directory:117 if (118 not hasattr(entry, 'info') or119 not hasattr(, 'name') or120 not hasattr(, 'name') or121 in [b'.', b'..'] or122 not hasattr(, 'meta') or123 not hasattr(, 'size') or124 not hasattr(, 'type') or125 not self.is_allocated(entry)126 ):127 continue128 name ='utf-8', errors='replace')129 filepath = os.path.join(path_object.path, name)130 entry_path_object = PathObject(self, name, filepath, entry)131 if == pytsk3.TSK_FS_META_TYPE_LNK:132 symlink_object = self._follow_symlink(path_object, entry_path_object)133 if symlink_object:134 entries.append(symlink_object)135 else:136 entries.append(entry_path_object)137 self._entries_cache[path_object.path] = entries138 self._entries_cache_last.append(entries)139 return entries140 def get_path(self, parent, name):141 for path_object in self.list_directory(parent):142 if os.path.normcase(name) == os.path.normcase( return path_object144 def get_fullpath(self, filepath):145 relative_path = self._relative_path(filepath)146 path_object = next(self._base_generator())...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:


You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run autotest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?