def test(self, mock_srv, mock_get_clusternames_from_deploy_stanza): service_stanza = {"foo": "bar"} smartstack_stanza = {"stack": "smrt"} monitoring_stanza = {"team": "homer"} deploy_stanza = {"otto": "dude"} marathon_stanza = {"springfield": "2015-04-20"} clusternames = set([ "flanders", "van-houten", "wiggum", ]) mock_get_clusternames_from_deploy_stanza.return_value = clusternames fsm.write_paasta_config( mock_srv, service_stanza, smartstack_stanza, monitoring_stanza, deploy_stanza, marathon_stanza, ) mock_srv.io.write_file.assert_any_call( "smartstack.yaml", _yamlize(smartstack_stanza), ) mock_srv.io.write_file.assert_any_call( "service.yaml", _yamlize(service_stanza), ) mock_srv.io.write_file.assert_any_call( "monitoring.yaml", _yamlize(monitoring_stanza), ) mock_srv.io.write_file.assert_any_call( "deploy.yaml", _yamlize(deploy_stanza), ) mock_srv.io.write_file.assert_any_call( "marathon-SHARED.yaml", _yamlize(marathon_stanza), ) for clustername in clusternames: mock_srv.io.symlink_file_relative.assert_any_call( "marathon-SHARED.yaml", "marathon-%s.yaml" % clustername, )
def write_paasta_config( srv, service_stanza, smartstack_stanza, monitoring_stanza, deploy_stanza, marathon_stanza, ): srv.io.write_file("service.yaml", _yamlize(service_stanza)) srv.io.write_file("smartstack.yaml", _yamlize(smartstack_stanza)) srv.io.write_file("monitoring.yaml", _yamlize(monitoring_stanza)) srv.io.write_file("deploy.yaml", _yamlize(deploy_stanza)) srv.io.write_file("marathon-SHARED.yaml", _yamlize(marathon_stanza)) for clustername in get_clusternames_from_deploy_stanza(deploy_stanza): srv.io.symlink_file_relative("marathon-SHARED.yaml", "marathon-%s.yaml" % clustername)