[knox] branch v1.4.0 updated: KNOX-2347 - Disable shellcheck for github actions (#317)

2020-04-21 Thread krisden
This is an automated email from the ASF dual-hosted git repository.

krisden pushed a commit to branch v1.4.0
in repository https://gitbox.apache.org/repos/asf/knox.git


The following commit(s) were added to refs/heads/v1.4.0 by this push:
 new 9634a3e  KNOX-2347 - Disable shellcheck for github actions (#317)
9634a3e is described below

commit 9634a3ed4ab06f2aaf7bb2acbc2ea721717efbc4
Author: Kevin Risden 
AuthorDate: Mon Apr 20 12:29:04 2020 -0400

KNOX-2347 - Disable shellcheck for github actions (#317)

Signed-off-by: Kevin Risden 
---
 .github/workflows/main.yml | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 9521bd5..93074dc 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -41,8 +41,9 @@ jobs:
   java-version: ${{ matrix.java }}
   - name: 'Build and Test'
 run: mvn -T.75C clean verify -U -Dsurefire.useFile=false 
-Djavax.net.ssl.trustStorePassword=changeit -B -V
-  - name: shellcheck
-uses: reviewdog/action-shellcheck@v1
-with:
-  pattern: "*release*/home/bin/*.sh"
+# This is failing due to not finding files? - See KNOX-2347
+#  - name: shellcheck
+#uses: reviewdog/action-shellcheck@v1
+#with:
+#  pattern: "*release*/home/bin/*.sh"
 



[knox] branch master updated: KNOX-2350 - Handling event types w/o COMMAND and/or COMMAND_STATUS attributes when polling CM events (#318)

2020-04-21 Thread smolnar
This is an automated email from the ASF dual-hosted git repository.

smolnar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/knox.git


The following commit(s) were added to refs/heads/master by this push:
 new 5bc3cc5  KNOX-2350 - Handling event types w/o COMMAND and/or 
COMMAND_STATUS attributes when polling CM events (#318)
5bc3cc5 is described below

commit 5bc3cc5c438364218566a7b66ec9830a01501b05
Author: Sandor Molnar 
AuthorDate: Tue Apr 21 16:14:59 2020 +0200

KNOX-2350 - Handling event types w/o COMMAND and/or COMMAND_STATUS 
attributes when polling CM events (#318)
---
 .../cm/monitor/PollingConfigurationAnalyzer.java   | 23 +-
 .../monitor/PollingConfigurationAnalyzerTest.java  | 10 ++
 2 files changed, 19 insertions(+), 14 deletions(-)

diff --git 
a/gateway-discovery-cm/src/main/java/org/apache/knox/gateway/topology/discovery/cm/monitor/PollingConfigurationAnalyzer.java
 
b/gateway-discovery-cm/src/main/java/org/apache/knox/gateway/topology/discovery/cm/monitor/PollingConfigurationAnalyzer.java
index 380962a..fb8d73c 100644
--- 
a/gateway-discovery-cm/src/main/java/org/apache/knox/gateway/topology/discovery/cm/monitor/PollingConfigurationAnalyzer.java
+++ 
b/gateway-discovery-cm/src/main/java/org/apache/knox/gateway/topology/discovery/cm/monitor/PollingConfigurationAnalyzer.java
@@ -48,12 +48,14 @@ import java.io.IOException;
 import java.time.Instant;
 import java.time.temporal.ChronoUnit;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
+import java.util.stream.Collectors;
 
 import static 
org.apache.knox.gateway.topology.discovery.ClusterConfigurationMonitor.ConfigurationChangeListener;
 
@@ -385,24 +387,17 @@ public class PollingConfigurationAnalyzer implements 
Runnable {
 
   @SuppressWarnings("unchecked")
   private boolean isRelevantEvent(ApiEvent event) {
-boolean rc = false;
-String command = null;
-String status = null;
-List attributes = event.getAttributes();
-Map map = getAttributeMap(attributes);
-command = (String) ((List) map.get(COMMAND)).get(0);
-status = (String) ((List) map.get(COMMAND_STATUS)).get(0);
-if (START_COMMAND.equals(command) || RESTART_COMMAND.equals(command) &&
-SUCCEEDED_STATUS.equals(status) || STARTED_STATUS.equals(status)) {
-  rc = true;
+final Map attributeMap = 
getAttributeMap(event.getAttributes());
+final String command = attributeMap.containsKey(COMMAND) ? (String) 
((List) attributeMap.get(COMMAND)).get(0) : "";
+final String status = attributeMap.containsKey(COMMAND_STATUS) ? (String) 
((List) attributeMap.get(COMMAND_STATUS)).get(0) : "";
+if ((START_COMMAND.equals(command) || RESTART_COMMAND.equals(command)) && 
(SUCCEEDED_STATUS.equals(status) || STARTED_STATUS.equals(status))) {
+  return true;
 }
-return rc;
+return false;
   }
 
   private Map getAttributeMap(List 
attributes) {
-Map map = new HashMap<>();
-attributes.forEach(attr -> { map.put(attr.getName(), attr.getValues());});
-return map;
+return attributes == null ? Collections.emptyMap() : 
attributes.stream().collect(Collectors.toMap(ApiEventAttribute::getName, 
ApiEventAttribute::getValues));
   }
 
   /**
diff --git 
a/gateway-discovery-cm/src/test/java/org/apache/knox/gateway/topology/discovery/cm/monitor/PollingConfigurationAnalyzerTest.java
 
b/gateway-discovery-cm/src/test/java/org/apache/knox/gateway/topology/discovery/cm/monitor/PollingConfigurationAnalyzerTest.java
index cb2066e..49e339c 100644
--- 
a/gateway-discovery-cm/src/test/java/org/apache/knox/gateway/topology/discovery/cm/monitor/PollingConfigurationAnalyzerTest.java
+++ 
b/gateway-discovery-cm/src/test/java/org/apache/knox/gateway/topology/discovery/cm/monitor/PollingConfigurationAnalyzerTest.java
@@ -172,6 +172,16 @@ public class PollingConfigurationAnalyzerTest {
 ApiEvent failedStartEvent = createApiEvent(ApiEventCategory.AUDIT_EVENT, 
startEventAttrs);
 pca.addRestartEvent(clusterName, failedStartEvent);
 
+// Simulate an event w/o COMMAND and/or COMMAND_STATUS attributes
+final List revisionEventAttrs = new ArrayList<>();
+revisionEventAttrs.add(createEventAttribute("CLUSTER", clusterName));
+revisionEventAttrs.add(createEventAttribute("SERVICE_TYPE", 
HiveOnTezServiceModelGenerator.SERVICE_TYPE));
+revisionEventAttrs.add(createEventAttribute("SERVICE", 
HiveOnTezServiceModelGenerator.SERVICE));
+revisionEventAttrs.add(createEventAttribute("REVISION", "215"));
+revisionEventAttrs.add(createEventAttribute("EVENTCODE", 
"EV_REVISION_CREATED"));
+final ApiEvent revisionEvent = 
createApiEvent(ApiEventCategory.AUDIT_EVENT, revisionEventAttrs);
+pca.addRestartEvent(clusterName, revisionEvent);
+
 try {
   pollingThreadExecuto

[knox] branch master updated: KNOX-2346 - Remove unused maxRetryAttempts and retrySleep (#316)

2020-04-21 Thread krisden
This is an automated email from the ASF dual-hosted git repository.

krisden pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/knox.git


The following commit(s) were added to refs/heads/master by this push:
 new 4c00380  KNOX-2346 - Remove unused maxRetryAttempts and retrySleep 
(#316)
4c00380 is described below

commit 4c003804c4c3821cb42df6c2f78505556be16b2f
Author: Kevin Risden 
AuthorDate: Tue Apr 21 10:06:23 2020 -0400

KNOX-2346 - Remove unused maxRetryAttempts and retrySleep (#316)

Signed-off-by: Kevin Risden 
---
 .../provider-config-wizard/ha-provider-config.ts   |  2 -
 .../ha/deploy/HaProviderDeploymentContributor.java | 10 
 .../knox/gateway/ha/provider/HaServiceConfig.java  |  8 
 .../ha/provider/impl/DefaultHaServiceConfig.java   | 25 --
 .../ha/provider/impl/HaDescriptorConstants.java|  4 --
 .../ha/provider/impl/HaDescriptorFactory.java  | 17 +--
 .../ha/provider/impl/HaDescriptorManager.java  |  4 --
 .../ha/provider/impl/HaServiceConfigConstants.java |  8 
 .../HaProviderDeploymentContributorTest.java   | 54 +-
 .../gateway/ha/dispatch/DefaultHaDispatchTest.java |  4 +-
 .../ha/provider/impl/HaDescriptorFactoryTest.java  |  8 +---
 .../ha/provider/impl/HaDescriptorManagerTest.java  | 18 +++-
 .../simple/ProviderConfigurationParserTest.java|  6 +--
 .../simple/SimpleDescriptorHandlerTest.java|  8 ++--
 .../knox/gateway/rm/dispatch/RMHaDispatchTest.java |  6 +--
 .../knox/gateway/hdfs/i18n/WebHdfsMessages.java| 10 
 .../hdfs/dispatch/WebHdfsHaDispatchTest.java   |  4 +-
 .../org/apache/knox/gateway/PortMappingHelper.java |  2 +-
 .../org/apache/knox/gateway/WebHdfsHaFuncTest.java |  2 +-
 19 files changed, 39 insertions(+), 161 deletions(-)

diff --git 
a/gateway-admin-ui/admin-ui/app/provider-config-wizard/ha-provider-config.ts 
b/gateway-admin-ui/admin-ui/app/provider-config-wizard/ha-provider-config.ts
index b39b227..30b1e05 100644
--- a/gateway-admin-ui/admin-ui/app/provider-config-wizard/ha-provider-config.ts
+++ b/gateway-admin-ui/admin-ui/app/provider-config-wizard/ha-provider-config.ts
@@ -45,8 +45,6 @@ export class HaProviderConfig extends 
DisplayBindingProviderConfig {
 [HaProviderConfig.SERVICE_NAME, 'serviceName'],
 [HaProviderConfig.MAX_FAILOVER_ATTEMPTS, 'maxFailoverAttempts'],
 [HaProviderConfig.FAILOVER_SLEEP, 'failoverSleep'],
-[HaProviderConfig.MAX_RETRY_ATTEMPTS, 'maxRetryAttempts'],
-[HaProviderConfig.RETRY_SLEEP, 'retrySleep'],
 [HaProviderConfig.ZK_ENSEMBLE, 'zookeeperEnsemble'],
 [HaProviderConfig.ZK_NAMESPACE, 'zookeeperNamespace']
 ] as [string, string][]);
diff --git 
a/gateway-provider-ha/src/main/java/org/apache/knox/gateway/ha/deploy/HaProviderDeploymentContributor.java
 
b/gateway-provider-ha/src/main/java/org/apache/knox/gateway/ha/deploy/HaProviderDeploymentContributor.java
index c906e10..ede0a17 100644
--- 
a/gateway-provider-ha/src/main/java/org/apache/knox/gateway/ha/deploy/HaProviderDeploymentContributor.java
+++ 
b/gateway-provider-ha/src/main/java/org/apache/knox/gateway/ha/deploy/HaProviderDeploymentContributor.java
@@ -123,16 +123,6 @@ public class HaProviderDeploymentContributor extends 
ProviderDeploymentContribut
 config.setMaxFailoverAttempts(Integer.parseInt(failOverAttempts));
  }
 
- String retrySleep = 
serviceLevelParams.get(HaServiceConfigConstants.CONFIG_PARAM_RETRY_SLEEP);
- if (retrySleep != null) {
-config.setRetrySleep(Integer.parseInt(retrySleep));
- }
-
- String retryAttempts = 
serviceLevelParams.get(HaServiceConfigConstants.CONFIG_PARAM_MAX_RETRY_ATTEMPTS);
- if (retryAttempts != null) {
-config.setMaxRetryAttempts(Integer.parseInt(retryAttempts));
- }
-
  String zkEnsemble = 
serviceLevelParams.get(HaServiceConfigConstants.CONFIG_PARAM_ZOOKEEPER_ENSEMBLE);
  if (zkEnsemble != null) {
 config.setZookeeperEnsemble(zkEnsemble);
diff --git 
a/gateway-provider-ha/src/main/java/org/apache/knox/gateway/ha/provider/HaServiceConfig.java
 
b/gateway-provider-ha/src/main/java/org/apache/knox/gateway/ha/provider/HaServiceConfig.java
index 8daa2d6..dacb8c6 100644
--- 
a/gateway-provider-ha/src/main/java/org/apache/knox/gateway/ha/provider/HaServiceConfig.java
+++ 
b/gateway-provider-ha/src/main/java/org/apache/knox/gateway/ha/provider/HaServiceConfig.java
@@ -34,14 +34,6 @@ public interface HaServiceConfig {
 
   int getFailoverSleep();
 
-  void setMaxRetryAttempts(int limit);
-
-  int getMaxRetryAttempts();
-
-  void setRetrySleep(int sleep);
-
-  int getRetrySleep();
-
   String getZookeeperEnsemble();
 
   void setZookeeperEnsemble(String zookeeperEnsemble);
diff --git 
a/gateway-provider-ha/src/main/java/org/apache/knox/gateway/ha/provider/impl/DefaultHaServiceConfig.java
 
b/gateway-provider-h