Repository: conan-io/conan

Issue:
Feature request conan.conf file
To help us debug your issue please explain:

- [x] I've read the [CONTRIBUTING guide](https://raw.githubusercontent.com/conan-io/conan/develop/.github/CONTRIBUTING.md).
- [x] I've specified the Conan version, operating system version and any tool that can be relevant.
- [x ] I've explained the steps to reproduce the error or the motivation/use case of the question/suggestion.

I have just been burnt by the same type of issue again.... a user was having connectivity issues with the Proxy devil.

I looked at the conan.conf file and read right over the fact that the variable "no_proxy" was set, but what needed to be set was "no_proxy_match"

Is it possible for conan to report:

"You have set the variable: 'XXXX' in the conan.conf file, but Conan does not understand that variable"

An error/warning message like that helps stupid people like me.




Discussion:
The problem with ``no_proxy`` is that it is still a valid conan.conf, because some other users were using it, and it was enough for their purpose, so we didn't want to break them removing it. 
However, I think it should be ok to print a warning for this conf variable (saying that you probably want to use ``no_proxy_match`` instead). Should we consider deprecating/removing ``no_proxy`` totally in conan 2.0, lasote?
Yes, we should deprecate it because it is very buggy and unpredictable.
I'm ok showing a warning.

Resolving patch:
diff --git a/conans/client/rest/conan_requester.py b/conans/client/rest/conan_requester.py
--- a/conans/client/rest/conan_requester.py
+++ b/conans/client/rest/conan_requester.py
@@ -4,6 +4,7 @@
 import requests
 from requests.adapters import HTTPAdapter
 import time
+import warnings
 
 from conans import __version__ as client_version
 from conans.util.files import save
@@ -36,6 +37,8 @@ def __init__(self, config, http_requester=None):
         # Account for the requests NO_PROXY env variable, not defined as a proxy like http=
         no_proxy = self.proxies.pop("no_proxy", None)
         if no_proxy:
+            warnings.warn("proxies.no_proxy has been deprecated." \
+                          " Use proxies.no_proxy_match instead")
             os.environ["NO_PROXY"] = no_proxy
 
         if not os.path.exists(self._cacert_path):


Test patch:
diff --git a/conans/test/functional/configuration/proxies_conf_test.py b/conans/test/functional/configuration/proxies_conf_test.py
--- a/conans/test/functional/configuration/proxies_conf_test.py
+++ b/conans/test/functional/configuration/proxies_conf_test.py
@@ -1,6 +1,7 @@
 import os
 import unittest
 import textwrap
+import warnings
 from mock import patch
 
 
@@ -23,16 +24,23 @@ def test_requester(self):
         """
         save(client.cache.conan_conf_path, conf)
         client.cache.invalidate()
-        requester = ConanRequester(client.cache.config)
+        with warnings.catch_warnings(record=True) as warn:
+            warnings.simplefilter("always")
+            requester = ConanRequester(client.cache.config)
 
-        def verify_proxies(url, **kwargs):
-            self.assertEqual(kwargs["proxies"], {"https": None, "http": "http://conan.url"})
-            return "mocked ok!"
+            def verify_proxies(url, **kwargs):
+                self.assertEqual(kwargs["proxies"], {"https": None, "http": "http://conan.url"})
+                return "mocked ok!"
 
-        requester._http_requester.get = verify_proxies
-        self.assertEqual(os.environ["NO_PROXY"], "http://someurl,http://otherurl.com")
+            requester._http_requester.get = verify_proxies
+            self.assertEqual(os.environ["NO_PROXY"], "http://someurl,http://otherurl.com")
 
-        self.assertEqual(requester.get("MyUrl"), "mocked ok!")
+            self.assertEqual(requester.get("MyUrl"), "mocked ok!")
+
+            self.assertEqual(1, len(warn))
+            self.assertTrue(issubclass(warn[-1].category, UserWarning))
+            self.assertIn("proxies.no_proxy has been deprecated. "
+                          "Use proxies.no_proxy_match instead", str(warn[-1].message))
 
     def test_requester_with_host_specific_proxies(self):
         client = TestClient()