plugin/builder: use global constant for cfg files

Use a global constant `DEFAULT_CONFIG_FILES` for the default
plugin configuration files. Besides giving it more visibility
it also makes it easier to test, because in the unit test,
this can easily be overwritten.
This commit is contained in:
Christian Kellner 2020-09-16 17:18:37 +02:00
parent cde65d1f74
commit 9eeb810e3f

View file

@ -33,6 +33,10 @@ from koji.tasks import BaseTaskHandler
DEFAULT_COMPOSER_URL = "http://localhost:8701/"
DEFAULT_KOJIHUB_URL = "https://localhost/kojihub"
DEFAULT_CONFIG_FILES = [
"/usr/share/koji-osbuild/builder.conf",
"/etc/koji-osbuild/builder.conf"
]
# The following classes are a implementation of osbuild composer's
@ -211,10 +215,7 @@ class OSBuildImage(BaseTaskHandler):
"koji": {"url": DEFAULT_KOJIHUB_URL}
})
cfg.read([
"/usr/share/koji-osbuild/builder.conf",
"/etc/koji-osbuild/builder.conf"
])
cfg.read(DEFAULT_CONFIG_FILES)
self.composer_url = cfg["composer"]["url"]
self.koji_url = cfg["koji"]["url"]