Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
task=task,
host=host,
result=result)
if gather_facts:
facts = m.HostFacts(host=host, values='{"fact": "value"}')
ctx['facts'] = facts
if ara_record:
data = m.Data(playbook=playbook, key='test key', value='test value')
ctx['data'] = data
for obj in ctx.values():
if hasattr(obj, 'start'):
obj.start()
db.session.add(obj)
db.session.commit()
if complete:
stats = m.Stats(playbook=playbook, host=host)
ctx['stats'] = stats
db.session.add(stats)
ctx['playbook'].complete = True
for obj in ctx.values():
if hasattr(obj, 'stop'):
obj.stop()
db.session.commit()
return ctx
host=self.host,
)
self.stats = m.Stats(
playbook=self.playbook,
host=self.host,
changed=0,
failed=0,
skipped=0,
unreachable=0,
ok=0,
)
for obj in [self.playbook, self.play, self.task, self.data,
self.host, self.task_result, self.stats]:
m.db.session.add(obj)
m.db.session.commit()
def tearDown(self):
m.db.session.remove()
m.db.drop_all()
def tearDown(self):
m.db.session.remove()
m.db.drop_all()
def tearDown(self):
m.db.session.remove()
m.db.drop_all()
def tearDown(self):
m.db.session.remove()
m.db.drop_all()
pids = []
for pid in args.playbook_id:
res = models.Playbook.query.get(pid)
if res is None:
if args.ignore_errors:
self.log.warning('Playbook %s does not exist '
'(ignoring)' % pid)
else:
raise RuntimeError('Playbook %s does not exist' % pid)
else:
pids.append(pid)
for pid in pids:
self.log.warning('deleting playbook %s', pid)
playbook = models.Playbook.query.get(pid)
db.session.delete(playbook)
db.session.commit()
def get_or_create_host(self, hostname):
try:
host = (models.Host.query
.filter_by(name=hostname)
.filter_by(playbook_id=self.playbook.id)
.one())
except models.NoResultFound:
host = models.Host(name=hostname, playbook=self.playbook)
db.session.add(host)
db.session.commit()
return host
changed=result._result.get('changed', False),
failed=result._result.get('failed', False),
skipped=result._result.get('skipped', False),
unreachable=result._result.get('unreachable', False),
ignore_errors=kwargs.get('ignore_errors', False),
)
db.session.add(self.taskresult)
db.session.commit()
if self.task.action == 'setup' and 'ansible_facts' in result._result:
values = jsonutils.dumps(result._result['ansible_facts'])
facts = models.HostFacts(values=values)
host.facts = facts
db.session.add(facts)
db.session.commit()