def archive(): if project.verbose: print('ARCHIVE') day = project.date - timedelta(days=abs(project.task['days'])) for object in object_list(project.task['auth'], project.task['storage']['bucket'] + ':' + project.task['storage']['path'], files_only=True, raw=True): object_day = datetime.strptime(object['updated'], '%Y-%m-%dT%H:%M:%S.%fZ').date() if object_day <= day: if project.task.get('delete', False) == False: if project.verbose: print('ARCHIVING FILE:', object['name']) object_move( project.task['auth'], '%s:%s' % (object['bucket'], object['name']), '%s:archive/%s' % (object['bucket'], object['name'])) else: if project.verbose: print('DELETING FILE:', ) object_delete(project.task['auth'], '%s:%s' % (object['bucket'], object['name']))
def storage_exists(config, task): print('TEST: storage_exists') if object_exists( config, task['auth'], '%s:%s' % (task['storage']['bucket'], task['storage']['file'])): if task.get('delete', False): object_delete( config, task['auth'], '%s:%s' % (task['storage']['bucket'], task['storage']['file'])) test_passed() else: test_failed()
def storage_exists(): if object_exists( project.task['auth'], '%s:%s' % (project.task['storage']['bucket'], project.task['storage']['file'])): if project.task.get('delete', False): object_delete( project.task['auth'], '%s:%s' % (project.task['storage']['bucket'], project.task['storage']['file'])) print('PASSED') else: print('FAILED')
def storage_exists(): if object_exists( project.task['auth'], '%s:%s' % (project.task['storage']['bucket'], project.task['storage']['file'])): if project.task.get('delete', False): object_delete( project.task['auth'], '%s:%s' % (project.task['storage']['bucket'], project.task['storage']['file'])) test_passed() else: test_failed()
def archive(): if project.verbose: print('ARCHIVE') day = project.date - timedelta(days=abs(project.task['days'])) if 'storage' in project.task: for file_name in object_list(project.task['auth'], project.task['storage']['bucket'] + ':' + project.task['storage']['path'], files_only=True): file_day = parse_yyyymmdd(file_name) if file_day and file_day <= day: if project.task.get('delete', False) == False: if project.verbose: print('ARCHIVING FILE:', file_name) object_move(project.task['auth'], file_name, file_name.replace(':', ':archive/')) else: if project.verbose: print('DELETING FILE:', file_name) object_delete(project.task['auth'], file_name)