> On Июнь 9, 2016, 4:26 п.п., Sebastian Toader wrote: > > ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java, > > line 343 > > <https://reviews.apache.org/r/48494/diff/1/?file=1412628#file1412628line343> > > > > Maybe we should think here a generic solution as in the future there > > might be new custom 'trimming' cases to handle. I thinking something like > > factoring out the various 'trimming strategies' into separate methods. > > Factor out into methods the logic that indetifies what the type properties > > and map what trimming strategy to be used for a property.
Yes. We can do that. The important point here is to have it in line with UI implementation. - Dmytro ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/48494/#review136832 ----------------------------------------------------------- On Июнь 9, 2016, 3:23 п.п., Dmytro Sen wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/48494/ > ----------------------------------------------------------- > > (Updated Июнь 9, 2016, 3:23 п.п.) > > > Review request for Ambari, Robert Nettleton, Sebastian Toader, and Vitalyi > Brodetskyi. > > > Bugs: AMBARI-17146 > https://issues.apache.org/jira/browse/AMBARI-17146 > > > Repository: ambari > > > Description > ------- > > Implement config values trimming for deployment via blueprint as we do in UI > > trimProperty: function (property) { > var displayType = Em.get(property, 'displayType'); > var value = Em.get(property, 'value'); > var name = Em.get(property, 'name'); > var rez; > switch (displayType) { > case 'directories': > case 'directory': > rez = value.replace(/,/g, ' ').trim().split(/\s+/g).join(','); > break; > case 'host': > rez = value.trim(); > break; > case 'password': > break; > default: > if (name == 'javax.jdo.option.ConnectionURL' || name == > 'oozie.service.JPAService.jdbc.url') { > rez = value.trim(); > } > rez = (typeof value == 'string') ? value.replace(/(\s+$)/g, '') : > value; > } > return ((rez == '') || (rez == undefined)) ? value : rez; > }, > > > Diffs > ----- > > > ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java > de70a2c > > ambari-server/src/main/java/org/apache/ambari/server/controller/internal/Stack.java > ad8d4f9 > > ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java > 9ec0a09 > > Diff: https://reviews.apache.org/r/48494/diff/ > > > Testing > ------- > > Unit tests and manual tests passed > > > Thanks, > > Dmytro Sen > >