diff options
author | Brad Warren <bmw@users.noreply.github.com> | 2017-02-02 06:24:14 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-02 06:24:14 +0300 |
commit | 20dd7fddcd5b517f91ed1b6fdfd0373488f79c59 (patch) | |
tree | 20419aeba8c4bffd697bcf5a4c8b691588a9ce80 | |
parent | 9e252ed7bfce0edebe02a7acc0d32adce773a852 (diff) |
fix bug when certbot is ran without any arguments (#4151) (#4154)
(cherry picked from commit b5d4e0bf6a50872462b99f4f02b3688d1179b2f6)
-rw-r--r-- | certbot/cli.py | 2 | ||||
-rw-r--r-- | certbot/tests/cli_test.py | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/certbot/cli.py b/certbot/cli.py index a24f566d1..d7fda7574 100644 --- a/certbot/cli.py +++ b/certbot/cli.py @@ -439,7 +439,7 @@ class HelpfulArgumentParser(object): self.detect_defaults = detect_defaults self.args = args - if self.args[0] == 'help': + if self.args and self.args[0] == 'help': self.args[0] = '--help' self.determine_verb() diff --git a/certbot/tests/cli_test.py b/certbot/tests/cli_test.py index d157901e4..5f4a4e2c7 100644 --- a/certbot/tests/cli_test.py +++ b/certbot/tests/cli_test.py @@ -60,6 +60,11 @@ class ParseTest(unittest.TestCase): self.assertRaises(SystemExit, self.parse, args, output) return output.getvalue() + def test_no_args(self): + namespace = self.parse([]) + for d in ('config_dir', 'logs_dir', 'work_dir'): + self.assertEqual(getattr(namespace, d), cli.flag_default(d)) + def test_install_abspath(self): cert = 'cert' key = 'key' |