def register_from_pack(self, pack_dir):
        """
        Register all the triggers from the provided pack.

        :return: Number of triggers registered.
        :rtype: ``int``
        """
        pack_dir = pack_dir[:-1] if pack_dir.endswith("/") else pack_dir
        _, pack = os.path.split(pack_dir)
        triggers_dir = self._pack_loader.get_content_from_pack(
            pack_dir=pack_dir, content_type="triggers"
        )

        # Register pack first
        self.register_pack(pack_name=pack, pack_dir=pack_dir)

        registered_count = 0
        if not triggers_dir:
            return registered_count

        LOG.debug("Registering triggers from pack %s:, dir: %s", pack, triggers_dir)

        try:
            triggers = self._get_triggers_from_pack(triggers_dir=triggers_dir)
            registered_count = self._register_triggers_from_pack(
                pack=pack, triggers=triggers
            )
        except Exception as e:
            if self._fail_on_failure:
                raise e

            LOG.exception(
                'Failed registering all triggers from pack "%s": %s',
                triggers_dir,
                six.text_type(e),
            )

        return registered_count

        Register all the triggers from the provided pack.

        :return: Number of triggers registered.
        :rtype: ``int``
        
st2common/st2common/bootstrap/triggersregistrar.py