From 80b9671b14ebf50a23bd2bb3e4ea7e813a4f072d Mon Sep 17 00:00:00 2001 From: Samuel Padgett Date: Tue, 17 Oct 2017 09:22:01 -0400 Subject: [PATCH] Bug 1502914 - Compact empty envFrom entries Don't include empty `envFrom` entries when updating environment variables. This causes a validation failure. Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1502914 --- app/scripts/services/environment.js | 3 +++ dist/scripts/scripts.js | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/scripts/services/environment.js b/app/scripts/services/environment.js index ddcc534a6b..a5b5a8cb1c 100644 --- a/app/scripts/services/environment.js +++ b/app/scripts/services/environment.js @@ -31,6 +31,9 @@ angular.module("openshiftConsole") var containers = getContainers(object); _.each(containers, function(container) { container.env = keyValueEditorUtils.compactEntries(container.env); + container.envFrom = _.reject(container.envFrom, function(envFromEntry) { + return !_.get(envFromEntry, 'configMapRef.name') && !_.get(envFromEntry, 'secretRef.name'); + }); }); }, diff --git a/dist/scripts/scripts.js b/dist/scripts/scripts.js index 334b1fff62..382f5c0652 100644 --- a/dist/scripts/scripts.js +++ b/dist/scripts/scripts.js @@ -3953,7 +3953,9 @@ e.env = e.env || [], e.envFrom = e.envFrom || []; compact: function(e) { var a = n(e); _.each(a, function(e) { -e.env = t.compactEntries(e.env); +e.env = t.compactEntries(e.env), e.envFrom = _.reject(e.envFrom, function(e) { +return !_.get(e, "configMapRef.name") && !_.get(e, "secretRef.name"); +}); }); }, copyAndNormalize: function(e) {