# Buggy code
def set_options(self, options):
    super(CallbackModule, self).set_options(options)

    self.FOREMAN_URL = self._plugin_options["url"]
    self.FOREMAN_SSL_CERT = (
        self._plugin_options["ssl_cert"],
        self._plugin_options["ssl_key"],
    )
    self.FOREMAN_SSL_VERIFY = self._plugin_options["verify_certs"]

    if HAS_REQUESTS:
        requests_major = int(requests.__version__.split(".")[0])
        if requests_major >= 2:
            self.ssl_verify = self._ssl_verify()
        else:
            self._disable_plugin("The `requests` python module is too old.")
    else:
        self._disable_plugin("The `requests` python module is not installed.")

    if self.FOREMAN_URL.startswith("https://"):
        if not os.path.exists(self.FOREMAN_SSL_CERT[0]):
            self._disable_plugin(
                "FOREMAN_SSL_CERT %s not found." % self.FOREMAN_SSL_CERT[0]
            )

        if not os.path.exists(self.FOREMAN_SSL_CERT[1]):
            self._disable_plugin(
                "FOREMAN_SSL_KEY %s not found." % self.FOREMAN_SSL_CERT[1]
            )


# Traceback (TypeError)
$ ansible-playbook test_play.yml -vvv
ansible-playbook 2.5.0 (devel a40ce1ba5e) last updated 2017/11/17 16:31:10 (GMT +1000)
config file = /home/will/src/ansible/ansible.cfg
configured module search path = [u'/home/will/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /home/will/src/ansible/lib/ansible
executable location = /home/will/src/ansible/bin/ansible-playbook
python version = 2.7.14 (default, Nov  2 2017, 18:42:05) [GCC 7.2.1 20170915 (Red Hat 7.2.1-2)]
Using /home/will/src/ansible/ansible.cfg as config file
Parsed /etc/ansible/hosts inventory source with ini plugin
[WARNING]: Could not match supplied host pattern, ignoring: all

[WARNING]: provided hosts list is empty, only localhost is available

ERROR! Unexpected Exception, this is probably a bug: set_options() takes exactly 2 arguments (1 given)
the full traceback was:

Traceback (most recent call last):
File "/home/will/src/ansible/bin/ansible-playbook", line 109, in <module>
exit_code = cli.run()
File "/home/will/src/ansible/lib/ansible/cli/playbook.py", line 130, in run
results = pbex.run()
File "/home/will/src/ansible/lib/ansible/executor/playbook_executor.py", line 90, in run
self._tqm.load_callbacks()
File "/home/will/src/ansible/lib/ansible/executor/task_queue_manager.py", line 210, in load_callbacks
callback_obj.set_options()
TypeError: set_options() takes exactly 2 arguments (1 given)

# Fixed code
def set_options(self, task_keys=None, var_options=None, direct=None):
    super(CallbackModule, self).set_options(
        task_keys=task_keys, var_options=var_options, direct=direct
    )

    self.FOREMAN_URL = self._plugin_options["url"]
    self.FOREMAN_SSL_CERT = (
        self._plugin_options["ssl_cert"],
        self._plugin_options["ssl_key"],
    )
    self.FOREMAN_SSL_VERIFY = self._plugin_options["verify_certs"]

    if HAS_REQUESTS:
        requests_major = int(requests.__version__.split(".")[0])
        if requests_major >= 2:
            self.ssl_verify = self._ssl_verify()
        else:
            self._disable_plugin("The `requests` python module is too old.")
    else:
        self._disable_plugin("The `requests` python module is not installed.")

    if self.FOREMAN_URL.startswith("https://"):
        if not os.path.exists(self.FOREMAN_SSL_CERT[0]):
            self._disable_plugin(
                "FOREMAN_SSL_CERT %s not found." % self.FOREMAN_SSL_CERT[0]
            )

        if not os.path.exists(self.FOREMAN_SSL_CERT[1]):
            self._disable_plugin(
                "FOREMAN_SSL_KEY %s not found." % self.FOREMAN_SSL_CERT[1]
            )