如何停止对certbot的弃用警告?

我有一个cron设置来更新certbot 。 它每天发送一个弃用警告。 如何停止弃用警告?

Cron <root@ip-99-99-99-99> /root/certbot-auto renew --quiet /root/.local/share/letsencrypt/lib/python2.6/site-packages/cryptography/__init__.py:26: DeprecationWarning: Python 2.6 is no longer supported by the Python core team, please upgrade your Python. A future version of cryptography will drop support for Python 2.6 DeprecationWarning 

我试图提交一个错误报告,但他们closures了。 https://github.com/certbot/certbot/issues/3984

我试图安装Python2.7,但我无法获得certbot与Python2.7运行。

 [root@kizbit ~]# scl enable python27 "python --version" Python 2.7.8 [root@kizbit ~]# scl enable python27 "/root/certbot-auto renew" /root/.local/share/letsencrypt/lib/python2.6/site-packages/cryptography/__init__.py:26: DeprecationWarning: Python 2.6 is no longer supported by the Python core team, please upgrade your Python. A future version of cryptography will drop support for Python 2.6 DeprecationWarning 

它仍然使用Python 2.6,并仍然产生警告。 我也试过:

 [root@kizbit ~]# scl enable python27 "python /root/certbot-auto renew" File "/root/certbot-auto", line 18 if [ -z "$XDG_DATA_HOME" ]; then ^ SyntaxError: invalid syntax 

与2.6它工作,但给予弃权:

 [root@kizbit ~]# /root/certbot-auto renew /root/.local/share/letsencrypt/lib/python2.6/site-packages/cryptography/__init__.py:26: DeprecationWarning: Python 2.6 is no longer supported by the Python core team, please upgrade your Python. A future version of cryptography will drop support for Python 2.6 DeprecationWarning 

Centos 6.8,certbot 0.12.0

你的问题被closures了,因为它是一个重复的, 有进一步解释的链接 。

这是没有办法的:你的系统上可用的Python版本正在变老。 垃圾邮件“还在发生”将无济于事,会员已经请求帮助 。 如果这个问题对你有影响,随时可以贡献公关。

否则,我不会build议将certbot输出放到/dev/null ,但是如果这些警告确实存在问题,那么您可以考虑放弃它们。

让我们encryption社区大约在2015年提出了一些方法来获得2.7,CentOS软件集合或第三方存储库。 Redhat / CentOS 6.x用户需要python 2.7

它相当于安装python27包,并用python27replacepython2在客户端。 也许不是绝对必要的,因为certbot是2.6的function,但在获得更新的软件很好的练习。

长远来说,你会想迁移到更新版本的CentOS。

作为一个肮脏的临时解决方法,你可以在你的cron条目中尝试这样的事情:

 certbot renew ... 2>&1 | grep -v DeprecationWarning 

我用SCL在CentOS 6上安装了Python2.7。

 yum install -y centos-release-scl yum install -y python27 # scl enable python27 "python -V" Python 2.7.8 

那么你也必须删除

 rm -r ~/.local/share/letsencrypt 

然后重新安装Python 2.7相关的东西(库?configuration?)只需运行它

 scl enable python27 "./certbot-auto" 

在crontab里面:

 @daily scl enable python27 "/root/certbot-auto renew --quiet"