def take_action(self, args): playbooks = models.Playbook.query if args.incomplete: playbooks = playbooks.filter_by(complete=False) if args.complete: playbooks = playbooks.filter_by(complete=True) return utils.fields_from_iter(FIELDS, playbooks)
def take_action(self, args): hosts = (models.Host.query.order_by(models.Host.name)) if args.playbook: hosts = (hosts.join(models.HostPlaybook).join( models.Playbook).filter(models.Playbook.id == args.playbook)) return utils.fields_from_iter(FIELDS, hosts)
def take_action(self, parsed_args): plays = (models.Play.query.join(models.Playbook).filter( models.Play.playbook_id == models.Playbook.id)) return utils.fields_from_iter(FIELDS, plays, xforms={ 'Playbook': lambda p: p.path, })
def take_action(self, parsed_args): plays = (models.Play.query .join(models.Playbook) .filter(models.Play.playbook_id == models.Playbook.id)) return utils.fields_from_iter( FIELDS, plays, xforms={ 'Playbook': lambda p: p.path, })
def take_action(self, args): playbooks = (models.Playbook.query.order_by( models.Playbook.time_start)) if args.incomplete: playbooks = playbooks.filter_by(complete=False) if args.complete: playbooks = playbooks.filter_by(complete=True) return utils.fields_from_iter(FIELDS, playbooks)
def take_action(self, parsed_args): stats = (models.Stats.query.join(models.Playbook).join( models.Host).filter( models.Stats.playbook_id == models.Playbook.id).filter( models.Stats.host_id == models.Host.id)) return utils.fields_from_iter(FIELDS, stats, xforms={ 'Playbook': lambda p: p.path, })
def take_action(self, parsed_args): results = (models.TaskResult.query.join(models.Task).join( models.Host).filter( models.TaskResult.task_id == models.Task.id).filter( models.TaskResult.host_id == models.Host.id)) return utils.fields_from_iter(FIELDS, results, xforms={ 'Task': lambda t: t.name, })
def take_action(self, args): hosts = (models.Host.query .order_by(models.Host.name)) if args.playbook: hosts = (hosts .join(models.HostPlaybook) .join(models.Playbook) .filter(models.Playbook.id == args.playbook)) return utils.fields_from_iter(FIELDS, hosts)
def take_action(self, parsed_args): tasks = (models.Task.query.join(models.Play).join( models.Playbook).filter( models.Task.play_id == models.Play.id).filter( models.Task.playbook_id == models.Playbook.id)) return utils.fields_from_iter(FIELDS, tasks, xforms={ 'Playbook': lambda p: p.path, 'Play': lambda p: p.name, })
def take_action(self, parsed_args): stats = (models.Stats.query .join(models.Playbook) .join(models.Host) .filter(models.Stats.playbook_id == models.Playbook.id) .filter(models.Stats.host_id == models.Host.id)) return utils.fields_from_iter( FIELDS, stats, xforms={ 'Playbook': lambda p: p.path, })
def take_action(self, parsed_args): tasks = (models.Task.query .join(models.Play) .join(models.Playbook) .filter(models.Task.play_id == models.Play.id) .filter(models.Task.playbook_id == models.Playbook.id)) return utils.fields_from_iter( FIELDS, tasks, xforms={ 'Playbook': lambda p: p.path, 'Play': lambda p: p.name, })
def take_action(self, args): plays = (models.Play.query.join(models.Playbook).filter( models.Play.playbook_id == models.Playbook.id).order_by( models.Play.time_start, models.Play.sortkey)) if args.playbook: plays = (plays.filter(models.Play.playbook_id == args.playbook)) return utils.fields_from_iter(FIELDS, plays, xforms={ 'Playbook': lambda p: p.path, })
def take_action(self, args): plays = (models.Play.query .join(models.Playbook) .filter(models.Play.playbook_id == models.Playbook.id) .order_by(models.Play.time_start, models.Play.sortkey)) if args.playbook: plays = (plays .filter(models.Play.playbook_id == args.playbook)) return utils.fields_from_iter( FIELDS, plays, xforms={ 'Playbook': lambda p: p.path, })
def test_fields_from_iter_xform(self): fields = ( ('Field 1',), ('Field 2', 'field2'), ) items = [ Mock(field_1='value 1', field2='value 2'), ] res = u.fields_from_iter(fields, items, xforms={'Field 2': lambda x: x.upper()}) self.assertEqual(res, (('Field 1', 'Field 2'), [['value 1', 'VALUE 2']]))
def test_fields_from_iter(self): fields = ( ('Field 1',), ('Field 2', 'field2'), ('Field 3', 'field3.value'), ) items = [ Mock(field_1='value 1', field2='value 2', field3=Mock(value='value 3')), ] res = u.fields_from_iter(fields, items) self.assertEqual(res, (('Field 1', 'Field 2', 'Field 3'), [['value 1', 'value 2', 'value 3']]))
def take_action(self, args): tasks = (models.Task.query.join(models.Play).join( models.Playbook).filter( models.Task.play_id == models.Play.id).filter( models.Task.playbook_id == models.Playbook.id).order_by( models.Task.time_start, models.Task.sortkey)) if args.play: tasks = (tasks.filter(models.Task.play_id == args.play)) elif args.playbook: tasks = (tasks.filter(models.Task.playbook_id == args.playbook)) return utils.fields_from_iter(FIELDS, tasks, xforms={ 'Playbook': lambda p: p.path, 'Play': lambda p: p.name, })
def take_action(self, args): tasks = (models.Task.query .join(models.Play) .join(models.Playbook) .filter(models.Task.play_id == models.Play.id) .filter(models.Task.playbook_id == models.Playbook.id) .order_by(models.Task.time_start, models.Task.sortkey)) if args.play: tasks = (tasks .filter(models.Task.play_id == args.play)) elif args.playbook: tasks = (tasks .filter(models.Task.playbook_id == args.playbook)) return utils.fields_from_iter( FIELDS, tasks, xforms={ 'Playbook': lambda p: p.path, 'Play': lambda p: p.name, })
def take_action(self, args): results = (models.TaskResult.query .join(models.Task) .join(models.Host) .filter(models.TaskResult.task_id == models.Task.id) .filter(models.TaskResult.host_id == models.Host.id)) if args.playbook: results = (results .filter(models.Task.playbook_id == args.playbook)) elif args.play: results = (results .filter(models.Task.play_id == args.play)) elif args.task: results = (results .filter(models.TaskResult.task_id == args.task)) return utils.fields_from_iter( FIELDS, results, xforms={ 'Task': lambda t: t.name, })
def take_action(self, args): results = (models.TaskResult.query .join(models.Task) .join(models.Host) .filter(models.TaskResult.task_id == models.Task.id) .filter(models.TaskResult.host_id == models.Host.id) .order_by(models.Task.time_start, models.Task.sortkey)) if args.playbook: results = (results .filter(models.Task.playbook_id == args.playbook)) elif args.play: results = (results .filter(models.Task.play_id == args.play)) elif args.task: results = (results .filter(models.TaskResult.task_id == args.task)) return utils.fields_from_iter( FIELDS, results, xforms={ 'Task': lambda t: t.name, })
def take_action(self, parsed_args): playbooks = models.Playbook.query.all() return utils.fields_from_iter(FIELDS, playbooks)
def take_action(self, parsed_args): hosts = models.Host.query.all() return utils.fields_from_iter(FIELDS, hosts)
def take_action(self, parsed_args): hosts = models.Host.query.all() return utils.fields_from_iter(FIELDS, hosts)
def take_action(self, parsed_args): playbooks = models.Playbook.query.all() return utils.fields_from_iter(FIELDS, playbooks)