<commit_before># -*- coding: utf-8 -*-
from fabric import api as fabric_api
from fabric.state import env
import os

from solar.core.log import log
from solar.core.handlers.base import TempFileHandler
from solar import errors


# otherwise fabric will sys.exit(1) in case of errors
env.warn_only = True

class AnsibleTemplate(TempFileHandler):
    def action(self, resource, action_name):
        inventory_file = self._create_inventory(resource)
        playbook_file = self._create_playbook(resource, action_name)
        log.debug('inventory_file: %s', inventory_file)
        log.debug('playbook_file: %s', playbook_file)
        call_args = ['ansible-playbook', '--module-path', '/vagrant/library', '-i', inventory_file, playbook_file]
        log.debug('EXECUTING: %s', ' '.join(call_args))

        out = fabric_api.local(' '.join(call_args), capture=True)<commit_msg>Disable host key checking for ansible<commit_after># -*- coding: utf-8 -*-
from fabric import api as fabric_api
from fabric.state import env
import os

from solar.core.log import log
from solar.core.handlers.base import TempFileHandler
from solar import errors


# otherwise fabric will sys.exit(1) in case of errors
env.warn_only = True

class AnsibleTemplate(TempFileHandler):
    def action(self, resource, action_name):
        inventory_file = self._create_inventory(resource)
        playbook_file = self._create_playbook(resource, action_name)
        log.debug('inventory_file: %s', inventory_file)
        log.debug('playbook_file: %s', playbook_file)
        call_args = ['ansible-playbook', '--module-path', '/vagrant/library', '-i', inventory_file, playbook_file]
        log.debug('EXECUTING: %s', ' '.join(call_args))

        with fabric_api.shell_env(ANSIBLE_HOST_KEY_CHECKING='False'):
            out = fabric_api.local(' '.join(call_args), capture=True)
{'fraction_non_alphanumeric': 0.11646803900325027, 'fraction_numerical': 0.0021668472372697724, 'mean_word_length': 4.144846796657381, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2264810', 'n_tokens_mistral': 566, 'n_tokens_neox': 558, 'n_words': 142}