Merge "Do not pass excessive configuration to shotgun"

This commit is contained in:
Jenkins 2016-06-23 07:54:50 +00:00 committed by Gerrit Code Review
commit b65685a1a7
2 changed files with 8 additions and 1 deletions

View File

@ -1889,6 +1889,12 @@ class DumpTask(object):
dump_conf['dump']['controller']['hosts'].append(host)
# save slaves
dump_conf['dump']['slave']['hosts'].append(host)
if 'controller' in dump_conf['dump'] and \
not dump_conf['dump']['controller']['hosts']:
del dump_conf['dump']['controller']
if 'slave' in dump_conf['dump'] and \
not dump_conf['dump']['slave']['hosts']:
del dump_conf['dump']['slave']
# render postgres connection data in dump settings
dump_conf['dump']['local']['objects'].append({

View File

@ -28,7 +28,8 @@ class TestSnapshotConf(base.TestCase):
conf = task.DumpTask.conf()
self.assertIn('local', conf['dump'])
self.assertIn('master', conf['dump'])
self.assertIn('slave', conf['dump'])
self.assertNotIn('slave', conf['dump'])
self.assertNotIn('controller', conf['dump'])
def test_local_host(self):
conf = task.DumpTask.conf()