Skip to content

Commit

Permalink
Allow feedback to be generated for specific users only
Browse files Browse the repository at this point in the history
  • Loading branch information
jhamrick committed May 1, 2015
1 parent c197015 commit 7abd576
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions library/make_feedback.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,16 @@ def main():
'src': dict(required=True),
'dest': dict(required=True),
'name': dict(required=True),
'overwrite': dict(default=False, type='bool')
'overwrite': dict(default=False, type='bool'),
'users': dict(default=[], type='list')
}
)

src = module.params["src"]
dest = module.params["dest"]
name = module.params["name"]
overwrite = module.params["overwrite"]
users = module.params["users"]

# Check that the source is a directory
if not os.path.isdir(src):
Expand All @@ -43,9 +45,13 @@ def main():
fd, tmp_dest = tempfile.mkstemp()
os.close(fd)

# Make the list of users
if users == []:
users = os.listdir(src)

# Create the tarball
tf = tarfile.open(tmp_dest, 'w:gz')
for user in os.listdir(src):
for user in users:
userpath = os.path.join(src, user)
for (dirpath, dirnames, filenames) in os.walk(userpath):
for filename in filenames:
Expand Down

0 comments on commit 7abd576

Please sign in to comment.