예제 #1
0
    def list_packages(self, clear_ros_cache=False):
        '''
        Requests all known packages from gRPC-server.

        :param bool clear_ros_cache: clear ROS cache before list the packages.
        :return: a dictionary of path to package and package name.
        :rype: dict(str: str)
        :raise Exception:
        '''
        result = {}
        response = self.fm_stub.ListPackages(
            fmsg.ListPackagesRequest(clear_ros_cache=clear_ros_cache))
        if response.status.code == OK:
            for p in response.items:
                result[p.path] = p.name
        elif response.status.code == ERROR:
            raise Exception(response.status.error_msg)
        return result
예제 #2
0
 def test_list_packages(self):
     fs = FileServicer()
     pacakges_response = fs.ListPackages(fmsg.ListPackagesRequest(clear_ros_cache=True), DummyContext())