예제 #1
0
파일: user.py 프로젝트: hatchery/genepool
class User(Package):
    def is_installed(self, *args, **kwargs):
        pass

    def __init__(self, *args, os_name=get_os(), username=None, groups=(), **kwargs):
        self.username = username
        self.groups = groups
        self.os_name = os_name

        if self.os_name == 'osx':
            self.dscl = DSCL()
        elif self.os_name in ('debian', 'ubuntu'):
            pass

    def uninstall(self, *args, **kwargs):
        pass

    def configure(self, username, *args, groups=(), **kwargs):
        pass

    @property
    def is_configured(self):
        return self.username is not None

    def install(self, *args, **kwargs):
        if not self.is_configured:
            # TODO: Raise exception somehow and exit flow
            pass

        if self.os_name == 'osx':
            if not self.is_installed():
                self.dscl.create('/Users/' + self.username)
        if self.os_name in ('debian', 'ubuntu'):
            useradd()
예제 #2
0
파일: group.py 프로젝트: hatchery/genepool
class Group(Package):
    def __init__(self, *args, os_name=get_os(), groupname=None, **kwargs):
        self.os_name = os_name
        self.groupname = groupname
        if os_name in ('debian', 'ubuntu'):
            # TODO: get a core utils handler
            pass
        elif os_name == 'osx':
            self.dscl = DSCL()

    def install(self, *args, **kwargs):
        if not self.is_configured:
            # TODO: raise exception somehow
            pass

        if self.os_name == 'osx':
            self.dscl.create('/Groups/' + self.groupname)
        elif self.os_name in ('debian', 'ubuntu'):
            groupadd(self.groupname)

    @property
    def is_configured(self):
        return self.groupname is not None

    def uninstall(self, *args, **kwargs):
        pass

    def configure(self, *args, **kwargs):
        pass

    def is_installed(self, *args, **kwargs):
        pass
예제 #3
0
파일: group.py 프로젝트: hatchery/genepool
 def __init__(self, *args, os_name=get_os(), groupname=None, **kwargs):
     self.os_name = os_name
     self.groupname = groupname
     if os_name in ('debian', 'ubuntu'):
         # TODO: get a core utils handler
         pass
     elif os_name == 'osx':
         self.dscl = DSCL()
예제 #4
0
파일: user.py 프로젝트: hatchery/genepool
    def __init__(self, *args, os_name=get_os(), username=None, groups=(), **kwargs):
        self.username = username
        self.groups = groups
        self.os_name = os_name

        if self.os_name == 'osx':
            self.dscl = DSCL()
        elif self.os_name in ('debian', 'ubuntu'):
            pass