Skip to content

Instantly share code, notes, and snippets.

@ilayaperumalg
Created April 4, 2017 08:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ilayaperumalg/ef37276e39410bb47a2ba75e2cf9ab58 to your computer and use it in GitHub Desktop.
Save ilayaperumalg/ef37276e39410bb47a2ba75e2cf9ab58 to your computer and use it in GitHub Desktop.
Check for invalid lines (newline, commented entries) from deployment properties file
diff --git a/ui/app/scripts/stream/controllers/definition-deploy.js b/ui/app/scripts/stream/controllers/definition-deploy.js
index 02cace4..416d6fd 100644
--- a/ui/app/scripts/stream/controllers/definition-deploy.js
+++ b/ui/app/scripts/stream/controllers/definition-deploy.js
@@ -64,15 +64,17 @@ define([], function () {
if (properties) {
propertiesAsMap = {};
for (let prop of properties) {
- var keyValue = prop.split('=');
- if (keyValue.length===2) {
- propertiesAsMap[keyValue[0]] = keyValue[1];
- }
- else {
- utils.$log.warn('Invalid deployment property "' + prop +'" must contain a single "=".');
- $scope.deployDefinitionForm.deploymentProperties.$setValidity('invalidDeploymentProperties', false);
- return;
- }
+ if (prop && prop.length > 0 && !prop.startsWith('#')) {
+ var keyValue = prop.split('=');
+ if (keyValue.length===2) {
+ propertiesAsMap[keyValue[0]] = keyValue[1];
+ }
+ else {
+ utils.$log.warn('Invalid deployment property "' + prop +'" must contain a single "=".');
+ $scope.deployDefinitionForm.deploymentProperties.$setValidity('invalidDeploymentProperties', false);
+ return;
+ }
+ }
}
}
$scope.deployDefinitionForm.deploymentProperties.$setValidity('invalidDeploymentProperties', true);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment