Repository: ambari Updated Branches: refs/heads/trunk 112885bef -> d9c300bc1
AMBARI-21579 Ooozie quicklink configuration does not work with https (benyoka) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/d9c300bc Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/d9c300bc Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/d9c300bc Branch: refs/heads/trunk Commit: d9c300bc1989ca42d38a01dff1e2c0a8be206ae0 Parents: 112885b Author: Balazs Bence Sari <beny...@apache.org> Authored: Fri Jul 28 14:38:29 2017 +0200 Committer: Balazs Bence Sari <beny...@apache.org> Committed: Fri Jul 28 14:38:29 2017 +0200 ---------------------------------------------------------------------- .../ambari/server/state/quicklinks/Port.java | 15 ++++++ .../OOZIE/4.2.0.2.3/quicklinks/quicklinks.json | 9 ++-- .../OOZIE/4.2.0.3.0/quicklinks/quicklinks.json | 9 ++-- .../services/OOZIE/quicklinks/quicklinks.json | 9 ++-- .../services/OOZIE/quicklinks/quicklinks.json | 9 ++-- .../QuickLinksConfigurationModuleTest.java | 14 ++++++ .../src/test/resources/parent_quicklinks.json | 1 + .../app/views/common/quick_view_link_view.js | 6 +++ .../test/views/common/quick_link_view_test.js | 50 ++++++++++++++++++++ 9 files changed, 106 insertions(+), 16 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/d9c300bc/ambari-server/src/main/java/org/apache/ambari/server/state/quicklinks/Port.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/quicklinks/Port.java b/ambari-server/src/main/java/org/apache/ambari/server/state/quicklinks/Port.java index 7bd4b81..fa35ab9 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/state/quicklinks/Port.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/state/quicklinks/Port.java @@ -40,6 +40,10 @@ public class Port{ @JsonProperty("regex") private String regex; + @JsonProperty("https_regex") + private String httpsRegex; + + @JsonProperty("site") private String site; @@ -83,6 +87,14 @@ public class Port{ this.regex = regex; } + public String getHttpsRegex() { + return httpsRegex; + } + + public void setHttpsRegex(String httpsRegex) { + this.httpsRegex = httpsRegex; + } + public String getSite() { return site; } @@ -110,6 +122,9 @@ public class Port{ if(null == regex && null != parentPort.getRegex()) regex = parentPort.getRegex(); + if(null == httpsRegex && null != parentPort.getHttpsRegex()) + regex = parentPort.getHttpsRegex(); + if(null == site && null != parentPort.getSite()) site = parentPort.getSite(); } http://git-wip-us.apache.org/repos/asf/ambari/blob/d9c300bc/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.2.3/quicklinks/quicklinks.json ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.2.3/quicklinks/quicklinks.json b/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.2.3/quicklinks/quicklinks.json index 6353220..f15ddd7 100644 --- a/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.2.3/quicklinks/quicklinks.json +++ b/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.2.3/quicklinks/quicklinks.json @@ -8,17 +8,17 @@ "checks":[ { "property":"oozie.https.port", - "desired":"EXISTS", + "desired":"EXIST", "site":"oozie-site" }, { "property":"oozie.https.keystore.file", - "desired":"EXISTS", + "desired":"EXIST", "site":"oozie-site" }, { "property":"oozie.https.keystore.pass", - "desired":"EXISTS", + "desired":"EXIST", "site":"oozie-site" } ] @@ -34,9 +34,10 @@ "port":{ "http_property": "oozie.base.url", "http_default_port": "11000", - "https_property": "oozie.base.url", + "https_property": "oozie.https.port", "https_default_port": "11443", "regex": "\\w*:(\\d+)", + "https_regex": "(\\d+)", "site": "oozie-site" } } http://git-wip-us.apache.org/repos/asf/ambari/blob/d9c300bc/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/quicklinks/quicklinks.json ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/quicklinks/quicklinks.json b/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/quicklinks/quicklinks.json index 81e7cbe..43cf641 100644 --- a/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/quicklinks/quicklinks.json +++ b/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/quicklinks/quicklinks.json @@ -8,17 +8,17 @@ "checks":[ { "property":"oozie.https.port", - "desired":"EXISTS", + "desired":"EXIST", "site":"oozie-site" }, { "property":"oozie.https.keystore.file", - "desired":"EXISTS", + "desired":"EXIST", "site":"oozie-site" }, { "property":"oozie.https.keystore.pass", - "desired":"EXISTS", + "desired":"EXIST", "site":"oozie-site" } ] @@ -34,9 +34,10 @@ "port":{ "http_property": "oozie.base.url", "http_default_port": "11000", - "https_property": "oozie.base.url", + "https_property": "oozie.https.port", "https_default_port": "11443", "regex": "\\w*:(\\d+)", + "https_regex": "(\\d+)", "site": "oozie-site" } } http://git-wip-us.apache.org/repos/asf/ambari/blob/d9c300bc/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/OOZIE/quicklinks/quicklinks.json ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/OOZIE/quicklinks/quicklinks.json b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/OOZIE/quicklinks/quicklinks.json index f83bb5c..5ab7ec8 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/OOZIE/quicklinks/quicklinks.json +++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/OOZIE/quicklinks/quicklinks.json @@ -8,17 +8,17 @@ "checks":[ { "property":"oozie.https.port", - "desired":"EXISTS", + "desired":"EXIST", "site":"oozie-site" }, { "property":"oozie.https.keystore.file", - "desired":"EXISTS", + "desired":"EXIST", "site":"oozie-site" }, { "property":"oozie.https.keystore.pass", - "desired":"EXISTS", + "desired":"EXIST", "site":"oozie-site" } ] @@ -34,9 +34,10 @@ "port":{ "http_property": "oozie.base.url", "http_default_port": "11000", - "https_property": "oozie.base.url", + "https_property": "oozie.https.port", "https_default_port": "11443", "regex": "\\w*:(\\d+)", + "https_regex": "(\\d+)", "site": "oozie-site" } } http://git-wip-us.apache.org/repos/asf/ambari/blob/d9c300bc/ambari-server/src/main/resources/stacks/HDP/2.3/services/OOZIE/quicklinks/quicklinks.json ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/services/OOZIE/quicklinks/quicklinks.json b/ambari-server/src/main/resources/stacks/HDP/2.3/services/OOZIE/quicklinks/quicklinks.json index 81e7cbe..43cf641 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.3/services/OOZIE/quicklinks/quicklinks.json +++ b/ambari-server/src/main/resources/stacks/HDP/2.3/services/OOZIE/quicklinks/quicklinks.json @@ -8,17 +8,17 @@ "checks":[ { "property":"oozie.https.port", - "desired":"EXISTS", + "desired":"EXIST", "site":"oozie-site" }, { "property":"oozie.https.keystore.file", - "desired":"EXISTS", + "desired":"EXIST", "site":"oozie-site" }, { "property":"oozie.https.keystore.pass", - "desired":"EXISTS", + "desired":"EXIST", "site":"oozie-site" } ] @@ -34,9 +34,10 @@ "port":{ "http_property": "oozie.base.url", "http_default_port": "11000", - "https_property": "oozie.base.url", + "https_property": "oozie.https.port", "https_default_port": "11443", "regex": "\\w*:(\\d+)", + "https_regex": "(\\d+)", "site": "oozie-site" } } http://git-wip-us.apache.org/repos/asf/ambari/blob/d9c300bc/ambari-server/src/test/java/org/apache/ambari/server/stack/QuickLinksConfigurationModuleTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/stack/QuickLinksConfigurationModuleTest.java b/ambari-server/src/test/java/org/apache/ambari/server/stack/QuickLinksConfigurationModuleTest.java index e37eaf0..aac278d 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/stack/QuickLinksConfigurationModuleTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/stack/QuickLinksConfigurationModuleTest.java @@ -24,9 +24,11 @@ import static org.junit.Assert.assertTrue; import java.io.File; import java.util.ArrayList; +import java.util.Collection; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.NoSuchElementException; import java.util.Set; import org.apache.ambari.server.AmbariException; @@ -89,6 +91,18 @@ public class QuickLinksConfigurationModuleTest { assertNotNull(links); assertEquals(7, links.size()); assertEquals(4, parentQuickLinks.getQuickLinksConfiguration().getLinks().size()); + Link threadStacks = getLink(links, "thread_stacks"); + assertNotNull("https_regex property should have been inherited", + threadStacks.getPort().getHttpsRegex()); + } + + private Link getLink(Collection<Link> links, String name) { + for (Link link: links) { + if (name.equals(link.getName())) { + return link; + } + } + throw new NoSuchElementException("name"); } @Test http://git-wip-us.apache.org/repos/asf/ambari/blob/d9c300bc/ambari-server/src/test/resources/parent_quicklinks.json ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/resources/parent_quicklinks.json b/ambari-server/src/test/resources/parent_quicklinks.json index 0aca8e3..da51d86 100644 --- a/ambari-server/src/test/resources/parent_quicklinks.json +++ b/ambari-server/src/test/resources/parent_quicklinks.json @@ -68,6 +68,7 @@ "https_property": "yarn.resourcemanager.webapp.https.address", "https_default_port": "8090", "regex": "\\w*:(\\d+)", + "https_regex": "\\w*:(\\d+)", "site": "yarn-site" } } http://git-wip-us.apache.org/repos/asf/ambari/blob/d9c300bc/ambari-web/app/views/common/quick_view_link_view.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views/common/quick_view_link_view.js b/ambari-web/app/views/common/quick_view_link_view.js index e39f230..5888acb 100644 --- a/ambari-web/app/views/common/quick_view_link_view.js +++ b/ambari-web/app/views/common/quick_view_link_view.js @@ -797,6 +797,12 @@ App.QuickLinksView = Em.View.extend({ } var regexValue = Em.get(portConfigs, 'regex'); + if (protocol === 'https') { + var httpsRegex = Em.get(portConfigs, 'https_regex'); + if (httpsRegex) { + regexValue = httpsRegex; + } + } regexValue = regexValue.trim(); if (regexValue) { var re = new RegExp(regexValue); http://git-wip-us.apache.org/repos/asf/ambari/blob/d9c300bc/ambari-web/test/views/common/quick_link_view_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/views/common/quick_link_view_test.js b/ambari-web/test/views/common/quick_link_view_test.js index 48cdb28..1998a9c 100644 --- a/ambari-web/test/views/common/quick_link_view_test.js +++ b/ambari-web/test/views/common/quick_link_view_test.js @@ -863,6 +863,56 @@ describe('App.QuickViewLinks', function () { } ], 'result': '8090' + }), + + Em.Object.create({ + 'protocol': 'https', + 'port':{ + 'http_property':'oozie.base.url', + 'http_default_port':'11000', + 'https_property':'oozie.https.port', + 'https_default_port':'11443', + 'regex': '\\w*:(\\d+)', + 'https_regex': '(\\d+)', + 'site':'oozie-site' + }, + 'configProperties': + [ + { + 'type': 'oozie-site', + 'properties': + { + 'oozie.base.url': 'c6401.ambari.apache.org:11000/oozie', + 'oozie.https.port' : '11444' + } + } + ], + 'result': '11444' + }), + + Em.Object.create({ + 'protocol': 'http', + 'port':{ + 'http_property':'oozie.base.url', + 'http_default_port':'11000', + 'https_property':'oozie.https.port', + 'https_default_port':'11443', + 'regex': '\\w*:(\\d+)', + 'https_regex': '(\\d+)', + 'site':'oozie-site' + }, + 'configProperties': + [ + { + 'type': 'oozie-site', + 'properties': + { + 'oozie.base.url': 'c6401.ambari.apache.org:11002/oozie', + 'oozie.https.port' : '11444' + } + } + ], + 'result': '11002' }) ];