Skip to content
This repository was archived by the owner on May 14, 2025. It is now read-only.

Commit e13850d

Browse files
oodamienghillert
authored andcommitted
Stream deploy: skipper - update stream do not submit a property without change
Resolves #786
1 parent d8880d0 commit e13850d

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

ui/src/app/streams/stream-deploy/stream-deploy.component.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,13 @@ export class StreamDeployComponent implements OnInit, OnDestroy {
102102
(config: any, deploymentInfo: StreamDefinition) => {
103103
const properties = [];
104104
const ignoreProperties = [];
105+
const cleanValue = (v) => (v && v.length > 1 && v.startsWith('"') && v.endsWith('"'))
106+
? v.substring(1, v.length - 1) : v;
105107

106108
// Deployer properties
107109
Object.keys(deploymentInfo.deploymentProperties).map(app => {
108110
Object.keys(deploymentInfo.deploymentProperties[app]).forEach((key: string) => {
109-
const value = deploymentInfo.deploymentProperties[app][key];
111+
const value = cleanValue(deploymentInfo.deploymentProperties[app][key]);
110112
if (key === StreamDeployService.version.keyEdit) {
111113
properties.push(`version.${app}=${value}`);
112114
} else if (key.startsWith(StreamDeployService.deployer.keyEdit)) {
@@ -129,6 +131,7 @@ export class StreamDeployComponent implements OnInit, OnDestroy {
129131
const appType = node['name'];
130132
if (node['options']) {
131133
node.options.forEach((value, key) => {
134+
value = cleanValue(value);
132135
let keyShort = key;
133136
if (key.startsWith(`${appType}.`)) {
134137
keyShort = key.substring(`${appType}.`.length, key.length);
@@ -139,8 +142,9 @@ export class StreamDeployComponent implements OnInit, OnDestroy {
139142
}
140143
});
141144
this.properties = properties;
142-
if (!config.skipper) {
143-
this.ignoreProperties = ignoreProperties;
145+
this.ignoreProperties = ignoreProperties;
146+
if (config.skipper) {
147+
this.ignoreProperties = Object.assign([], this.properties);
144148
}
145149
config.streamDefinition = deploymentInfo;
146150
return config;
@@ -189,6 +193,8 @@ export class StreamDeployComponent implements OnInit, OnDestroy {
189193
runDeploy(value: Array<string>) {
190194
this.update(value);
191195
const propertiesMap = {};
196+
const cleanValue = (v) => (v && v.length > 1 && v.startsWith('"') && v.endsWith('"'))
197+
? v.substring(1, v.length - 1) : v;
192198
value.forEach((val) => {
193199
if (this.ignoreProperties.indexOf(val) === -1) {
194200
const arr = val.split(/=(.*)/);
@@ -199,7 +205,7 @@ export class StreamDeployComponent implements OnInit, OnDestroy {
199205
if (arr[1] === `'******'`) {
200206
console.log(`Sensitive property ${arr[0]} is ignored`);
201207
} else {
202-
propertiesMap[arr[0]] = arr[1];
208+
propertiesMap[arr[0]] = cleanValue(arr[1]);
203209
}
204210
}
205211
}

0 commit comments

Comments
 (0)