code: def _test_ria_postclonecfg(url, dsid, clone_path, superds):
      # Test cloning from RIA store while ORA special remote autoenabling failed
      # due to an invalid URL from the POV of the cloner.
      # Origin's git-config-file should contain the UUID to enable. This needs to
      # work via HTTP, SSH and local cloning.
  
      # Autoenabling should fail initially by git-annex-init and we would report
      # on INFO level. Only postclone routine would deal with it.
      with swallow_logs(new_level=logging.INFO) as cml:
          # First, the super ds:
          riaclone = clone("ria+{}#{}".format(url, dsid), clone_path)
          cml.assert_logged(
              msg="access to 1 dataset sibling store-storage not "
              "auto-enabled",
              level="INFO",
              regex=False,
          )
  
      # However, we now can retrieve content since clone should have enabled the
      # special remote with new URL (or origin in case of HTTP).
      res = riaclone.get("test.txt")
      assert_result_count(
          res,
          1,
          status="ok",
          path=str(riaclone.pathobj / "test.txt"),
          message="from {}...".format(
              DEFAULT_REMOTE
              if url.startswith("http")
              else "store-storage"
          ),
      )
  
      # Second ORA remote is enabled and not reconfigured:
      untouched_remote = riaclone.siblings(
          name="anotherstore-storage", return_type="item-or-list"
      )
      assert_not_is_instance(untouched_remote, list)
      untouched_url = riaclone.repo.get_special_remotes()[
          untouched_remote["annex-uuid"]
      ]["url"]
      ok_(untouched_url.startswith("ria+file://"))
      ok_(not untouched_url.startswith("ria+{}".format(url)))
  
      # publication dependency was set for store-storage but not for
      # anotherstore-storage:
      eq_(
          riaclone.config.get(
              f"remote.{DEFAULT_REMOTE}.datalad-publish-depends",
              get_all=True,
          ),
          "store-storage",
      )
  
      # same thing for the sub ds (we don't need a store-url and id - get should
      # figure those itself):
      with swallow_logs(new_level=logging.INFO) as cml:
          riaclonesub = riaclone.get(
              op.join("subdir", "subds"),
              get_data=False,
              result_xfm="datasets",
              return_type="item-or-list",
          )
          cml.assert_logged(
              msg="access to 1 dataset sibling store-storage not "
              "auto-enabled",
              level="INFO",
              regex=False,
          )
      res = riaclonesub.get("testsub.txt")
      assert_result_count(
          res,
          1,
          status="ok",
          path=str(riaclonesub.pathobj / "testsub.txt"),
          message="from {}...".format(
              DEFAULT_REMOTE
              if url.startswith("http")
              else "store-storage"
          ),
      )
  
      # publication dependency was set for store-storage but not for
      # anotherstore-storage:
      eq_(
          riaclonesub.config.get(
              f"remote.{DEFAULT_REMOTE}.datalad-publish-depends",
              get_all=True,
          ),
          "store-storage",
      )
  
      # finally get the plain git subdataset.
      # Clone should figure to also clone it from a ria+ URL
      # (subdataset-source-candidate), notice that there wasn't an autoenabled ORA
      # remote, but shouldn't stumble upon it, since it's a plain git.
      res = riaclone.get(op.join("subdir", "subgit", "testgit.txt"))
      assert_result_count(
          res, 1, status="ok", type="dataset", action="install"
      )
      assert_result_count(res, 1, status="notneeded", type="file")
      assert_result_count(res, 2)
      # no ORA remote, no publication dependency:
      riaclonesubgit = Dataset(riaclone.pathobj / "subdir" / "subgit")
      eq_(
          riaclonesubgit.config.get(
              f"remote.{DEFAULT_REMOTE}.datalad-publish-depends",
              get_all=True,
          ),
          None,
      )
  
      # Now, test that if cloning into a dataset, ria-URL is preserved and
      # post-clone configuration is triggered again, when we remove the subds and
      # retrieve it again via `get`:
      ds = Dataset(superds).create()
      ria_url = "ria+{}#{}".format(url, dsid)
      ds.clone(ria_url, "sub")
      sds = ds.subdatasets("sub")
      eq_(len(sds), 1)
      eq_(sds[0]["gitmodule_datalad-url"], ria_url)
      assert_repo_status(ds.path)
      ds.drop("sub", what="all", reckless="kill", recursive=True)
      assert_repo_status(ds.path)
  
      # .gitmodules still there:
      sds = ds.subdatasets("sub")
      eq_(len(sds), 1)
      eq_(sds[0]["gitmodule_datalad-url"], ria_url)
      # get it again:
  
      # Autoenabling should fail initially by git-annex-init and we would report
      # on INFO level. Only postclone routine would deal with it.
      with swallow_logs(new_level=logging.INFO) as cml:
          ds.get("sub", get_data=False)
          cml.assert_logged(
              msg="access to 1 dataset sibling store-storage not "
              "auto-enabled",
              level="INFO",
              regex=False,
          )
  
      subds = Dataset(ds.pathobj / "sub")
      # special remote is fine:
      res = subds.get("test.txt")
      assert_result_count(
          res,
          1,
          status="ok",
          path=str(subds.pathobj / "test.txt"),
          message="from {}...".format(
              DEFAULT_REMOTE
              if url.startswith("http")
              else "store-storage"
          ),
      )
  
imports: import logging
  import os.path
  import stat
  from unittest.mock import patch
  import pytest
  from datalad import consts
  from datalad.api import clone, create, remove
  from datalad.cmd import GitWitlessRunner
  from datalad.cmd import WitlessRunner
  from datalad.config import ConfigManager
  from datalad.core.distributed.clone_utils import _get_installationpath_from_url, decode_source_spec
  from datalad.distribution.dataset import Dataset
  from datalad.support.annexrepo import AnnexRepo
  from datalad.support.exceptions import IncompleteResultsError
  from datalad.support.external_versions import external_versions
  from datalad.support.gitrepo import GitRepo
  from datalad.support.network import get_local_file_url
  from datalad.tests.utils_pytest import DEFAULT_BRANCH, DEFAULT_REMOTE, SkipTest, assert_false, assert_in, assert_in_results, assert_message, assert_not_in, assert_not_is_instance, assert_raises, assert_repo_status, assert_result_count, assert_result_values_equal, assert_status, create_tree, eq_, get_datasets_topdir, has_symlink_capability, integration, known_failure, known_failure_githubci_win, known_failure_osx, known_failure_windows, neq_, nok_, ok_, ok_file_has_content, ok_startswith, on_github, on_osx, on_travis, patch_config, serve_path_via_http, set_date, skip_if, skip_if_adjusted_branch, skip_if_no_network, skip_if_on_windows, skip_ssh, slow, swallow_logs, with_sameas_remote, with_tempfile, with_tree, xfail_buggy_annex_info
  from datalad.utils import Path, chpwd, get_home_envvars, on_windows, rmtree
label_desc: Use image node_id 29 for calling a global function with example usage: _test_ria_postclonecfg(url, dsid, clone_path, superds) without return types