Skip to content

Added a module to contain multiple user/group related tasks and utils #25

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions patchwork/users.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
"""Various tasks for verifying user existence and attributes"""

from .util import set_runner


@set_runner
def user_exists(c, runner, user):
"""Returns True if the given system user exists."""
cmd = "id {}".format(user)
return runner(cmd, hide=True, warn=True).ok
2 changes: 1 addition & 1 deletion tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def sanity(c):
Quick sanity check to ensure we're installed successfully. Mostly for CI.
"""
# Doesn't need to literally import everything, but "a handful" will do.
for name in ('environment', 'files', 'transfers'):
for name in ('environment', 'files', 'transfers', 'users'):
mod = "patchwork.{}".format(name)
import_module(mod)
print("Imported {} successfully".format(mod))
Expand Down