Merge "Handle zuul.yaml files with only comments"
This commit is contained in:
commit
bb01c1613f
|
@ -0,0 +1 @@
|
|||
test
|
|
@ -0,0 +1,2 @@
|
|||
- hosts: all
|
||||
tasks: []
|
|
@ -0,0 +1 @@
|
|||
# test comment
|
|
@ -0,0 +1 @@
|
|||
test
|
|
@ -0,0 +1,8 @@
|
|||
- tenant:
|
||||
name: tenant-one
|
||||
source:
|
||||
gerrit:
|
||||
config-projects:
|
||||
- common-config
|
||||
untrusted-projects:
|
||||
- org/project
|
|
@ -1318,6 +1318,18 @@ class TestCentralJobs(ZuulTestCase):
|
|||
self._test_central_template_on_branch('stable', 'master')
|
||||
|
||||
|
||||
class TestEmptyConfigFile(ZuulTestCase):
|
||||
tenant_config_file = 'config/empty-config-file/main.yaml'
|
||||
|
||||
def test_empty_config_file(self):
|
||||
# Tests that a config file with only comments does not cause
|
||||
# an error.
|
||||
tenant = self.scheds.first.sched.abide.tenants.get('tenant-one')
|
||||
self.assertEquals(
|
||||
len(tenant.layout.loading_errors), 0,
|
||||
"No error should have been accumulated")
|
||||
|
||||
|
||||
class TestInRepoConfig(ZuulTestCase):
|
||||
# A temporary class to hold new tests while others are disabled
|
||||
|
||||
|
|
|
@ -7694,6 +7694,10 @@ class UnparsedConfig(object):
|
|||
return r
|
||||
|
||||
def extend(self, conf):
|
||||
# conf might be None in the case of a file with only comments.
|
||||
if conf is None:
|
||||
return
|
||||
|
||||
if isinstance(conf, UnparsedConfig):
|
||||
self.pragmas.extend(conf.pragmas)
|
||||
self.pipelines.extend(conf.pipelines)
|
||||
|
|
Loading…
Reference in New Issue