From b63f3f7b1f50397b9af6f4a724941f45992fe060 Mon Sep 17 00:00:00 2001 From: "nicolas.dorier" Date: Mon, 16 Jul 2018 16:09:26 +0900 Subject: [PATCH] Ignore yaml nodes without main node --- docker-compose-generator/src/DockerComposeDefinition.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docker-compose-generator/src/DockerComposeDefinition.cs b/docker-compose-generator/src/DockerComposeDefinition.cs index 5fbdef8..def8cf9 100644 --- a/docker-compose-generator/src/DockerComposeDefinition.cs +++ b/docker-compose-generator/src/DockerComposeDefinition.cs @@ -80,8 +80,9 @@ namespace DockerGenerator .GroupBy(s => s.Key.ToString(), s => s.Value) .Select(group => (GroupName: group.Key, - MainNode: group.OfType().Single(n => n.Children.ContainsKey("image")), + MainNode: group.OfType().SingleOrDefault(n => n.Children.ContainsKey("image")), MergedNodes: group.OfType().Where(n => !n.Children.ContainsKey("image")))) + .Where(_ => _.MainNode != null) .Select(_ => { foreach(var node in _.MergedNodes)