Skip to content
This repository has been archived by the owner on Oct 31, 2021. It is now read-only.

Commit

Permalink
Reorganisation.
Browse files Browse the repository at this point in the history
  • Loading branch information
jrd committed Jan 30, 2013
1 parent 9d3d3fb commit 38de339
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 8 deletions.
1 change: 0 additions & 1 deletion src/salix-live-installer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
from keyboard import *
from language import *
from mounting import *
from package import *
from salt import *
from timezone import *
from user import *
6 changes: 0 additions & 6 deletions src/salix-live-installer/package.py

This file was deleted.

24 changes: 23 additions & 1 deletion src/salix-live-installer/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,27 @@
# -*- coding: utf-8 -*-
# vim: set et ai sta sw=2 ts=2 tw=0:
"""
Functions to handle users and groups
Functions to handle users and groups:
- listRegularUsers
-
"""
from execute import *
import os

def listRegularUsers():
"""
Returns a sorted list of regular users, i.e. users with id ≥ 1000.
"""
ret = []
for line in open('/etc/passwd', 'r').read().splitlines():
user, _, uid, _ = line.split(':', 3)
if int(uid) >= 1000:
ret.append(user)
return sorted(ret)

# Unit test
if __name__ == '__main__':
from assertPlus import *
users = listRegularUsers()
print users
assertTrue(len(users) > 0)

0 comments on commit 38de339

Please sign in to comment.