Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V3: type hints for operations #1082

Open
wants to merge 32 commits into
base: 3.x
Choose a base branch
from

Conversation

stone-w4tch3r
Copy link
Contributor

@stone-w4tch3r stone-w4tch3r commented Apr 5, 2024

Type hints for all operations, V3 version

Fizzadar and others added 30 commits January 24, 2024 10:33
# Conflicts:
#	scripts/build_public_docs.sh
Especially with lots of host going through a jump-host,
there is a chance that the jump-host is overloaded.
Instead of simply failing, we can retry and back-off
with some random interval to avoid the stampede
This prevents gevent dumping out the exception traceback so pyinfra can
handle it later (and show it too!).
This correctly fails hosts when they fail executing a nested operation,
just like unnested operations.
# Conflicts:
#	CHANGELOG.md
#	pyinfra/api/arguments.py
#	pyinfra/api/operations.py
#	pyinfra/api/state.py
#	pyinfra/connectors/ssh.py
#	pyinfra/connectors/terraform.py
#	pyinfra/facts/util/packaging.py
#	pyinfra/operations/apt.py
#	pyinfra/operations/brew.py
#	pyinfra/operations/cargo.py
#	pyinfra/operations/choco.py
#	pyinfra/operations/dnf.py
#	pyinfra/operations/files.py
#	pyinfra/operations/gem.py
#	pyinfra/operations/git.py
#	pyinfra/operations/npm.py
#	pyinfra/operations/pkg.py
#	pyinfra/operations/postgresql.py
#	pyinfra/operations/python.py
#	pyinfra/operations/selinux.py
#	pyinfra/operations/server.py
#	pyinfra/operations/ssh.py
#	pyinfra/operations/upstart.py
#	pyinfra/operations/util/files.py
#	pyinfra/operations/util/packaging.py
#	pyinfra/operations/util/service.py
#	pyinfra/operations/vzctl.py
#	pyinfra/operations/windows.py
#	pyinfra/operations/windows_files.py
#	pyinfra/operations/yum.py
@stone-w4tch3r
Copy link
Contributor Author

Looks like some check are broken :(

@stone-w4tch3r stone-w4tch3r marked this pull request as ready for review April 5, 2024 14:09
@Fizzadar
Copy link
Member

Fizzadar commented Apr 7, 2024

@stone-w4tch3r thank you so much for working on this! At a quick glance it looks fantastic, time is in extremely short supply right now I won’t be able to properly review till next weekend unfortunately, just a heads up!

Copy link
Member

@Fizzadar Fizzadar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK that week turned into a month, my apologies @stone-w4tch3r. PR looks great, HUGE thank you for working on this!

I think the failures are mostly missing Optionals since mypy switched to disallowing implicit optional kwargs. Looks like there's a tool to automatically fix this.

I can clean those up and get that working with the tests, all the types look good 👍

@@ -25,16 +39,19 @@ def boolean(bool_name, value, persistent=False):
selinux.boolean(
name='Allow Apache to connect to LDAP server',
'httpd_can_network_connect',
'on',
Boolean.ON,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Boolean.ON,
selinux.Boolean.ON,

@@ -127,12 +144,15 @@ def port(protocol, port_num, se_type=None, present=True):

selinux.port(
name='Allow Apache to provide service on port 2222',
'tcp',
Protocol.TCP,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Protocol.TCP,
selinux.Protocol.TCP,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants