mirror of
https://github.com/certbot/certbot.git
synced 2026-08-03 08:03:10 +02:00
Certbot 3.0 outdated plugin warning (#10031)
* Print an error if outdated snap plugins detected With Certbot 3.0 comes a bump to Python 3.12, so if any snap plugins are still located in a python3.8 directory, print an error informing the user. * tox nitpicks * personal nitpick * review fixups * Update certbot/certbot/_internal/snap_config.py Co-authored-by: ohemorange <ebportnoy@gmail.com> * Use LOGGER.warn instead of error * warn-->warning * warn-->warning --------- Co-authored-by: ohemorange <ebportnoy@gmail.com>
This commit is contained in:
co-authored by
ohemorange
parent
6a6544fd90
commit
2660a2017b
@@ -33,6 +33,7 @@ _ARCH_TRIPLET_MAP = {
|
|||||||
'amd64': 'x86_64-linux-gnu',
|
'amd64': 'x86_64-linux-gnu',
|
||||||
's390x': 's390x-linux-gnu',
|
's390x': 's390x-linux-gnu',
|
||||||
}
|
}
|
||||||
|
CURRENT_PYTHON_VERSION_STRING = 'python3.12'
|
||||||
|
|
||||||
LOGGER = logging.getLogger(__name__)
|
LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
@@ -71,10 +72,35 @@ def prepare_env(cli_args: List[str]) -> List[str]:
|
|||||||
raise e
|
raise e
|
||||||
|
|
||||||
data = response.json()
|
data = response.json()
|
||||||
connections = ['/snap/{0}/current/lib/python3.12/site-packages/'.format(item['slot']['snap'])
|
connections = []
|
||||||
for item in data.get('result', {}).get('established', [])
|
outdated_plugins = []
|
||||||
if item.get('plug', {}).get('plug') == 'plugin'
|
for plugin in data.get('result', {}).get('established', []):
|
||||||
and item.get('plug-attrs', {}).get('content') == 'certbot-1']
|
plug: str = plugin.get('plug', {}).get('plug')
|
||||||
|
plug_content: str = plugin.get('plug-attrs', {}).get('content')
|
||||||
|
if plug == 'plugin' and plug_content == 'certbot-1':
|
||||||
|
plugin_name: str = plugin['slot']['snap']
|
||||||
|
# First, check that the plugin is using our expected python version,
|
||||||
|
# i.e. its "read" slot is something like
|
||||||
|
# "$SNAP/lib/python3.12/site-packages". If not, skip it and print an
|
||||||
|
# error.
|
||||||
|
slot_read: str = plugin.get('slot-attrs', {}).get('read', [])
|
||||||
|
if len(slot_read) != 0 and CURRENT_PYTHON_VERSION_STRING not in slot_read[0]:
|
||||||
|
outdated_plugins.append(plugin_name)
|
||||||
|
continue
|
||||||
|
|
||||||
|
connections.append('/snap/{0}/current/lib/{1}/site-packages/'.format(
|
||||||
|
plugin_name,
|
||||||
|
CURRENT_PYTHON_VERSION_STRING
|
||||||
|
))
|
||||||
|
|
||||||
|
if outdated_plugins:
|
||||||
|
LOGGER.warning('The following plugins are using an outdated python version and must be '
|
||||||
|
'updated to be compatible with Certbot 3.0. Please see '
|
||||||
|
'https://community.letsencrypt.org/t/'
|
||||||
|
'certbot-3-0-could-have-potential-third-party-snap-breakages/226940 '
|
||||||
|
'for more information:')
|
||||||
|
plugin_list = '\n'.join(' * {}'.format(plugin) for plugin in outdated_plugins)
|
||||||
|
LOGGER.warning(plugin_list)
|
||||||
|
|
||||||
os.environ['CERTBOT_PLUGIN_PATH'] = ':'.join(connections)
|
os.environ['CERTBOT_PLUGIN_PATH'] = ':'.join(connections)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user