def _get_action_alias_db(
        self, pack, action_alias, ignore_metadata_file_error=False
    ):
        """
        Retrieve ActionAliasDB object.

        :param ignore_metadata_file_error: True to ignore the error when we can't infer
                                            metadata_file attribute (e.g. inside tests).
        :type ignore_metadata_file_error: ``bool``
        """
        content = self._meta_loader.load(action_alias)
        pack_field = content.get("pack", None)
        if not pack_field:
            content["pack"] = pack
            pack_field = pack
        if pack_field != pack:
            raise Exception(
                'Model is in pack "%s" but field "pack" is different: %s'
                % (pack, pack_field)
            )

        # Add in "metadata_file" attribute which stores path to the pack metadata file relative to
        # the pack directory
        try:
            metadata_file = content_utils.get_relative_path_to_pack_file(
                pack_ref=pack, file_path=action_alias, use_pack_cache=True
            )
        except ValueError as e:
            if not ignore_metadata_file_error:
                raise e
        else:
            content["metadata_file"] = metadata_file

        # Pass override information
        altered = self._override_loader.override(pack, "aliases", content)

        action_alias_api = ActionAliasAPI(**content)
        action_alias_api.validate()
        action_alias_db = ActionAliasAPI.to_model(action_alias_api)

        return action_alias_db, altered

        Retrieve ActionAliasDB object.

        :param ignore_metadata_file_error: True to ignore the error when we can't infer
                                            metadata_file attribute (e.g. inside tests).
        :type ignore_metadata_file_error: ``bool``
        
st2common/st2common/bootstrap/aliasesregistrar.py