1
0
mirror of https://github.com/certbot/certbot.git synced 2025-09-10 22:11:53 +03:00

10 Commits

Author SHA1 Message Date
Brad Warren
1bb09da270 Update and run isort (#9573)
I want to use isort as part of https://github.com/certbot/certbot/issues/9572 because I want to do it programmatically, however, I felt like the config needed to be tweaked a bit due to it not understanding what is and is not our own code.

This PR updates the isort config so it recognizes our own modules and runs `isort .` from the root of the repo to update everything.

* update isort config

* run "isort ."
2023-02-10 10:51:20 -08:00
Adrien Ferrand
0181a0b07f Fully type certbot apache (#9177)
* Work in progress

* Work in progress

* Work in progress

* Work in progress

* Fix issues around nullability of VirtualHost.path, may discuss that during review

* Work in progress

* Fix remaining types

* Various lint fixes

* Reconfigure tox and mypy to disallow untyped defs globally

* Cleanup compatibility tests

* Use cast for unused v2 logic

* Improve types

* Remove unused comment

* Fix coverage

* Better types

* Fix another type

* Update certbot-apache/certbot_apache/_internal/apacheparser.py

Co-authored-by: alexzorin <alex@zor.io>

* Update certbot-apache/certbot_apache/_internal/assertions.py

Co-authored-by: alexzorin <alex@zor.io>

* Fix type

* Various fixes

* Refactor imports

* Keep naming convention consistent on TypeVars

* Improve types

* Improve types

* Remove remaining Sequence[str] in the project

Co-authored-by: alexzorin <alex@zor.io>
2022-01-31 19:17:40 +11:00
Mads Jensen
7d9e9a4900 Add typing to certbot.apache (#9071)
* Add typing to certbot.apache

Co-authored-by: Adrien Ferrand <ferrand.ad@gmail.com>
2022-01-21 10:15:48 +01:00
Mads Jensen
eeca208c8f Various clean-ups in certbot-apache. Use f-strings. (#9132)
* Various clean-ups in certbot-apache. Use f-strings.

* Smaller tweaks
2022-01-02 00:27:47 +01:00
Mads Jensen
402f18e039 Apache augeas clean up (#9114)
The `# self.comment = comment` caught my eye while working on #9071 as well as the intermediate variables, which aren't really needed. As a result, I reformatted the code slightly in those places.

* Remove comment in AugeasCommentNode.__init__

* Replace some intermediate varibles with return-statements in apache augeas parser.

* more clean-up
2021-12-02 08:45:16 -07:00
Adrien Ferrand
10eecf9c97 Deprecate zope.component in favor of an direct calls to functions from certbot.display.util module (#8835)
* Implement certbot services

* Various fixes

* Local oldest requirements

* Clean imports

* Add unit tests for certbot.services

* Clean code

* Protect against nullity of global services

* Fix CLI

* Fix tests

* Consistent test behavior

* Various fixes

* Clean code

* Remove reporter service, migrate display service in certbot.display.util.

* Fix test

* Fix apache compatibility test

* Fix oldest test

* Setup certbot.display.service module

* Reintegrate in util

* Fix imports

* Fix tests and documentation

* Refactor

* Cleanup

* Cleanup

* Clean imports

* Add unit tests

* Borrow sphinx build fix from #8863

* Fix type

* Add comment

* Do not reuse existing display service, which never exist at that time

* Make get_display() private

* Fix lint

* Make display internal

* Fix circular dependencies

* Fixing circular dependencies

* Rename patch methods and update docstring

* Update deprecation messages

* Update certbot/certbot/_internal/display/obj.py

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>

* Update certbot/certbot/tests/util.py

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>

* Update certbot/certbot/tests/util.py

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>

* Update certbot/certbot/tests/util.py

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>

* Update certbot/certbot/tests/util.py

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>

* Add links

* Avoid relying on internal certbot packages from certbot-apache

* Keep same behavior for patch_get_utility*

* Better diff

* Add changelog

* Update certbot/certbot/tests/util.py

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>
2021-07-19 17:09:06 -07:00
ohemorange
6f27c32db1 Command-line UX overhaul (#8852)
Streamline and reorganize Certbot's CLI output.

This change is a substantial command-line UX overhaul,
based on previous user research. The main goal was to streamline
and clarify output. To see more verbose output, use the -v or -vv flags.

---

* nginx,apache: CLI logging changes

- Add "Successfully deployed ..." message using display_util
- Remove IReporter usage and replace with display_util
- Standardize "... could not find a VirtualHost ..." error

This changes also bumps the version of certbot required by certbot-nginx
and certbot-apache to take use of the new display_util function.

* fix certbot_compatibility_test

since the http plugins now require IDisplay, we need to inject it

* fix dependency version on certbot

* use better asserts

* try fix oldest deps

because certbot 1.10.0 depends on acme>=1.8.0, we need to use
acme==1.8.0 in the -oldest tests

* cli: redesign output of new certificate reporting

Changes the output of run, certonly and certonly --csr. No longer uses
IReporter.

* cli: redesign output of failed authz reporting

* fix problem sorting to be stable between py2 & 3

* add some catch-all error text

* cli: dont use IReporter for EFF donation prompt

* add per-authenticator hints

* pass achalls to auth_hint, write some tests

* exclude static auth hints from coverage

* dont call auth_hint unless derived from .Plugin

* dns fallback hint: dont assume --dns-blah works

--dns-blah won't work for third-party plugins, they need to be specified
using --authenticator dns-blah.

* add code comments about the auth_hint interface

* renew: don't restart the installer for dry-runs

Prevents Certbot from superfluously invoking the installer restart
during dry-run renewals. (This does not affect authenticator restarts).

Additionally removes some CLI output that was reporting the fullchain
path of the renewed certificate.

* update CHANGELOG.md

* cli: redesign output when cert installation failed

- Display a message when certificate installation begins.
- Don't use IReporter, just log errors immediately if restart/rollback
  fails.
- Prompt the user with a command to retry the installation process once
  they have fixed any underlying problems.

* vary by preconfigured_renewal

and move expiry date to be above the renewal advice

* update code comment

Co-authored-by: ohemorange <ebportnoy@gmail.com>

* update code comment

Co-authored-by: ohemorange <ebportnoy@gmail.com>

* fix lint

* derve cert name from cert_path, if possible

* fix type annotation

* text change in nginx hint

Co-authored-by: ohemorange <ebportnoy@gmail.com>

* print message when restarting server after renewal

* log: print "advice" when exiting with an error

When running in non-quiet mode.

* try fix -oldest lock_test.py

* fix docstring

* s/Restarting/Reloading/ when notifying the user

* fix test name

Co-authored-by: ohemorange <ebportnoy@gmail.com>

* type annotations

* s/using the {} plugin/installer: {}/

* copy: avoid "plugin" where possible

* link to user guide#automated-renewals

when not running with --preconfigured-renewal

* cli: reduce default logging verbosity

* fix lock_test: -vv is needed to see logger.debug

* Change comment in log.py to match the change to default verbosity

* Audit and adjust logging levels in apache module

* Audit and adjust logging levels in nginx module

* Audit, adjust logging levels, and improve logging calls in certbot module

* Fix tests to mock correct methods and classes

* typo in non-preconfigured-renewal message

Co-authored-by: ohemorange <ebportnoy@gmail.com>

* fix test

* revert acme version bump

* catch up to python3 changes

* Revert "revert acme version bump"

This reverts commit fa83d6a51c.

* Change ocsp check error to warning since it's non-fatal

* Update storage_test in parallel with last change

* get rid of leading newline on "Deploying [...]"

* shrink renewal and installation success messages

* print logfile rather than logdir in exit handler

* Decrease logging level to info for idempotent operation where enhancement is already set

* Display cert not yet due for renewal message when renewing and no other action will be taken, and change cert to certificate

* also write to logger so it goes in the log file

* Don't double write to log file; fix main test

* cli: remove trailing newline on new cert reporting

* ignore type error

* revert accidental changes to dependencies

* Pass tests in any timezone by using utcfromtimestamp

* Add changelog entry

* fix nits

* Improve wording of try again message

* minor wording change to changelog

* hooks: send hook stdout to CLI stdout

includes both --manual and --{pre,post,renew} hooks

* update docstrings and remove TODO

* add a pending deprecation on execute_command

* add test coverage for both

* update deprecation text

Co-authored-by: ohemorange <ebportnoy@gmail.com>

Co-authored-by: Alex Zorin <alex@zorin.id.au>
Co-authored-by: alexzorin <alex@zor.io>
2021-05-25 10:47:39 +10:00
Karan Suthar
8e4dc0a48c Minor bugfixes (#7891)
* Fix dangerous default argument

* Remove unused imports

* Remove unnecessary comprehension

* Use literal syntax to create data structure

* Use literal syntax instead of function calls to create data structure

Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
2020-04-13 10:41:39 -07:00
Adrien Ferrand
e048da1e38 Reorganize imports (#7616)
* Isort execution

* Fix pylint, adapt coverage

* New isort

* Fix magic_typing lint

* Second round

* Fix pylint

* Third round. Store isort configuration

* Fix latest mistakes

* Other fixes

* Add newline

* Fix lint errors
2019-12-09 15:50:20 -05:00
ohemorange
8139689d4c Make the contents of the apache plugin private (#7579)
Part of #5775.

Tree:
```
certbot-apache/certbot_apache
├── __init__.py
├── _internal
│   ├── apache_util.py
│   ├── augeas_lens
│   │   ├── httpd.aug
│   │   └── README
│   ├── centos-options-ssl-apache.conf
│   ├── configurator.py
│   ├── constants.py
│   ├── display_ops.py
│   ├── entrypoint.py
│   ├── http_01.py
│   ├── __init__.py
│   ├── obj.py
│   ├── options-ssl-apache.conf
│   ├── override_arch.py
│   ├── override_centos.py
│   ├── override_darwin.py
│   ├── override_debian.py
│   ├── override_fedora.py
│   ├── override_gentoo.py
│   ├── override_suse.py
│   └── parser.py
└── tests
    ├── ...
```

* Create _internal folder for certbot_apache

* Move apache_util.py to _internal

* Move display_ops.py to _internal

* Move override_centos.py to _internal

* Move override_gentoo.py to _internal

* Move override_darwin.py to _internal

* Move override_suse.py to _internal

* Move override_debian.py to _internal

* Move override_fedora.py to _internal

* Move override_arch.py to _internal

* Move parser.py to _internal

* Move obj.py to _internal

* Move http_01.py to _internal

* Move entrypoint.py to _internal

* Move constants.py to _internal

* Move configurator.py to _internal

* Move augeas_lens to _internal

* Move options-ssl-apache.conf files to _internal

* move augeas_lens in MANIFEST

* Clean up some stray references to certbot_apache that could use _internal

* Correct imports and lint
2019-11-25 09:44:40 -08:00