mirror of
https://github.com/certbot/certbot.git
synced 2026-08-03 00:22:04 +02:00
check late for root, so letsencrypt --help also works without being root
This commit is contained in:
@@ -19,11 +19,6 @@ from letsencrypt.client.apache import configurator
|
|||||||
|
|
||||||
def main(): # pylint: disable=too-many-statements
|
def main(): # pylint: disable=too-many-statements
|
||||||
"""Command line argument parsing and main script execution."""
|
"""Command line argument parsing and main script execution."""
|
||||||
if not os.geteuid() == 0:
|
|
||||||
sys.exit(
|
|
||||||
"{0}Root is required to run letsencrypt. Please use sudo.{0}"
|
|
||||||
.format(os.linesep))
|
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
description="An ACME client that can update Apache configurations.")
|
description="An ACME client that can update Apache configurations.")
|
||||||
|
|
||||||
@@ -63,8 +58,15 @@ def main(): # pylint: disable=too-many-statements
|
|||||||
parser.add_argument("--test", dest="test", action="store_true",
|
parser.add_argument("--test", dest="test", action="store_true",
|
||||||
help="Run in test mode.")
|
help="Run in test mode.")
|
||||||
|
|
||||||
|
# note: arg parser internally handles --help (and exits afterwards)
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
# note: check is done after arg parsing as --help should work w/o root also.
|
||||||
|
if not os.geteuid() == 0:
|
||||||
|
sys.exit(
|
||||||
|
"{0}Root is required to run letsencrypt. Please use sudo.{0}"
|
||||||
|
.format(os.linesep))
|
||||||
|
|
||||||
# Set up logging
|
# Set up logging
|
||||||
logger = logging.getLogger()
|
logger = logging.getLogger()
|
||||||
logger.setLevel(logging.INFO)
|
logger.setLevel(logging.INFO)
|
||||||
|
|||||||
Reference in New Issue
Block a user