コード例 #1
0
ファイル: cachetool.py プロジェクト: tejp/freenas
def _cache_rawdump_NIS(**kwargs):
    nis = FreeNAS_NIS(flags=FLAGS_DBINIT)
    domains = nis.get_domains()
    for d in domains:
        print("d: %s" % d)

        ucache = FreeNAS_UserCache(dir=d)
        if ucache:
            for key in list(ucache.keys()):
                print("u: %s=%s" % (key, ucache[key]))

        gcache = FreeNAS_GroupCache(dir=d)
        if gcache:
            for key in list(gcache.keys()):
                print("g: %s=%s" % (key, gcache[key]))

        ducache = FreeNAS_Directory_UserCache(dir=d)
        if ducache:
            for key in list(ducache.keys()):
                print("du: %s=%s" % (key, ducache[key]))

        dgcache = FreeNAS_Directory_GroupCache(dir=d)
        if dgcache:
            for key in list(dgcache.keys()):
                print("dg: %s=%s" % (key, dgcache[key]))
コード例 #2
0
ファイル: cachetool.py プロジェクト: HySoaKa/freenas
def _cache_rawdump_NIS(**kwargs):
    nis = FreeNAS_NIS(flags=FLAGS_DBINIT)
    domains = nis.get_domains()
    for d in domains:
        print "d: %s" % d

        ucache = FreeNAS_UserCache(dir=d)
        if ucache:
            for key in ucache.keys():
                print "u: %s=%s" % (key, ucache[key])

        gcache = FreeNAS_GroupCache(dir=d)
        if gcache:
            for key in gcache.keys():
                print "g: %s=%s" % (key, gcache[key])

        ducache = FreeNAS_Directory_UserCache(dir=d)
        if ducache:
            for key in ducache.keys():
                print "du: %s=%s" % (key, ducache[key])

        dgcache = FreeNAS_Directory_GroupCache(dir=d)
        if dgcache:
            for key in dgcache.keys():
                print "dg: %s=%s" % (key, dgcache[key])
コード例 #3
0
ファイル: cachetool.py プロジェクト: tejp/freenas
def _cache_keys_NIS(**kwargs):
    nis = FreeNAS_NIS(flags=FLAGS_DBINIT)
    domains = nis.get_domains()
    for d in domains:
        print("d: %s" % d)

        ucache = FreeNAS_UserCache(dir=d)
        if ucache:
            for key in list(ucache.keys()):
                print("u key: %s" % key)

        gcache = FreeNAS_GroupCache(dir=d)
        if gcache:
            for key in list(gcache.keys()):
                print("g key: %s" % key)

        ducache = FreeNAS_Directory_UserCache(dir=d)
        if ducache:
            for key in list(ducache.keys()):
                print("du key: %s" % key)

        dgcache = FreeNAS_Directory_GroupCache(dir=d)
        if dgcache:
            for key in list(dgcache.keys()):
                print("dg key: %s" % key)
コード例 #4
0
ファイル: cachetool.py プロジェクト: HySoaKa/freenas
def _cache_keys_NIS(**kwargs):
    nis = FreeNAS_NIS(flags=FLAGS_DBINIT)
    domains = nis.get_domains()
    for d in domains:
        print "d: %s" % d

        ucache = FreeNAS_UserCache(dir=d)
        if ucache: 
            for key in ucache.keys():
                print "u key: %s" % key

        gcache = FreeNAS_GroupCache(dir=d)
        if gcache:
            for key in gcache.keys():
                print "g key: %s" % key

        ducache = FreeNAS_Directory_UserCache(dir=d)
        if ducache:
            for key in ducache.keys():
                print "du key: %s" % key

        dgcache = FreeNAS_Directory_GroupCache(dir=d)
        if dgcache:
            for key in dgcache.keys():
                print "dg key: %s" % key
コード例 #5
0
ファイル: cachetool.py プロジェクト: william-gr/freenas
def _cache_keys_NIS(**kwargs):
    nis = FreeNAS_NIS(flags=FLAGS_DBINIT)
    domains = nis.get_domains()
    for d in domains:
        print "d: %s" % d

        ucache = FreeNAS_UserCache(dir=d)
        if ucache:
            for key in ucache.keys():
                print "u key: %s" % key

        gcache = FreeNAS_GroupCache(dir=d)
        if gcache:
            for key in gcache.keys():
                print "g key: %s" % key

        ducache = FreeNAS_Directory_UserCache(dir=d)
        if ducache:
            for key in ducache.keys():
                print "du key: %s" % key

        dgcache = FreeNAS_Directory_GroupCache(dir=d)
        if dgcache:
            for key in dgcache.keys():
                print "dg key: %s" % key
コード例 #6
0
ファイル: cachetool.py プロジェクト: binzyw/freenas
def _cache_keys_NIS(**kwargs):
    nis = FreeNAS_NIS(flags=FLAGS_DBINIT)
    domains = nis.get_domains()
    for d in domains:
        print("d: %s" % d)

        ucache = FreeNAS_UserCache(dir=d)
        if ucache:
            for key in list(ucache.keys()):
                print("u key: %s" % key)

        gcache = FreeNAS_GroupCache(dir=d)
        if gcache:
            for key in list(gcache.keys()):
                print("g key: %s" % key)

        ducache = FreeNAS_Directory_UserCache(dir=d)
        if ducache:
            for key in list(ducache.keys()):
                print("du key: %s" % key)

        dgcache = FreeNAS_Directory_GroupCache(dir=d)
        if dgcache:
            for key in list(dgcache.keys()):
                print("dg key: %s" % key)
コード例 #7
0
ファイル: cachetool.py プロジェクト: tejp/freenas
def _cache_count_NIS(**kwargs):
    nis = FreeNAS_NIS(flags=FLAGS_DBINIT)
    domains = nis.get_domains()
    for d in domains:
        print("d:  %s" % d)
        print("u:  %ld" % _cachelen(FreeNAS_UserCache(dir=d)))
        print("g:  %ld" % _cachelen(FreeNAS_GroupCache(dir=d)))
        print("du: %ld" % _cachelen(FreeNAS_Directory_UserCache(dir=d)))
        print("dg: %ld" % _cachelen(FreeNAS_Directory_GroupCache(dir=d)))
        print("\n")
コード例 #8
0
ファイル: cachetool.py プロジェクト: HySoaKa/freenas
def _cache_count_NIS(**kwargs):
    nis = FreeNAS_NIS(flags=FLAGS_DBINIT)
    domains = nis.get_domains()
    for d in domains:
        print "d:  %s" % d
        print "u:  %ld" % _cachelen(FreeNAS_UserCache(dir=d))
        print "g:  %ld" % _cachelen(FreeNAS_GroupCache(dir=d))
        print "du: %ld" % _cachelen(FreeNAS_Directory_UserCache(dir=d))
        print "dg: %ld" % _cachelen(FreeNAS_Directory_GroupCache(dir=d))
        print "\n"
コード例 #9
0
ファイル: cachetool.py プロジェクト: tejp/freenas
def _cache_check_NIS(**kwargs):
    if 'args' not in kwargs and kwargs['args']:
        return

    valid = {}
    nis = FreeNAS_NIS(flags=FLAGS_DBINIT)
    domains = nis.get_domains()
    for d in domains:
        valid[d] = True

    for arg in kwargs['args']:
        key = val = None

        if arg.startswith("u="):
            key = "u"
            val = arg.partition("u=")[2]

        elif arg.startswith("g="):
            key = "g"
            val = arg.partition("g=")[2]

        elif arg.startswith("du="):
            key = "du"
            val = arg.partition("du=")[2]

        elif arg.startswith("dg="):
            key = "dg"
            val = arg.partition("dg=")[2]

        else:
            continue

        if key in ('u', 'g'):
            parts = val.split('\\')
            if len(parts) < 2:
                continue

            d = parts[0]
            if d not in valid:
                continue

            ucache = FreeNAS_UserCache(dir=d)
            gcache = FreeNAS_GroupCache(dir=d)
            ducache = FreeNAS_Directory_UserCache(dir=d)
            dgcache = FreeNAS_Directory_GroupCache(dir=d)

            if key == 'u':
                if ucache and val in ucache and ucache[val]:
                    print("%s: %s" % (val, ucache[val]))

            elif key == 'g':
                if gcache and val in gcache and gcache[val]:
                    print("%s: %s" % (val, gcache[val]))

        elif key in ('du', 'dg'):
            for d in list(valid.keys()):
                ucache = FreeNAS_UserCache(dir=d)
                gcache = FreeNAS_GroupCache(dir=d)
                ducache = FreeNAS_Directory_UserCache(dir=d)
                dgcache = FreeNAS_Directory_GroupCache(dir=d)

                if key == 'du':
                    if ducache and val in ducache and ducache[val]:
                        print("%s: %s" % (val, ducache[val]))

                elif key == 'dg':
                    if dgcache and val in dgcache and dgcache[val]:
                        print("%s: %s" % (val, dgcache[val]))
コード例 #10
0
ファイル: cachetool.py プロジェクト: dlacko/freenas
def _cache_check_NIS(**kwargs):
    if not kwargs.has_key('args') and kwargs['args']:
        return

    valid = {}
    nis = FreeNAS_NIS(flags=FLAGS_DBINIT)
    domains = nis.get_domains()
    for d in domains:
        valid[d] = True

    for arg in kwargs['args']:
        key = val = None

        if arg.startswith("u="): 
            key = "u"
            val = arg.partition("u=")[2]

        elif arg.startswith("g="): 
            key = "g"
            val = arg.partition("g=")[2]

        elif arg.startswith("du="): 
            key = "du"
            val = arg.partition("du=")[2]

        elif arg.startswith("dg="): 
            key = "dg"
            val = arg.partition("dg=")[2]

        else:
            continue


        if key in ('u', 'g'):
            parts = val.split('\\')
            if len(parts) < 2:
                continue

            d = parts[0]
            if not valid.has_key(d):
                continue

            ucache = FreeNAS_UserCache(dir=d)
            gcache = FreeNAS_GroupCache(dir=d)
            ducache = FreeNAS_Directory_UserCache(dir=d)
            dgcache = FreeNAS_Directory_GroupCache(dir=d)

            if key == 'u':
                if ucache and ucache.has_key(val) and ucache[val]:
                    print "%s: %s" % (val, ucache[val])

            elif key == 'g':
                if gcache and gcache.has_key(val) and gcache[val]:
                    print "%s: %s" % (val, gcache[val])


        elif key in ('du', 'dg'):
            for d in valid.keys():
                ucache = FreeNAS_UserCache(dir=d)
                gcache = FreeNAS_GroupCache(dir=d)
                ducache = FreeNAS_Directory_UserCache(dir=d)
                dgcache = FreeNAS_Directory_GroupCache(dir=d)

                if key == 'du':
                    if ducache and ducache.has_key(val) and ducache[val]:
                        print "%s: %s" % (val, ducache[val])

                elif key == 'dg':
                    if dgcache and dgcache.has_key(val) and dgcache[val]:
                        print "%s: %s" % (val, dgcache[val])