Exemplo n.º 1
0
    users = []
    for url in args:
        url_dump = dump_contents(url, key_path, cert_path)
        users += parse_contents(url_dump)
    #print "DEBUG: raw users to import: %s" % users

    if auth_type not in valid_auth_types:
        print('Error: invalid account auth type %r requested (allowed: %s)' %
              (auth_type, ', '.join(valid_auth_types)))
        usage()
        sys.exit(1)

    new_users = []
    for user_dict in users:
        id_search = default_search()
        id_search['distinguished_name'] = user_dict['distinguished_name']
        (configuration, hits) = search_users(id_search, conf_path, db_path,
                                             verbose)
        if hits:
            if verbose:
                print('Not adding existing user: %(distinguished_name)s' %
                      user_dict)
            continue
        new_users.append(user_dict)
    #print "DEBUG: new users to import: %s" % new_users

    configuration = get_configuration_object()

    if expire is None:
        expire = default_account_expire(configuration, auth_type)
Exemplo n.º 2
0
   -O ORGANIZATION     Search for organization
   -r ROLE             Match on role pattern
   -S STATE            Search for state
   -v                  Verbose output

Each search value can be a string or a pattern with * and ? as wildcards.
""" % {'name': name})


if '__main__' == __name__:
    (args, app_dir, db_path) = init_user_adm()
    conf_path = None
    verbose = False
    user_dict = {}
    opt_args = 'a:b:c:C:d:E:f:F:hI:nO:r:S:v'
    search_filter = default_search()
    expire_before, expire_after = None, None
    only_fields = []
    try:
        (opts, args) = getopt.getopt(args, opt_args)
    except getopt.GetoptError as err:
        print('Error: ', err.msg)
        usage()
        sys.exit(1)

    for (opt, val) in opts:
        if opt == '-a':
            search_filter['expire_after'] = int(val)
        elif opt == '-b':
            search_filter['expire_before'] = int(val)
        elif opt == '-c':
Exemplo n.º 3
0
            dump(stats, dst_path, serializer=ext)
        else:
            return False
    return True


if '__main__' == __name__:
    (args, app_dir, db_path) = init_user_adm()
    conf_path = None
    only_fs_types = []
    expire = None
    force = False
    verbose = False
    sitestats_home = None
    output_formats = []
    search_filter = default_search()
    expire_before, expire_after = None, None
    opt_args = 'a:b:c:d:fho:s:t:u:v'
    try:
        (opts, args) = getopt.getopt(args, opt_args)
    except getopt.GetoptError as err:
        print('Error: ', err.msg)
        usage()
        sys.exit(1)

    for (opt, val) in opts:
        if opt == '-a':
            search_filter['expire_after'] = int(val)
        elif opt == '-b':
            search_filter['expire_before'] = int(val)
        elif opt == '-c':