示例#1
0
def opt_args():
    parser = kopano.parser('skpcufm')
    parser.add_option("--dry-run",
                      dest="dryrun",
                      action="store_true",
                      help="run the script without executing any actions")
    return parser.parse_args()
示例#2
0
def main():
    parser = kopano.parser('CflSKQUPus', usage='kopano-migration-pst PATH [-u NAME]')
    parser.add_option('', '--stats', dest='stats', action='store_true', help='list folders for PATH')
    parser.add_option('', '--index', dest='index', action='store_true', help='list items for PATH')
    parser.add_option('', '--import-root', dest='import_root', action='store', help='import under specific folder', metavar='PATH')
    parser.add_option('', '--nid', dest='nids', action='append', help='import specific nid', metavar='NID')

    parser.add_option('', '--clean-folders', dest='clean_folders', action='store_true', default=False, help='empty folders before import (dangerous!)', metavar='PATH')
    parser.add_option('', '--create-ex-mapping', dest='create_mapping', help='create legacyExchangeDN mapping for Exchange 2007 PST', metavar='FILE')
    parser.add_option('', '--ex-mapping', dest='mapping', help='mapping file created --create-ex--mapping ', metavar='FILE')
    parser.add_option('', '--summary', dest='summary', action='store_true', help='show total amount of items for a given PST')
    parser.add_option('', '--dismiss-reminders', dest='dismiss_reminders', action='store_true', default=False, help='dismiss reminders for events in the past')

    options, args = parser.parse_args()
    options.service = False

    if not args or (bool(options.stats or options.index or options.create_mapping or options.summary) == bool(options.users or options.stores)):
        parser.print_help()
        sys.exit(1)

    if options.stats or options.index or options.summary:
        show_contents(args, options)
    elif options.create_mapping:
        create_mapping(args, options)
    else:
        Service('migration-pst', options=options, args=args).start()
def opt_args():
    parser = kopano.parser('skpfucmUP')

    parser.add_option("--from",
                      dest="from_date",
                      action="store",
                      help="Remove items older than x (YYYY-MM-DD)")
    parser.add_option("--until",
                      dest="until_date",
                      action="store",
                      help="Remove item till this date (YYYY-MM-DD)")
    parser.add_option("--all",
                      dest="all",
                      action="store_true",
                      help="Remove all items")
    parser.add_option("--subject",
                      dest="subject",
                      action="store",
                      help="Subject of item")
    parser.add_option("--entryid",
                      dest="entryid",
                      action="store",
                      help="entryid of item")

    parser.add_option("--dry-run",
                      dest="dry_run",
                      action="store_true",
                      help="Dry run")
    return parser.parse_args()
示例#4
0
def main():
    options, _ = kopano.parser().parse_args()
    server = kopano.Server(options)
    # TODO: use optparse to figure this out?
    if not server.options.auth_user:
        print('No user specified')
    if not server.options.folders:
        print('No folder specified')
    else:
        user = kopano.Server().user(server.options.auth_user)
        folder = next(user.store.folders())  # First Folder
        print('Monitoring folder %s of %s for update and delete events' %
              (folder, user.fullname))
        # Create mapping
        for item in folder.items():
            ITEM_MAPPING[item.sourcekey] = item
        print('Mapping of items and sourcekey complete')

        folder_state = folder.state
        new_state = folder.sync(Importer(),
                                folder_state)  # from last known state
        while True:
            new_state = folder.sync(Importer(),
                                    folder_state)  # from last known state
            if new_state != folder_state:
                folder_state = new_state
            time.sleep(1)
示例#5
0
def opt_args(print_help=None):

    # Define the kopano parser
    parser = kopano.parser('skpcufmUP')

    # Common option group
    group = OptionGroup(parser, "Common", "")
    group.add_option("--all-users", dest="all_users", action="store_true", help="Run for all users")
    group.add_option("--location", dest="location", action="store", help="Change location where scripts saves the files")
    group.add_option("--file", dest="file", action="store", help="Use specific file")
    group.add_option("--backup", dest="backup", action="store_true", help="Backup Webapp settings")
    group.add_option("--restore", dest="restore", action="store_true", help="Restore Webapp settings")
    group.add_option("--reset", dest="reset", action="store_true", help="Reset WebApp settings")
    parser.add_option_group(group)

    # Signature option group
    group = OptionGroup(parser, "Signature", "")
    group.add_option("--backup-signature", dest="backup_signature", action="store_true", help="Backup signature")
    group.add_option("--restore-signature", dest="restore_signature", action="store", help="Restore signature (need file name)")
    group.add_option("--replace", dest="replace", action="store_true", help="Replace existing signature, file layout must be: username_signature-name_signatureid.html")
    group.add_option("--default-signature", dest="default_signature", action="store_true", help="Set signature as default one")
    parser.add_option_group(group)

    # Categories setting option group
    group = OptionGroup(parser, "Categories", "")
    group.add_option("--export-categories", dest="export_categories", action="store_true", help="Export Categories (name and color)")
    group.add_option("--import-categories", dest="import_categories", action="store_true", help="Import Categories (name and color)")

    parser.add_option_group(group)
    # S/MIME option group
    group = OptionGroup(parser, "S/MIME", "")
    group.add_option("--export-smime", dest="export_smime", action="store_true", help="Export private S/MIME certificate")
    group.add_option("--import-smime", dest="import_smime", action="store", help="Import private S/MIME certificate")
    group.add_option("--public", dest="public_smime", action="store_true", help="Export/Import public S/MIME certificate")
    group.add_option("--password", dest="password", action="store", help="set password")
    group.add_option("--ask-password", dest="ask_password", action="store_true", help="ask for password if needed")
    parser.add_option_group(group)

    # WebApp setting option group
    group = OptionGroup(parser, "webapp-settings", "")
    group.add_option("--language", dest="language", action="store", type="string", help="Set new language (e.g. en_GB or nl_NL)")
    group.add_option("--theme", dest="theme", action="store", help="Change theme (e.g. dark)")
    group.add_option("--free-busy", dest="freebusy", action="store", help="Change free/busy time span in months")
    group.add_option("--icons", dest="icons", action="store", help="Change icons (e.g. breeze)")
    group.add_option("--htmleditor", dest="htmleditor", action="store", help="Change the HTML editor (e.g. full_tinymce)")
    group.add_option("--remove-state", dest="remove_state", action="store_true", help="Remove all the state settings")
    group.add_option("--add-safesender", dest="addsender", action="store", help="Add domain to safe sender list")
    parser.add_option_group(group)

    # Advanced option group
    group = OptionGroup(parser, "Advanced", "Here be dragons")
    group.add_option("--add-option", dest="add_option", action="store", help="Add/change config option (e.g. \"settings.zarafa.v1.main.active_theme = dark\")")
    parser.add_option_group(group)

    # Show the help
    if print_help:
        parser.print_help()
        sys.exit()

    return parser.parse_args()
示例#6
0
def main():
    options, _ = parser('ksplu').parse_args()
    log = logger(options)
    server = server(options=options,
                    auth_user='******',
                    auth_pass='',
                    parse_args=True)
    restriction = Restriction(
        mapiobj=SNotRestriction(SExistRestriction(PR_EC_IMAP_EMAIL_SIZE)))

    for user in server.users():  # XXX multi-company..
        # Skip users without IMAP enabled
        if not 'imap' in user.features:
            log.info('Skipping user %s, IMAP disabled', user.name)
            continue

        log.debug('Processing user %s', user.name)
        for folder in user.store.folders():
            # Inbox folder's container class is None..
            if folder.container_class != 'IPF.Note' and folder.container_class != None:
                continue

            log.info('Processing folder %s', folder.name)
            for item in folder.items(restriction=restriction):
                log.debug('Processing item %s', item.subject)
                generate_imap_message(item)
示例#7
0
def main():
    parser = kopano.parser('CKQSFl')  # select common cmd-line options
    options = parser.parse_args()[0]
    service = Service('spamd', config=CONFIG, options=options)
    if service.config['learn_ham'] == True and not os.path.exists(
            service.config['ham_dir']):
        os.makedirs(service.config['ham_dir'])
    service.start()
示例#8
0
def opt_args():
    parser = kopano.parser('skpcf')
    parser.add_option("--user", dest="user", action="store", help="Username")
    parser.add_option("--public", dest="public", action="store_true", help="Show public folders")
    parser.add_option("--delete", dest="delete", action="store", help="Delete folder based on entryid")
    parser.add_option("--extend", dest="extend", action="store_true", help="show more values")

    return parser.parse_args()
示例#9
0
def opt_args():
    parser = kopano.parser('skpc')
    parser.add_option('--store', dest='store', action='store_true',  help='Plots a graph with store sizes of users')
    parser.add_option('--folders', dest='plotfolders', action='store_true',  help='Plots a graph with the number of folders per user')
    parser.add_option('--items', dest='items', action='store_true',  help='Plots a graph with the number of items per user')
    parser.add_option('--save', dest='save', action='store',  help='Save plot to file (png)')
    parser.add_option('--sort', dest='sort', action='store_true',  help='Sort the graph')
    return parser.parse_args()
示例#10
0
def opt_args():
    parser = kopano.parser('skpul')
    parser.add_option('',
                      '--restore',
                      dest='restore',
                      action='store_true',
                      help='restore from backup')
    return parser.parse_args()
示例#11
0
def main():
    parser = kopano.parser('ckpsFl') # select common cmd-line options
    parser.add_option('-r', '--reindex', dest='reindex', action='append', default=[], help='Reindex user/store', metavar='USER')
    options, args = parser.parse_args()
    service = Service('search', config=CONFIG, options=options)
    if options.reindex:
        service.reindex()
    else:
        service.start()
示例#12
0
def main():
    parser = kopano.parser('CKQSFlVus')  # select common cmd-line options
    parser.add_option('-r', '--reindex', dest='reindex', action='store_true',help='Reindex user/store')
    options, args = parser.parse_args()
    service = Service('search', config=CONFIG, options=options)
    if options.reindex:
        service.reindex()
    else:
        service.start()
示例#13
0
def opt_args():
    parser = kopano.parser('skpc')
    parser.add_option('--system', dest='system', action='store_true',  help='Gives information about threads, SQL and caches')
    parser.add_option('--users', dest='users', action='store_true', help='Gives information about users, store sizes and quotas')
    parser.add_option('--company', dest='company', action='store_true', help='Gives information about companies, company sizes and quotas')
    parser.add_option('--servers', dest='servers', action='store_true', help='Gives information about cluster nodes')
    parser.add_option('--session', dest='session', action='store_true', help='Gives information about sessions and server time spent in SOAP calls')
    parser.add_option('--top', dest='top', action='store_true', help='Shows top-like information about sessions')
    parser.add_option('-d','--dump', dest='dump', action='store_true', help='print output as csv')
    return parser.parse_args()
示例#14
0
def opt_args():
    parser = kopano.parser('skpcfm')
    parser.add_option("--user", dest="user", action="store", help="Run script for user")
    parser.add_option("--list", dest="list", action="store_true", help="List recipients history")
    parser.add_option("--backup", dest="backup", action="store_true", help="Backup recipients history")
    parser.add_option("--restore", dest="restore", action="store_true", help="Restore recipients history")
    parser.add_option("--restore-file", dest="restorefile", action="store", help="Restore from an other file then username.json")
    parser.add_option("--remove", dest="remove", action="store", help="Remove recipients ")
    parser.add_option("--remove-all", dest="removeall", action="store_true", help="Remove complete recipients history")
    parser.add_option("--dry-run", dest="dryrun", action="store_true", help="Test script")

    return parser.parse_args()
示例#15
0
def main():
    parser = kopano.parser(
        "CSKQ",
        usage="Usage: %prog [options] from to subject username msgfile")
    options, args = parser.parse_args()

    if len(args) != 5:
        print(
            "Invalid arguments, you have to supply the arguments: from, to, subject, username, and msgfile",
            file=sys.stderr)
        sys.exit(1)

    config_dict = kopano.CONFIG
    config_dict.update(CONFIG)
    config = kopano.Config(config_dict, options=options, service="autorespond")
    log = logger("autorespond", options=options, config=config)
    server = kopano.server(options=options, config=config)

    (from_, to, subject, username, msg_file) = args
    (to_me, bcc_me, cc_me) = (
        os.getenv("MESSAGE_TO_ME"),
        os.getenv("MESSAGE_BCC_ME"),
        os.getenv("MESSAGE_CC_ME"),
    )

    try:
        fh = open(msg_file, "rb")
        msg = fh.read()
        fh.close()
    except:
        log.info("Could not open msg file: %s", msg_file)
        sys.exit(1)

    if not (config["autorespond_norecip"] or
            (config["autorespond_bcc"] and bcc_me) or
            (config["autorespond_cc"] and cc_me) or to_me):
        log.debug("Response not send due to configuration")
    elif not (from_ and to and username and msg and msg_file):
        log.info(
            "One of the input arguments was empty (from: %s, to: %s, username: %s, msg: %s)",
            from_, to, username, msg)
    elif from_ == to:
        log.info("Loop detected, from == to (%s)", from_)
    elif in_blacklist(log, from_, to):
        log.info("From or to is in blacklist (from: %s, to: %s)", from_, to)
    elif check_time(config["senddb"], config["timelimit"], username, to):
        log.info(
            "Ignoring since we already sent OOO message within timelimit (username: %s, to: %s, timelimit: %d)",
            username, to, config["timelimit"])
    else:
        add_time(config["senddb"], username, to)
        send_ooo(server, username, msg, config["copy_to_sentmail"])
        log.info("Sent OOO to %s (username %s)", to, username)
def opt_args():
    parser = kopano.parser('uskPpf')
    parser.add_option('--entryid', dest='entryid', help='Entryid to resolve')
    parser.add_option('--eml', dest='eml', action='store_true',
                      help='Write as eml to file')
    parser.add_option('--delete', dest='delete',
                      action='store_true', help='Delete the item from the store')
    options, args = parser.parse_args()
    if not options.entryid:
        parser.print_help()
        exit()
    else:
        return options
示例#17
0
def opt_args():
    parser = kopano.parser('skpcubeC')
    parser.add_option("--all",
                      dest="all",
                      action="store_true",
                      default=False,
                      help="run program for all users")
    parser.add_option("--autoremove",
                      dest="autoremove",
                      action="store_true",
                      default=False,
                      help="remove infected attachments")
    return parser.parse_args()
示例#18
0
def opt_args():
    parser = kopano.parser('skpcufm')
    parser.add_option("--dry-run",
                      dest="dryrun",
                      action="store_true",
                      help="run the script without executing any actions")

    options, args = parser.parse_args()
    if not options.users:
        parser.print_help()
        exit()
    else:
        return options
示例#19
0
def main():
    options, _ = kopano.parser('suf').parse_args()
    server = kopano.Server(options)
    if not server.options.users:
        print('No user specified')
        sys.exit(1)
    user = server.user(server.options.users[0])

    if not server.options.folders:
        folders = list(user.store.folders())
    else:
        folders = [next(user.store.folders())]

    sync_folders(folders)
示例#20
0
def opt_args():
    parser = kopano.parser('skpcfUP')
    parser.add_option("--user",
                      dest="user",
                      action="store",
                      help="Run script for user ")
    parser.add_option("--list",
                      dest="printrules",
                      action="store_true",
                      help="Print rules")
    parser.add_option("--list-all",
                      dest="printrulesall",
                      action="store_true",
                      help="Print rules including the 'hidden' folders")
示例#21
0
def main():
    parser = kopano.parser('SPQuf')
    options, args = parser.parse_args()
    server = kopano.server(options=options, parse_args=True)

    for user in kopano.users():
        if server.options.folders:
            folders = [user.folder(path) for path in server.options.folders]
        else:
            folders = [user.subtree]

        for base in folders:
            for folder in [base] + list(base.folders()):
                dump_folder(folder)
示例#22
0
def opt_args():
    parser = kopano.parser('skpcfmUP')
    parser.add_option("--user", dest="user", action="store", help="Run script for user")
    parser.add_option("--wastebasket", dest="wastebasket", action="store_true",
                      help="Run cleanup script for the wastebasket folder")
    parser.add_option("--archive", dest="archive", action="store", help="instead of removing items archive them into this folder")
    parser.add_option("--junk", dest="junk", action="store_true", help="Run cleanup script for the junk folder")
    parser.add_option("--sent", dest="sent", action="store_true", help="Run cleanup script for the sentmail folder")
    parser.add_option("--force", dest="force", action="store_true", help="Force items without date to be removed")
    parser.add_option("--days", dest="days", action="store", help="Delete older then x days")
    parser.add_option("--verbose", dest="verbose", action="store_true", help="Verbose mode")
    parser.add_option("--dry-run", dest="dryrun", action="store_true", help="Run script in dry mode")
    parser.add_option("--progressbar", dest="progressbar", action="store_true", help="Show progressbar ")
    parser.add_option("--recursive", dest="recursive", action="store_true", help="Delete sufolders recursivly")
    return parser.parse_args()
def opt_args():
    parser = kopano.parser('skpfcum')
    parser.add_option("--header", dest="header",
                      action="store_true", help="check on duplicate header id")
    parser.add_option("--body", dest="body", action="store_true",
                      help="check on duplicate body ")
    parser.add_option("--verbose", dest="verbose",
                      action="store_true", help="verbose mode")

    options, args = parser.parse_args()
    if not (options.header or options.body):
        parser.print_help()
        exit()
    else:
        return options
示例#24
0
def main():
    # select common options
    parser = kopano.parser('CKQSufwUPcslObeV', usage='kopano-backup [PATH] [options]')

    # add custom options
    parser.add_option('', '--skip-junk', dest='skip_junk', action='store_true', help='skip junk folder')
    parser.add_option('', '--skip-deleted', dest='skip_deleted', action='store_true', help='skip deleted items folder')
    parser.add_option('', '--skip-public', dest='skip_public', action='store_true', help='skip public store')
    parser.add_option('', '--skip-attachments', dest='skip_attachments', action='store_true', help='skip attachments')
    parser.add_option('', '--skip-meta', dest='skip_meta', action='store_true', help='skip metadata')
    parser.add_option('', '--only-meta', dest='only_meta', action='store_true', help='only backup/restore metadata')
    parser.add_option('', '--deletes', dest='deletes', help='store/restore deleted items/folders', metavar='YESNO')
    parser.add_option('', '--purge', dest='purge', type='int', help='purge items/folders deleted more than N days ago', metavar='N')
    parser.add_option('', '--restore', dest='restore', action='store_true', help='restore from backup')
    parser.add_option('', '--restore-root', dest='restore_root', help='restore under specific folder', metavar='PATH')
    parser.add_option('', '--stats', dest='stats', action='store_true', help='list folders for PATH')
    parser.add_option('', '--index', dest='index', action='store_true', help='list items for PATH')
    parser.add_option('', '--sourcekey', dest='sourcekeys', action='append', default=[], help='restore specific sourcekey', metavar='SOURCEKEY')
    parser.add_option('', '--recursive', dest='recursive', action='store_true', help='backup/restore folders recursively')
    parser.add_option('', '--differential', dest='differential', action='store_true', help='create/restore differential backup')
    parser.add_option('', '--overwrite', dest='overwrite', action='store_true', help='overwrite duplicate items')
    parser.add_option('', '--merge', dest='merge', action='store_true', help='merge differential backups')
    parser.add_option('', '--clean-folders', dest='clean_folders', action='store_true', help='empty folder(s) before restore (dangerous!)')

    # parse and check command-line options
    options, args = parser.parse_args()

    options.service = False
    if options.restore or options.merge or options.stats or options.index or (options.purge is not None):
        if len(args) != 1 or not os.path.isdir(args[0]):
            fatal('please specify path to backup data')
    elif len(args) != 0:
        fatal('too many arguments')
    if options.deletes and options.deletes not in ('yes', 'no'):
        fatal("--deletes option takes 'yes' or 'no'")
    if options.folders and (options.differential or (options.purge is not None) or options.merge):
        fatal('invalid use of --folder option')
    if options.output_dir and options.differential:
        fatal('invalid use of --output-dir option')
    if options.sourcekeys and options.differential:
        fatal('invalid use of --sourcekeys option')

    if options.stats or options.index:
        # handle --stats/--index
        show_contents(args[0], options)
    else:
        # start backup/restore
        Service('backup', options=options, config=CONFIG, args=args).start()
示例#25
0
def opt_args():
    parser = kopano.parser('skfpcmuUP')
    parser.add_option("--hidden",
                      dest="hidden",
                      action="store_true",
                      help="Show hidden folders")
    parser.add_option("--public",
                      dest="public",
                      action="store_true",
                      help="Run for public store")
    parser.add_option(
        "--older-then",
        dest="timestamp",
        action="store",
        help="Hide items that are younger then (dd-mm-yyyy 00:00)")
    return parser.parse_args()
示例#26
0
def opt_args():
    parser = kopano.parser('skpcf')
    parser.add_option("--user", dest="user", action="store", help="username")
    parser.add_option("--modify",
                      dest="modify",
                      action="store_true",
                      help="Run script and save the changes ")
    parser.add_option("--restore",
                      dest="restore",
                      action="store_true",
                      help="Restore changes this script made ")
    parser.add_option("--verbose",
                      dest="verbose",
                      action="store_true",
                      help="verbose mode ")
    return parser.parse_args()
示例#27
0
def opt_args():
    parser = kopano.parser('skpcUPv')
    parser.add_option("--user", dest="user", action="store", help="Run script for user ")
    parser.add_option("--list", dest="listrules", action="store_true", help="Print rules")
    parser.add_option("--rule", dest="rule", action="store", type="int", help="rule id")
    parser.add_option("--state", dest="state", action="store", help="enable, disable, delete, create")
    parser.add_option("--empty-rules", dest="emptyRules", action="store_true", help="Empty the rules table for a specific user")
    parser.add_option("--create", dest="createrule", action="store",
                      help="create rule, use  --conditions and --actions")
    parser.add_option("--conditions", dest="conditions", action="append", default=[], help="conditions")
    parser.add_option("--actions", dest="actions", action="append", default=[],help="actions")
    parser.add_option("--exceptions", dest="exceptions", action="append", default=[], help="exceptions")
    parser.add_option("--stop-processing", dest="StopProcessingRules", action="store_true", help="Stop processing more rules on this message")
    parser.add_option("--create-if-missing", dest="CreateFolder", action="store_true", help="Create folder if not exist")
    parser.add_option("--import-exchange-rules", dest="importFile", action="store", help="Json file from exchange")
    parser.add_option("--ldap-config", dest="configFile", action="store", help="Config file for LDAP options")
    return parser.parse_args()
def opt_args():
    parser = kopano.parser('skpcfUP')
    parser.add_option("--user", dest="user", action="store", help="Run script for user ")
    parser.add_option("--list", dest="printrules", action="store_true", help="Print rules")
    parser.add_option("--list-all", dest="printrulesall", action="store_true", help="Print rules including the 'hidden' folders")
    parser.add_option("--details", dest="printdetails", action="store_true", help="Print more details")
    parser.add_option("--calculate", dest="calc", action="store_true", help="Calculate persmissions")
    parser.add_option("--remove", dest="remove", action="store", help="Remove permissions for this user")
    parser.add_option("--add", dest="add", action="store", help="Add permissions for this user")
    parser.add_option("--permission", dest="permission", action="store",
                      help="Set permissions [norights|readonly|secretary|owner|fullcontrol] or use the calculate "
                           "options to give a custom permission set")
    parser.add_option("--delegate", dest="delegate", action="store_true", help="Add user as delegate")
    parser.add_option("--private", dest="private", action="store_true", help="Allow delegate to see private items")
    parser.add_option("--copy", dest="copy", action="store_true", help="Send copy of meeting request to delegate")

    return parser.parse_args()
示例#29
0
def main():
    # select common options
    parser = kopano.parser('SUPKQCFulw')

    # custom options
    parser.add_option('--add', dest='add', action='store_true', help='Add user')
    parser.add_option('--target', dest='target', action='store', help=optparse.SUPPRESS_HELP) # TODO remove (still used in testset/msr)
    parser.add_option('--server', dest='server', action='store', help='Specify target server')
    parser.add_option('--remove', dest='remove', action='store_true', help='Remove user')
    parser.add_option('--list-users', dest='list_users', action='store_true', help='List users')

    # parse and check command-line options
    options, args = parser.parse_args()

    service = Service('msr', options=options, config=CONFIG)

    if options.users:
        if options.list_users:
            print('too many options provided')
            sys.exit(1)
        if len(options.users) != 1:
            print('more than one user specified', file=sys.stderr)
            sys.exit(1)
        if options.add:
            if not (options.target or options.server):
                print('no server specified', file=sys.stderr)
                sys.exit(1)
            service.cmd_add(options)
        elif options.remove:
            service.cmd_remove(options)
        else:
            service.cmd_details(options)

    elif options.list_users:
        if options.add or options.remove or options.target or options.server:
            print('too many options provided')
            sys.exit(1)
        service.cmd_list()

    else:
        if options.add or options.remove or options.target or options.server:
            print('no user specified')
            sys.exit(1)
        service.start()
示例#30
0
def opt_args():
    parser = kopano.parser('skpcmUP')
    parser.add_option("--user",
                      dest="user",
                      action="store",
                      help="Run script for user")
    parser.add_option(
        "--folder",
        dest="folder",
        action="store",
        help="Select an other contacts folder then the default one")
    parser.add_option("--export",
                      dest="export",
                      action="store_true",
                      help="export contacts")
    parser.add_option("--import",
                      dest="restore",
                      action="store",
                      help="import contacts")
    parser.add_option("--delimiter",
                      dest="delimiter",
                      action="store",
                      help="Change delimiter (default is ,)")
    parser.add_option("--purge",
                      dest="purge",
                      action="store_true",
                      help="Purge contacts before the import")
    parser.add_option("--progressbar",
                      dest="progressbar",
                      action="store_true",
                      help="Show progressbar ")
    parser.add_option("--public",
                      dest="public",
                      action="store_true",
                      help="Run script for public store")
    parser.add_option("--format",
                      dest="format",
                      action="store",
                      help="Format that is used for display name if"
                      "entry is empty default:"
                      "'lastname, firstname, middlename (email)'")

    return parser.parse_args()
示例#31
0
def main():
    parser = kopano.parser('ckpsF') # select common cmd-line options
    options, args = parser.parse_args()
    service = Service('dspam', config=CONFIG, options=options)
    service.start()