Amusingly named class to present the teuthology RemoteProcess interface when we are really running things locally for vstart Run this inside your src/ dir!
| 320 | return None |
| 321 | |
| 322 | class LocalRemote(RemoteShell): |
| 323 | """ |
| 324 | Amusingly named class to present the teuthology RemoteProcess interface when we are really |
| 325 | running things locally for vstart |
| 326 | |
| 327 | Run this inside your src/ dir! |
| 328 | """ |
| 329 | |
| 330 | rewrite_helper_tools = [ |
| 331 | { |
| 332 | 'name': 'adjust-ulimits', |
| 333 | 'path': None |
| 334 | }, |
| 335 | { |
| 336 | 'name': 'daemon-helper', |
| 337 | 'path': None |
| 338 | }, |
| 339 | { |
| 340 | 'name': 'stdin-killer', |
| 341 | 'path': None |
| 342 | }, |
| 343 | ] |
| 344 | |
| 345 | def __init__(self): |
| 346 | super().__init__() |
| 347 | self.name = "local" |
| 348 | self._hostname = "localhost" |
| 349 | self.user = getpass.getuser() |
| 350 | |
| 351 | @property |
| 352 | def hostname(self): |
| 353 | if not hasattr(self, '_hostname'): |
| 354 | self._hostname = 'localhost' |
| 355 | return self._hostname |
| 356 | |
| 357 | def get_file(self, path, sudo=False, dest_dir='/tmp'): |
| 358 | if dest_dir == '/tmp': |
| 359 | # If we're storing in /tmp, generate a unique filename |
| 360 | (_fd, local_path) = tempfile.mkstemp(dir=dest_dir) |
| 361 | else: |
| 362 | # If we are storing somewhere other than /tmp, use the original |
| 363 | # filename |
| 364 | local_path = os.path.join(dest_dir, path.split(os.path.sep)[-1]) |
| 365 | try: |
| 366 | shutil.copy(path, local_path) |
| 367 | except shutil.SameFileError: |
| 368 | log.info("path and local_path refer to the same file") |
| 369 | pass |
| 370 | return local_path |
| 371 | |
| 372 | # XXX: This method ignores the error raised when src and dst are |
| 373 | # holding same path. For teuthology, same path still represents |
| 374 | # different locations as they lie on different machines. |
| 375 | def put_file(self, src, dst, sudo=False): |
| 376 | try: |
| 377 | shutil.copy(src, dst) |
| 378 | except shutil.SameFileError: |
| 379 | pass |
no outgoing calls
no test coverage detected