def mount()

in usb_monitor_pkg/usb_monitor_pkg/mount_point_tracker.py [0:0]


    def mount(self, source):
        """Helper function to mount all the devices of a particular filesystem.

        Args:
            source (str): Filesystem type to be mounted.

        Returns:
            str: Custom mount point name created.
        """
        # Get all existing mount points of the source.
        existing_mount_points = self.get_mount_points(source)

        # Build our mount point name.
        mount_point = f"{constants.BASE_MOUNT_POINT}-{os.path.basename(source)}"

        # Don"t mount if already mounted.
        if mount_point in existing_mount_points:
            self.logger.info(f"{source} is already mounted to {mount_point}")

        else:
            if not self.mount_filesystem(source, mount_point):
                return ""

            self.logger.info(f"Mounted {source} to {mount_point}")

        return mount_point