コード例 #1
0
 def process_timer(self, rc, handles, mgmt_handles):
     dirs_pending = get_dirs_pending_changes()
     if dirs_pending:
         log.info('The following directories have pending changes:\n   %s'
                   % '\n   '.join(dirs_pending), culprit='anagogic.service'
                     )
         for d in dirs_pending:
             if not upload_in_progress(d):
                 _, changed, _, _ = get_watched_directory_info(d)
                 if enough_time_elapsed(changed):
                     sync_dir(d)
                 else:
                     log.info('Not enough time has elapsed since last backup '
                              'for %s' % d, culprit=__culprit__)
             else:
                 log.info('Backup in progress for %s' % d, culprit=__culprit__)
     return False
コード例 #2
0
    account_info = ''

    try:
        sess = get_session()
        if not app_container_exists(sess):
            create_container(sess)
    except ClientException, e:
        log.error('Swift get_session() error: %s' % e.message, exc_info=True, culprit=__culprit__)

    watched_data = {
        'dirs': []
    }
    watched_dirs = get_watched_directories()
    for dir in watched_dirs:
        added, changed, _, _ = get_watched_directory_info(dir)
        watched_data['dirs'].append(
            {
                'directory': dir,
                'added': added,
                'changed': changed,
            }
        )
        continue

    restartneeded = get_reg_value('HKLM', APP_REG_KEY, 'restartneeded')
    internal_error = get_reg_value('HKLM', APP_REG_KEY, 'internal_error', False)
    data = {
        'template_lookup': [templates,],
        'restartneeded': restartneeded,
        'internalerror': internal_error,