# fedora-messaging consumer configuration file for the openQA job
# scheduler. See the openqa/dispatcher main.yml comments for details
# on the variables that must be set here.
#
# This file is in the TOML format.

amqp_url = "{{ openqa_amqp_scheduler_url }}"
{% if openqa_amqp_passive|bool %}
passive_declares = true
{% endif %}
callback = "fedora_openqa.consumer:OpenQAScheduler"

[tls]
ca_cert = "{{ openqa_amqp_scheduler_cacert }}"
keyfile = "{{ openqa_amqp_scheduler_key }}"
certfile = "{{ openqa_amqp_scheduler_cert }}"

[client_properties]
app = "Fedora openQA scheduler"
app_url = "https://pagure.io/fedora-qa/fedora_openqa"
app_contacts_email = ["adamwill@fedoraproject.org", "lruzicka@redhat.com", "qa-devel@lists.fedoraproject.org"]

[exchanges."amq.topic"]
type = "topic"
durable = true
auto_delete = false
arguments = {}

[queues."{{ openqa_amqp_scheduler_queue }}"]
durable = false
auto_delete = true
exclusive = true
arguments = {}

[[bindings]]
queue = "{{ openqa_amqp_scheduler_queue }}"
exchange = "amq.topic"
routing_keys = [{% for key in openqa_amqp_scheduler_routing_keys %}"{{ key }}",{% endfor %}]
# need this to receive messages from ZMQ->AMQP bridge
[[bindings]]
queue = "{{ openqa_amqp_scheduler_queue }}"
exchange = "zmq.topic"
routing_keys = [{% for key in openqa_amqp_scheduler_routing_keys %}"{{ key }}",{% endfor %}]

[consumer_config]
openqa_hostname = "{{ openqa_hostname }}"
update_arches = [{% for arch in openqa_update_arches %}"{{ arch }}",{% endfor %}]

[qos]
prefetch_size = 0
prefetch_count = 25

[log_config]
version = 1
disable_existing_loggers = true

[log_config.formatters.simple]
format = "[%(levelname)s %(name)s] %(message)s"

[log_config.handlers.console]
class = "logging.StreamHandler"
formatter = "simple"
stream = "ext://sys.stdout"

{% if openqa_amqp_mailto is defined %}
[log_config.handlers.email]
class = "logging.handlers.SMTPHandler"
formatter = "simple"
level = "ERROR"
mailhost = "{{ openqa_amqp_smtp }}"
fromaddr = "{{ openqa_amqp_mailfrom }}"
toaddrs = [{% for key in openqa_amqp_mailto %}"{{ key }}",{% endfor %}]
subject = "openQA scheduler error"
{% endif %}

[log_config.loggers.OpenQAScheduler]
level = "INFO"
propagate = false
{% if openqa_amqp_mailto is defined %}
handlers = ["console", "email"]
{% else %}
handlers = ["console"]
{% endif %}

[log_config.loggers.fedora_messaging]
level = "INFO"
propagate = false
{% if openqa_amqp_mailto is defined %}
handlers = ["console", "email"]
{% else %}
handlers = ["console"]
{% endif %}

[log_config.loggers.twisted]
level = "INFO"
propagate = false
{% if openqa_amqp_mailto is defined %}
handlers = ["console", "email"]
{% else %}
handlers = ["console"]
{% endif %}

[log_config.loggers.pika]
level = "WARNING"
propagate = false
handlers = ["console"]

[log_config.loggers.fedora_openqa]
level = "INFO"
propagate = false
handlers = ["console"]

[log_config.root]
level = "ERROR"
{% if openqa_amqp_mailto is defined %}
handlers = ["console", "email"]
{% else %}
handlers = ["console"]
{% endif %}
