Skip to content

Commit

Permalink
fix: Use get_certbot_path instead of harcoded path
Browse files Browse the repository at this point in the history
  • Loading branch information
gavindsouza committed May 12, 2022
1 parent ac44389 commit 71aab3c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion bench/config/lets_encrypt.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def create_dir_if_missing(path):

def get_certbot_path():
try:
return which("certbot", True)
return which("certbot", raise_err=True)
except FileNotFoundError:
raise CommandFailedError("Certbot is not installed on your system. Please visit https://certbot.eff.org/instructions for installation instructions, then try again.")

Expand Down
3 changes: 1 addition & 2 deletions bench/config/templates/frappe_sudoers
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,5 @@
{{ user }} ALL = (root) NOPASSWD: {{ nginx }}
{% endif %}

{{ user }} ALL = (root) NOPASSWD: /usr/bin/certbot
{{ user }} ALL = (root) NOPASSWD: {{ certbot }}
Defaults:{{ user }} !requiretty

3 changes: 3 additions & 0 deletions bench/utils/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ def init(


def setup_sudoers(user):
from bench.config.lets_encrypt import get_certbot_path

if not os.path.exists("/etc/sudoers.d"):
os.makedirs("/etc/sudoers.d")

Expand All @@ -128,6 +130,7 @@ def setup_sudoers(user):
"service": which("service"),
"systemctl": which("systemctl"),
"nginx": which("nginx"),
"certbot": get_certbot_path(),
}
)

Expand Down

0 comments on commit 71aab3c

Please sign in to comment.