Repository: conan-io/conan

Issue:
conan config install no longer works with 1.11.0
With conan v1.11.0:

```
conan config install http://rambo.local:8090/jenkins/job/microblink/job/conan-toolchains/job/master/lastSuccessfulBuild/artifact/android.zip 
Trying to download  http://rambo.local:8090/jenkins/job/microblink/job/conan-toolchains/job/master/lastSuccessfulBuild/artifact/android.zip
ERROR: Error downloading file http://rambo.local:8090/jenkins/job/microblink/job/conan-toolchains/job/master/lastSuccessfulBuild/artifact/android.zip: ''tuple' object has no attribute 'get''
```

With conan v1.10.2 and earlier this works correctly. Our local CI server (that builds profile zips for company-wide use) is in local area network and does not use SSL (I guess #4158 could be related to breaking this behaviour). Are there any workarounds you could suggest?


Discussion:
Seems the offending line is this one: https://github.com/conan-io/conan/pull/4062/files#diff-633cc9158b73bec9defbb8eb390ba040R573

I am fixing this ASAP. Thanks for reporting!

Resolving patch:
diff --git a/conans/client/conan_api.py b/conans/client/conan_api.py
--- a/conans/client/conan_api.py
+++ b/conans/client/conan_api.py
@@ -221,11 +221,11 @@ def factory(interactive=None):
             if interactive is None:
                 interactive = not get_env("CONAN_NON_INTERACTIVE", False)
             conan = ConanAPIV1(client_cache, user_io, get_conan_runner(), remote_manager,
-                               hook_manager, interactive=interactive)
+                               hook_manager, requester, interactive=interactive)
 
         return conan, client_cache, user_io
 
-    def __init__(self, client_cache, user_io, runner, remote_manager, hook_manager,
+    def __init__(self, client_cache, user_io, runner, remote_manager, hook_manager, requester,
                  interactive=True):
         assert isinstance(user_io, UserIO)
         assert isinstance(client_cache, ClientCache)
@@ -233,6 +233,7 @@ def __init__(self, client_cache, user_io, runner, remote_manager, hook_manager,
         self._user_io = user_io
         self._runner = runner
         self._remote_manager = remote_manager
+        self._requester = requester
         if not interactive:
             self._user_io.disable_input()
 
@@ -559,9 +560,8 @@ def config_rm(self, item):
     def config_install(self, path_or_url, verify_ssl, config_type=None, args=None):
 
         from conans.client.conf.config_installer import configuration_install
-        requester = self._remote_manager._auth_manager._rest_client.requester,  # FIXME: Look out!
         return configuration_install(path_or_url, self._client_cache, self._user_io.out, verify_ssl,
-                                     requester=requester, config_type=config_type, args=args)
+                                     requester=self._requester, config_type=config_type, args=args)
 
     def _info_args(self, reference, install_folder, profile_name, settings, options, env):
         cwd = get_cwd()


Test patch:
diff --git a/conans/test/functional/command/config_install_test.py b/conans/test/functional/command/config_install_test.py
--- a/conans/test/functional/command/config_install_test.py
+++ b/conans/test/functional/command/config_install_test.py
@@ -11,7 +11,7 @@
 from conans.client.remote_registry import Remote
 from conans.client.rest.uploader_downloader import Downloader
 from conans.test.utils.test_files import temp_folder
-from conans.test.utils.tools import TestClient
+from conans.test.utils.tools import TestClient, StoppableThreadBottle
 from conans.util.files import load, mkdir, save, save_files
 
 win_profile = """[settings]
@@ -407,3 +407,19 @@ def test_git_checkout_is_possible(self):
         check_path = os.path.join(folder, ".git")
         self._check("git, %s, True, -b other_branch" % check_path)
         self.assertTrue(os.path.exists(other_path))
+
+    def test_config_install_requester(self):
+        # https://github.com/conan-io/conan/issues/4169
+        http_server = StoppableThreadBottle()
+        path = self._create_zip()
+
+        from bottle import static_file, auth_basic
+
+        @http_server.server.get("/myconfig.zip")
+        def get_zip():
+            return static_file(os.path.basename(path), os.path.dirname(path))
+
+        http_server.run_server()
+        self.client.run("config install http://localhost:%s/myconfig.zip" % http_server.port)
+        self.assertIn("Unzipping", self.client.out)
+        http_server.stop()
diff --git a/conans/test/utils/tools.py b/conans/test/utils/tools.py
--- a/conans/test/utils/tools.py
+++ b/conans/test/utils/tools.py
@@ -604,7 +604,7 @@ def run(self, command_line, user_io=None, assert_error=False):
             # Settings preprocessor
             interactive = not get_env("CONAN_NON_INTERACTIVE", False)
             conan = Conan(self.client_cache, self.user_io, self.runner, self.remote_manager,
-                          self.hook_manager, interactive=interactive)
+                          self.hook_manager, requester, interactive=interactive)
         outputer = CommandOutputer(self.user_io, self.client_cache)
         command = Command(conan, self.client_cache, self.user_io, outputer)
         args = shlex.split(command_line)