Repository: Infomaniak/certbot-dns-infomaniak (language: python)

Issue:
Conflict with Debian distro package?
After running in the same problems with installation as AisteruFire I managed to get certbot running on my Raspberry Pi with Raspian OS buster by 

- removing my distro package (which was cerbot 0.31)
- installing python3 
- installing certbot with 'pip install certbot' (certbot 1.11)

Updating the current certificate for the server worked then and I also got a wildcard certificate using certbot-dns-infomaniak hook.

But: Now the certbot service is gone which handled automatic renewal before. Also, on the Certbot web page (https://certbot.eff.org/docs/install.html#system-requirements) is a warning *to not install via pip install* and to use the distro packages instead.
But using the distro package failed with the certbot-dns-infomaniak hook as this requires certbot >= 0.35. :(

Any idea how to solve this?



Discussion / hints:
Hello, I will try myself on a raspbian buster
Ok the problem is with the old version of certbot shipped with buster. Installing certbot from the distro and a specific plugin via pip should not be an issue, but because of the required `>= 0.34` it installs certbot from pip over the distro one.
I just made a fix that should make it work.

Fix patch:
diff --git a/certbot_dns_infomaniak/dns_infomaniak.py b/certbot_dns_infomaniak/dns_infomaniak.py
index 5dacc82..5f6446f 100644
--- a/certbot_dns_infomaniak/dns_infomaniak.py
+++ b/certbot_dns_infomaniak/dns_infomaniak.py
@@ -8,7 +8,10 @@
 from certbot import errors
 from certbot import interfaces
 from certbot.plugins import dns_common
-import certbot.compat.os as os
+try:
+    import certbot.compat.os as os
+except ImportError:
+    import os
 
 logger = logging.getLogger(__name__)
 
diff --git a/requirements.txt b/requirements.txt
index 8abcfee..008fffa 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,4 +1,4 @@
-certbot>=0.34.0
+certbot>=0.31.0
 setuptools
 requests
 mock
diff --git a/setup.py b/setup.py
index 633c2ff..0780d2e 100644
--- a/setup.py
+++ b/setup.py
@@ -5,7 +5,7 @@
 version = "0.0.0"
 
 install_requires = [
-    "certbot>=0.34.0",
+    "certbot>=0.31.0",
     "setuptools",
     "requests",
     "mock",


Test patch:
diff --git a/certbot_dns_infomaniak/dns_infomaniak_test.py b/certbot_dns_infomaniak/dns_infomaniak_test.py
index 9d92e83..e9fcb13 100644
--- a/certbot_dns_infomaniak/dns_infomaniak_test.py
+++ b/certbot_dns_infomaniak/dns_infomaniak_test.py
@@ -7,7 +7,10 @@
 import requests_mock
 
 from certbot.errors import PluginError
-import certbot.compat.os as os
+try:
+    import certbot.compat.os as os
+except ImportError:
+    import os
 from certbot.plugins import dns_test_common
 from certbot.plugins.dns_test_common import DOMAIN
 from certbot.tests import util as test_util