コード例 #1
0
    def __init__(self, package):
        """Constructor.

        :param package: execute resource
        :type package: object
        """
        super(AnsibleExecutorPlugin, self).__init__(package)

        # set required attributes
        self._desc = getattr(package, 'description')
        self.all_hosts = getattr(package, 'all_hosts', [])
        self.playbook = getattr(package, 'playbook', None)
        self.script = getattr(package, 'script', None)
        self.shell = getattr(package, 'shell', None)
        self.git = getattr(package, 'git', None)
        self.artifacts = getattr(package, 'artifacts')
        self.options = getattr(package, 'ansible_options', None)
        self.ignorerc = getattr(package, 'ignore_rc', False)
        self.validrc = getattr(package, 'valid_rc', None)

        self.injector = DataInjector(self.all_hosts)

        self.ans_service = AnsibleService(
            self.config,
            self.hosts,
            self.all_hosts,
            self.options,
            concurrency=self.config['TASK_CONCURRENCY']['EXECUTE'].lower())

        self.ans_verbosity = get_ans_verbosity(self.config)

        # attribute defining overall status of test execution. why is this
        # needed? when a test fails we handle the exception raised and call
        # the method to archive test artifacts. once fetching artifacts is
        # finished this status is used to fail teflo (if needed)
        self.status = 0
コード例 #2
0
def test_ansible_verbosity_5(config):
    """This test verifies if ansible_verbosity is NOT set in teflo.cfg, verbosity is
     'vvvv' if teflo's logging level is debug. For this test logging_level debug is set in ../assets/teflo.cfg"""
    config["ANSIBLE_VERBOSITY"] = None
    assert get_ans_verbosity(config) == 'vvvv'
コード例 #3
0
def test_ansible_verbosity_4(config):
    """This test verifies if ansible_verbosity is NOT set in teflo.cfg, verbosity is
     None if teflo's logging level is info"""
    config["ANSIBLE_VERBOSITY"] = None
    config["LOG_LEVEL"] = 'info'
    assert get_ans_verbosity(config) is None
コード例 #4
0
def test_ansible_verbosity_3(config):
    """This test verifies if incorrect values for ansible_verbosity is set in teflo.cfg, verbosity is
     None if teflo's logging level is info"""
    config["ANSIBLE_VERBOSITY"] = 'aavv'
    config["LOG_LEVEL"] = 'info'
    assert get_ans_verbosity(config) is None
コード例 #5
0
def test_ansible_verbosity_2(config):
    """This test verifies if incorrect values for ansible_verbosity is set in teflo.cfg, then verbosity is
     'vvvv' if teflo's logging level is debug.  For this test logging_level debug is set in ../assets/teflo.cfg"""
    config["ANSIBLE_VERBOSITY"] = 'aavv'
    assert get_ans_verbosity(config) == 'vvvv'
コード例 #6
0
def test_ansible_verbosity_1(config):
    """This test verifies the ansible verbosity set using teflo.cfg is valid. For this test
    teflo.cfg under ../assets/teflo.cfg is used and has ansible_verbosity set as 'v'"""
    assert get_ans_verbosity(config) == 'v'