def __init__(self, field, destination, delete, prefix=None, reset=True): """Path handler initialization. Args: field (common_pb2.Path): The Path message. destination (str): The destination base path. delete (bool): Whether the copied file(s) should be deleted on cleanup. prefix (str|None): A path prefix to remove from the destination path when moving files inside the chroot, or to add to the source paths when moving files out of the chroot. reset (bool): Whether to reset the state on cleanup. """ assert isinstance(field, common_pb2.Path) assert field.path assert field.location self.field = field self.destination = destination self.prefix = prefix or '' self.delete = delete self.tempdir = None self.reset = reset # For resetting the state. self._transferred = False self._original_message = common_pb2.Path() self._original_message.CopyFrom(self.field)
def _GetInput(self, **kwargs): values = dict( build_target=common_pb2.BuildTarget(name='target'), vm_path=common_pb2.Path(path='/path/to/image.bin', location=common_pb2.Path.INSIDE), test_harness=test_pb2.VmTestRequest.TAST, vm_tests=[test_pb2.VmTestRequest.VmTest(pattern='suite')], ssh_options=test_pb2.VmTestRequest.SshOptions( port=1234, private_key_path={ 'path': '/path/to/id_rsa', 'location': common_pb2.Path.INSIDE }), ) values.update(kwargs) return test_pb2.VmTestRequest(**values)
def _Payload(path): return test_pb2.MoblabVmTestRequest.Payload(path=common_pb2.Path( path=path))