예제 #1
0
def _dir_is_not_empty(obj):
    if _dir_exists(obj):
        if os.listdir(obj):
        #if os.stat(obj).st_size == 0:
            _bool = 'not '
            dcm._info("dir is" + _bool + "empty: " + obj)
            return True
        else:
            _bool = ''
            dcm._warn("dir is" + _bool + "empty: " + obj)
            return False
예제 #2
0
def _gid_does_not_own_dir(obj):
    if _dir_exists(obj):
        if not dom._gid_owns(obj):
            _bool = 'not '
            dcm._info("gid does " + _bool + "own dir: " + obj)
            return True
        else:
            _bool = ''
            dcm._warn("gid does " + _bool + "own dir: " + obj)
            return False
    else:
        return False
예제 #3
0
def _gid_does_not_own_dir(obj):
    if _dir_exists(obj):
        if not dom._gid_owns(obj):
            _bool = 'not '
            dcm._info("gid does " + _bool + "own dir: " + obj)
            return True
        else:
            _bool = ''
            dcm._warn("gid does " + _bool + "own dir: " + obj)
            return False
    else:
        return False
예제 #4
0
def _gid_owns(obj):

    _objadj = 'object is '
    _objvrb = 'owned by gid '
    _objsep = ': '

    if os.stat(obj).st_gid == os.getgid():
        _bool = ''
        msg = _objadj + _bool + _objvrb + _objsep + obj
        dcm._info(msg)
        return True
    else:
        _bool = 'not '
        msg = _objadj + _bool + _objvrb + _objsep + obj
        dcm._info(msg)
        return False
예제 #5
0
def _not_gid_owns(obj):

    _objadj = 'object is '
    _objvrb = 'owned by gid '
    _objsep = ': '

    if not _gid_owns(obj):
        _bool = 'not '
        msg = _objadj + _bool + _objvrb + _objsep + obj
        dcm._info(msg)
        return True
    else:
        _bool = ''
        msg = _objadj + _bool + _objvrb + _objsep + obj
        dcm._info(msg)
        return False
예제 #6
0
def _isfile(obj):

    _objadj = 'object is '
    _objvrb = 'a file '
    _objsep = ': '

    if os.path.isfile(obj):
        _bool = ''
        msg = _objadj + _bool + _objvrb + _objsep + obj
        dcm._info(msg)
        return True
    else:
        _bool = 'not '
        msg = _objadj + _bool + _objvrb + _objsep + obj
        dcm._info(msg)
        return False
예제 #7
0
def _not_exists(obj):

    _objadj = 'object does '
    _objvrb = 'exist '
    _objsep = ': '

    if not _exists(obj):
        _bool = 'not '
        msg = _objadj + _bool + _objvrb + _objsep + obj
        dcm._info(msg)
        return True
    else:
        _bool = ''
        msg = _objadj + _bool + _objvrb + _objsep + obj
        dcm._info(msg)
        return False
예제 #8
0
def _not_isdir(obj):

    _objadj = 'object is '
    _objvrb = 'a dir '
    _objsep = ': '

    if not _isdir(obj):
        _bool = 'not '
        msg = _objadj + _bool + _objvrb + _objsep + obj
        dcm._info(msg)
        return True
    else:
        _bool = ''
        msg = _objadj + _bool + _objvrb + _objsep + obj
        dcm._info(msg)
        return False
예제 #9
0
def _not_gid_owns(obj):

    _objadj = 'object is '
    _objvrb = 'owned by gid '
    _objsep = ': '

    if not _gid_owns(obj):
        _bool = 'not '
        msg = _objadj + _bool + _objvrb + _objsep + obj
        dcm._info(msg)
        return True
    else:
        _bool = ''
        msg = _objadj + _bool + _objvrb + _objsep + obj
        dcm._info(msg)
        return False
예제 #10
0
def _isfile(obj):

    _objadj = 'object is '
    _objvrb = 'a file '
    _objsep = ': '

    if os.path.isfile(obj):
        _bool = ''
        msg = _objadj + _bool + _objvrb + _objsep + obj
        dcm._info(msg)
        return True
    else:
        _bool = 'not '
        msg = _objadj + _bool + _objvrb + _objsep + obj
        dcm._info(msg)
        return False
예제 #11
0
def _gid_owns(obj):

    _objadj = 'object is '
    _objvrb = 'owned by gid '
    _objsep = ': '

    if os.stat(obj).st_gid == os.getgid():
        _bool = ''
        msg = _objadj + _bool + _objvrb + _objsep + obj
        dcm._info(msg)
        return True
    else:
        _bool = 'not '
        msg = _objadj + _bool + _objvrb + _objsep + obj
        dcm._info(msg)
        return False
예제 #12
0
def _not_isdir(obj):

    _objadj = 'object is '
    _objvrb = 'a dir '
    _objsep = ': '

    if not _isdir(obj):
        _bool = 'not '
        msg = _objadj + _bool + _objvrb + _objsep + obj
        dcm._info(msg)
        return True
    else:
        _bool = ''
        msg = _objadj + _bool + _objvrb + _objsep + obj
        dcm._info(msg)
        return False
예제 #13
0
def _not_exists(obj):

    _objadj = 'object does '
    _objvrb = 'exist '
    _objsep = ': '

    if not _exists(obj):
        _bool = 'not '
        msg = _objadj + _bool + _objvrb + _objsep + obj
        dcm._info(msg)
        return True
    else:
        _bool = ''
        msg = _objadj + _bool + _objvrb + _objsep + obj
        dcm._info(msg)
        return False
예제 #14
0
def _not_dir_exists(obj):

    _objadj = 'dir does '
    _objvrb = {}
    _objvrb['exist'] = 'exist '
    _objvrb['dir'] = 'a dir '
    _objsep = ': '

    if not (dom._exists(obj) and dom._isdir(obj)):
        _bool = 'not '
        _junct = 'or is '
        msg = _objadj + _bool + _objvrb['exist'] + _junct + _bool + _objvrb['dir'] + _objsep + obj
        dcm._info(msg)
        return True
    else:
        _bool = ''
        _junct = 'and is '
        msg = _objadj + _bool + _objvrb['exist'] + _junct + _bool + _objvrb['dir'] + _objsep + obj
        dcm._info(msg)
        return False
예제 #15
0
def _uid_does_not_own_dir(obj):

    _objadj = 'dir does '
    _objvrb = {}
    _objvrb['exist'] = 'exist '
    _objvrb['own'] = 'owned by uid '
    _objsep = ': '

    if not (_dir_exists(obj) and dom._uid_owns(obj)):
        _bool = 'not '
        _junct = 'or is '
        msg = _objadj + _bool + _objvrb['exist'] + _junct + _bool + _objvrb['own'] + _objsep + obj
        dcm._info(msg)
        return True
    else:
        _bool = ''
        _junct = 'and is '
        msg = _objadj + _bool + _objvrb['exist'] + _junct + _bool + _objvrb['own'] + _objsep + obj
        dcm._info(msg)
        return False
예제 #16
0
def _not_id_owns(obj):

    _objadj = 'object is '
    _objvrb = {}
    _objvrb['uid'] = 'owned by uid '
    _objvrb['gid'] = 'owned by gid '
    _objsep = ': '

    if not _uid_owns(obj) or not _gid_owns(obj):
        _bool = 'not '
        _junct = 'or is '
        msg = _objadj + _bool + _objvrb['uid'] + _junct + _bool + _objvrb['gid'] + _objsep + obj
        dcm._info(msg)
        return True
    else:
        _bool = ''
        _junct = 'and is '
        msg = _objadj + _bool + _objvrb['uid'] + _junct + _bool + _objvrb['gid'] + _objsep + obj
        dcm._info(msg)
        return False
예제 #17
0
def _msg_checks():
    """Test message functions with and without parameters"""
    print ()
    print (" --- messages tests --- ")
    print ()

    print (" basic message test ")
    print ()

    dcm._info("info test message")
    dcm._pass("pass test message")
    dcm._warn("warn test message")
    dcm._fail("fail test message")
    dcm._halt("halt test message")

    print ()
    print (" blank message test ")
    print ()

    dcm._info("")
    dcm._pass("")
    dcm._warn("")
    dcm._fail("")
    dcm._halt("")

    print ()
    print (" null message tests ")
    print ()

    dcm._info()
    dcm._pass()
    dcm._warn()
    dcm._fail()
    dcm._halt()
예제 #18
0
def _not_id_owns(obj):

    _objadj = 'object is '
    _objvrb = {}
    _objvrb['uid'] = 'owned by uid '
    _objvrb['gid'] = 'owned by gid '
    _objsep = ': '

    if not _uid_owns(obj) or not _gid_owns(obj):
        _bool = 'not '
        _junct = 'or is '
        msg = _objadj + _bool + _objvrb['uid'] + _junct + _bool + _objvrb[
            'gid'] + _objsep + obj
        dcm._info(msg)
        return True
    else:
        _bool = ''
        _junct = 'and is '
        msg = _objadj + _bool + _objvrb['uid'] + _junct + _bool + _objvrb[
            'gid'] + _objsep + obj
        dcm._info(msg)
        return False
예제 #19
0
def _uid_does_not_own_dir(obj):

    _objadj = 'dir does '
    _objvrb = {}
    _objvrb['exist'] = 'exist '
    _objvrb['own'] = 'owned by uid '
    _objsep = ': '

    if not (_dir_exists(obj) and dom._uid_owns(obj)):
        _bool = 'not '
        _junct = 'or is '
        msg = _objadj + _bool + _objvrb['exist'] + _junct + _bool + _objvrb[
            'own'] + _objsep + obj
        dcm._info(msg)
        return True
    else:
        _bool = ''
        _junct = 'and is '
        msg = _objadj + _bool + _objvrb['exist'] + _junct + _bool + _objvrb[
            'own'] + _objsep + obj
        dcm._info(msg)
        return False
예제 #20
0
def _not_dir_exists(obj):

    _objadj = 'dir does '
    _objvrb = {}
    _objvrb['exist'] = 'exist '
    _objvrb['dir'] = 'a dir '
    _objsep = ': '

    if not (dom._exists(obj) and dom._isdir(obj)):
        _bool = 'not '
        _junct = 'or is '
        msg = _objadj + _bool + _objvrb['exist'] + _junct + _bool + _objvrb[
            'dir'] + _objsep + obj
        dcm._info(msg)
        return True
    else:
        _bool = ''
        _junct = 'and is '
        msg = _objadj + _bool + _objvrb['exist'] + _junct + _bool + _objvrb[
            'dir'] + _objsep + obj
        dcm._info(msg)
        return False