The optional_metadata_types option isn't available in older versions of dnf. We could version-guard the option, but let's be more explicit and check if it exists instead. If it doesn't we can safely ignore it and rely on dnf's default behaviour.