mirror of
https://github.com/certbot/certbot.git
synced 2026-08-02 19:31:51 +02:00
Fix lints & glitches
This commit is contained in:
+1
-1
@@ -169,7 +169,7 @@ def _determine_account(args, config):
|
|||||||
|
|
||||||
|
|
||||||
def _init_le_client(args, config, authenticator, installer):
|
def _init_le_client(args, config, authenticator, installer):
|
||||||
config.deterimine_user_agent(authenticator, installer)
|
config.determine_user_agent(authenticator, installer)
|
||||||
if authenticator is not None:
|
if authenticator is not None:
|
||||||
# if authenticator was given, then we will need account...
|
# if authenticator was given, then we will need account...
|
||||||
acc, acme = _determine_account(args, config)
|
acc, acme = _determine_account(args, config)
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ from acme import challenges
|
|||||||
from letsencrypt import constants
|
from letsencrypt import constants
|
||||||
from letsencrypt import errors
|
from letsencrypt import errors
|
||||||
from letsencrypt import interfaces
|
from letsencrypt import interfaces
|
||||||
|
from letsencrypt import le_util
|
||||||
|
|
||||||
|
|
||||||
class NamespaceConfig(object):
|
class NamespaceConfig(object):
|
||||||
@@ -84,17 +85,19 @@ class NamespaceConfig(object):
|
|||||||
return challenges.HTTP01Response.PORT
|
return challenges.HTTP01Response.PORT
|
||||||
|
|
||||||
def determine_user_agent(self, authenticator, installer):
|
def determine_user_agent(self, authenticator, installer):
|
||||||
# The user agent string isn't knowable until the authenticator and
|
"""
|
||||||
# installer have been chosen.
|
Set a user_agent string in the config based on the choice of plugins.
|
||||||
|
(this wasn't knowable at construction time)
|
||||||
|
"""
|
||||||
|
|
||||||
if self.user_agent is None:
|
if self.namespace.user_agent is None:
|
||||||
ua = "LetsEncryptPythonClient/{0} ({1}) Authenticator/{2} Installer/{3}"
|
ua = "LetsEncryptPythonClient/{0} ({1}) Authenticator/{2} Installer/{3}"
|
||||||
ua = ua.format(letsencrypt.__version__, le_util.get_os_info(),
|
ua = ua.format(letsencrypt.__version__, le_util.get_os_info(),
|
||||||
authenticator.name if authenticator else "none",
|
authenticator.name if authenticator else "none",
|
||||||
installer.name if installer else "none")
|
installer.name if installer else "none")
|
||||||
self.user_agent=ua
|
self.namespace.user_agent = ua
|
||||||
else:
|
else:
|
||||||
assert isinstance(self.user_agent, str), "User Agent not a string?"
|
assert isinstance(self.namespace.user_agent, str), "User Agent not a string?"
|
||||||
|
|
||||||
|
|
||||||
class RenewerConfiguration(object):
|
class RenewerConfiguration(object):
|
||||||
|
|||||||
@@ -224,8 +224,8 @@ def get_os_info():
|
|||||||
).communicate()[0]
|
).communicate()[0]
|
||||||
elif os_type.startswith('freebsd'):
|
elif os_type.startswith('freebsd'):
|
||||||
# eg "9.3-RC3-p1"
|
# eg "9.3-RC3-p1"
|
||||||
os_ver = os_ver.parititon("-")[0]
|
os_ver = os_ver.partition("-")[0]
|
||||||
os_ver = os_ver.parititon(".")[0]
|
os_ver = os_ver.partition(".")[0]
|
||||||
elif platform.win32_ver()[1]:
|
elif platform.win32_ver()[1]:
|
||||||
os_ver = platform.win32_ver()[1]
|
os_ver = platform.win32_ver()[1]
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ class ClientTest(unittest.TestCase):
|
|||||||
|
|
||||||
def test_init_acme_verify_ssl(self):
|
def test_init_acme_verify_ssl(self):
|
||||||
self.acme_client.assert_called_once_with(
|
self.acme_client.assert_called_once_with(
|
||||||
directory=mock.ANY, key=mock.ANY, verify_ssl=True)
|
directory=mock.ANY, key=mock.ANY, ua=mock.ANY, verify_ssl=True)
|
||||||
|
|
||||||
def _mock_obtain_certificate(self):
|
def _mock_obtain_certificate(self):
|
||||||
self.client.auth_handler = mock.MagicMock()
|
self.client.auth_handler = mock.MagicMock()
|
||||||
|
|||||||
Reference in New Issue
Block a user