ambari git commit: AMBARI-22298. Refresh config tags at RECONFIGURE command without explicitly setting forceRefreshConfigTags in request (magyari_sandor)
Repository: ambari Updated Branches: refs/heads/trunk 0041ab254 -> 9d6ac96b5 AMBARI-22298. Refresh config tags at RECONFIGURE command without explicitly setting forceRefreshConfigTags in request (magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/9d6ac96b Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/9d6ac96b Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/9d6ac96b Branch: refs/heads/trunk Commit: 9d6ac96b5abf157ee813c6c6193650ac61a1590c Parents: 0041ab2 Author: Sandor Magyari Authored: Fri Oct 20 10:19:55 2017 +0200 Committer: Sandor Magyari Committed: Mon Oct 30 15:08:54 2017 +0100 -- ambari-agent/src/main/python/ambari_agent/ActionQueue.py| 5 - .../server/controller/AmbariCustomCommandExecutionHelper.java | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/9d6ac96b/ambari-agent/src/main/python/ambari_agent/ActionQueue.py -- diff --git a/ambari-agent/src/main/python/ambari_agent/ActionQueue.py b/ambari-agent/src/main/python/ambari_agent/ActionQueue.py index 1eda5c2..f1b3a42 100644 --- a/ambari-agent/src/main/python/ambari_agent/ActionQueue.py +++ b/ambari-agent/src/main/python/ambari_agent/ActionQueue.py @@ -67,6 +67,7 @@ class ActionQueue(threading.Thread): ROLE_COMMAND_STOP = 'STOP' ROLE_COMMAND_CUSTOM_COMMAND = 'CUSTOM_COMMAND' CUSTOM_COMMAND_RESTART = 'RESTART' + CUSTOM_COMMAND_RECONFIGURE = 'RECONFIGURE' CUSTOM_COMMAND_START = ROLE_COMMAND_START IN_PROGRESS_STATUS = 'IN_PROGRESS' @@ -427,7 +428,9 @@ class ActionQueue(threading.Thread): (command['roleCommand'] == self.ROLE_COMMAND_INSTALL and component in LiveStatus.CLIENT_COMPONENTS) or (command['roleCommand'] == self.ROLE_COMMAND_CUSTOM_COMMAND and 'custom_command' in command['hostLevelParams'] and - command['hostLevelParams']['custom_command'] in (self.CUSTOM_COMMAND_RESTART, self.CUSTOM_COMMAND_START))): + command['hostLevelParams']['custom_command'] in (self.CUSTOM_COMMAND_RESTART, + self.CUSTOM_COMMAND_START, + self.CUSTOM_COMMAND_RECONFIGURE))): configHandler.write_actual_component(command['role'], command['configurationTags']) if 'clientsToUpdateConfigs' in command['hostLevelParams'] and command['hostLevelParams']['clientsToUpdateConfigs']: http://git-wip-us.apache.org/repos/asf/ambari/blob/9d6ac96b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java index 044e6ef..e8febbb 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java @@ -514,6 +514,7 @@ public class AmbariCustomCommandExecutionHelper { if (refreshConfigsCommand != null && !refreshConfigsCommand.equals(RefreshCommandConfiguration.REFRESH_CONFIGS)) { LOG.info("Refreshing configs for {}/{} with command: ", componentName, hostName, refreshConfigsCommand); commandParams.put("reconfigureAction", refreshConfigsCommand); + //execCmd.setForceRefreshConfigTagsBeforeExecution(true); } }
ambari git commit: AMBARI-22253. Add topology_configurations tabel to all sql scripts (magyari_sandor)
Repository: ambari Updated Branches: refs/heads/branch-feature-AMBARI-14714 b0f5639cb -> d8406d0be AMBARI-22253. Add topology_configurations tabel to all sql scripts (magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/d8406d0b Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/d8406d0b Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/d8406d0b Branch: refs/heads/branch-feature-AMBARI-14714 Commit: d8406d0be5f3c8e1c3aa3ebef762b107c51cff73 Parents: b0f5639 Author: Sandor Magyari Authored: Thu Oct 26 17:44:21 2017 +0200 Committer: Sandor Magyari Committed: Thu Oct 26 17:47:08 2017 +0200 -- .../internal/ClusterResourceProvider.java | 2 +- .../internal/ProvisionClusterRequest.java | 41 ++-- .../server/topology/PersistedStateImpl.java | 5 ++- .../main/resources/Ambari-DDL-Derby-CREATE.sql | 12 ++ .../main/resources/Ambari-DDL-MySQL-CREATE.sql | 12 ++ .../main/resources/Ambari-DDL-Oracle-CREATE.sql | 12 ++ .../resources/Ambari-DDL-Postgres-CREATE.sql| 2 +- .../resources/Ambari-DDL-SQLAnywhere-CREATE.sql | 12 ++ .../resources/Ambari-DDL-SQLServer-CREATE.sql | 12 ++ 9 files changed, 95 insertions(+), 15 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/d8406d0b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterResourceProvider.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterResourceProvider.java index 54c8360..ed80291 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterResourceProvider.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterResourceProvider.java @@ -202,7 +202,7 @@ public class ClusterResourceProvider extends AbstractControllerResourceProvider baseUnsupported.remove("blueprint"); baseUnsupported.remove("host_groups"); baseUnsupported.remove("default_password"); -baseUnsupported.remove("configurations"); +baseUnsupported.remove("services"); baseUnsupported.remove("credentials"); baseUnsupported.remove("config_recommendation_strategy"); baseUnsupported.remove("provision_action"); http://git-wip-us.apache.org/repos/asf/ambari/blob/d8406d0b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ProvisionClusterRequest.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ProvisionClusterRequest.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ProvisionClusterRequest.java index 0e1753b..f773fc8 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ProvisionClusterRequest.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ProvisionClusterRequest.java @@ -31,12 +31,16 @@ import org.apache.ambari.server.stack.NoSuchStackException; import org.apache.ambari.server.state.quicklinksprofile.QuickLinksProfileBuilder; import org.apache.ambari.server.state.quicklinksprofile.QuickLinksProfileEvaluationException; import org.apache.ambari.server.topology.ConfigRecommendationStrategy; +import org.apache.ambari.server.topology.Configuration; import org.apache.ambari.server.topology.ConfigurationFactory; import org.apache.ambari.server.topology.Credential; import org.apache.ambari.server.topology.HostGroupInfo; import org.apache.ambari.server.topology.InvalidTopologyTemplateException; import org.apache.ambari.server.topology.NoSuchBlueprintException; import org.apache.ambari.server.topology.SecurityConfiguration; +import org.apache.ambari.server.topology.Service; +import org.apache.ambari.server.topology.ServiceId; +import org.apache.commons.lang.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -124,6 +128,8 @@ public class ProvisionClusterRequest extends BaseClusterRequest { * The service and component level quick link filters property */ public static final String QUICKLINKS_PROFILE_SERVICES_PROPERTY = "quicklinks_profile/services"; + public static final String SERVICE_GROUP_NAME_PROPERETY = "service_group"; + public static final String SERVICE_NAME_PROPERTY = "name"; /** @@ -189,21 +195,34 @@ public class ProvisionClusterRequest extends BaseClusterRequest { this.securityConfiguration = securityConfiguration;
ambari git commit: AMBARI-22253. Add TopologyConfigurationsEntity (magyari_sandor)
Repository: ambari Updated Branches: refs/heads/branch-feature-AMBARI-14714 acab46dc6 -> 4b9633923 AMBARI-22253. Add TopologyConfigurationsEntity (magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/4b963392 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/4b963392 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/4b963392 Branch: refs/heads/branch-feature-AMBARI-14714 Commit: 4b963392342c521f376218c761696989fa78344f Parents: acab46d Author: Sandor Magyari Authored: Tue Oct 24 20:51:54 2017 +0200 Committer: Sandor Magyari Committed: Tue Oct 24 22:20:11 2017 +0200 -- .../internal/ProvisionClusterRequest.java | 7 + .../orm/entities/HostGroupComponentEntity.java | 9 +- .../entities/HostGroupComponentEntityPK.java| 36 + .../entities/TopologyConfigurationsEntity.java | 148 +++ .../orm/entities/TopologyRequestEntity.java | 40 ++--- .../ambari/server/topology/BlueprintImplV2.java | 5 + .../ambari/server/topology/BlueprintV2.java | 12 ++ .../server/topology/BlueprintV2Factory.java | 5 +- .../topology/ClusterConfigurationRequest.java | 3 +- .../server/topology/ClusterTopologyImpl.java| 12 +- .../server/topology/PersistedStateImpl.java | 35 - .../resources/Ambari-DDL-Postgres-CREATE.sql| 15 ++ .../src/main/resources/META-INF/persistence.xml | 1 + 13 files changed, 285 insertions(+), 43 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/4b963392/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ProvisionClusterRequest.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ProvisionClusterRequest.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ProvisionClusterRequest.java index bfa46d8..0e1753b 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ProvisionClusterRequest.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ProvisionClusterRequest.java @@ -91,6 +91,11 @@ public class ProvisionClusterRequest extends BaseClusterRequest { public static final String CONFIGURATIONS_PROPERTY = "configurations"; /** + * services property name + */ + public static final String SERVICES_PROPERTY = "services"; + + /** * default password property name */ public static final String DEFAULT_PASSWORD_PROPERTY = "default_password"; @@ -184,6 +189,8 @@ public class ProvisionClusterRequest extends BaseClusterRequest { this.securityConfiguration = securityConfiguration; +//TODO parse service configs and mereg with BP service configs +//Collection> services = properties.get(SERVICES_PROPERTY); //Configuration configuration = configurationFactory.getConfiguration( // (Collection>) properties.get(CONFIGURATIONS_PROPERTY)); //configuration.setParentConfiguration(blueprint.getConfiguration()); http://git-wip-us.apache.org/repos/asf/ambari/blob/4b963392/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostGroupComponentEntity.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostGroupComponentEntity.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostGroupComponentEntity.java index 186180b..bd34d29 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostGroupComponentEntity.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostGroupComponentEntity.java @@ -52,14 +52,13 @@ public class HostGroupComponentEntity { private String serviceName; @Id - @Column(name = "instance_name", nullable = true, insertable = true, updatable = false) - private String name; - - - @Id @Column(name = "type", nullable = false, insertable = true, updatable = false) private String type; + @Id + @Column(name = "instance_name", nullable = true, insertable = true, updatable = false) + private String name; + @Column(name = "provision_action", nullable = true, insertable = true, updatable = false) private String provisionAction; http://git-wip-us.apache.org/repos/asf/ambari/blob/4b963392/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostGroupComponentEntityPK.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostGroupComponentEntityPK.java b/ambari-server/src/main/java/org/apache/ambari/se
[ambari] Git Push Summary
Repository: ambari Updated Branches: refs/remotes/origin/branch-feature-AMBARI-14714 [created] 841cc7e12
[1/4] ambari git commit: Blueprint V2 data model (benyoka)
Repository: ambari Updated Branches: refs/heads/branch-feature-AMBARI-14714 17e4330db -> 841cc7e12 http://git-wip-us.apache.org/repos/asf/ambari/blob/f82497d4/ambari-server/src/main/java/org/apache/ambari/server/topology/HostGroupV2Impl.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/HostGroupV2Impl.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/HostGroupV2Impl.java new file mode 100644 index 000..351351b --- /dev/null +++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/HostGroupV2Impl.java @@ -0,0 +1,124 @@ +package org.apache.ambari.server.topology; + +import java.util.Collection; +import java.util.List; +import java.util.stream.Collectors; + +import javax.annotation.Nullable; + +import org.apache.ambari.server.controller.internal.ProvisionAction; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.google.common.base.Function; +import com.google.common.base.Predicates; +import com.google.common.collect.Collections2; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; + +public class HostGroupV2Impl implements HostGroupV2, Configurable { + + private String name; + private String blueprintName; + private List components; + private List services; + private Configuration configuration; + private String cardinality; + private boolean containsMasterComponent; + + public HostGroupV2Impl() { } + + @Override + public String getName() { +return name; + } + + @Override + public String getBlueprintName() { +return blueprintName; + } + + @Override + public String getFullyQualifiedName() { +return blueprintName + ":" + name; + } + + @Override + public Collection getComponents() { +return components; + } + + @Override + public Collection getComponentNames() { +return getComponentNames(components); + } + + private Collection getComponentNames(List components) { +return Lists.transform(components, + new Function() { +@Override public String apply(@Nullable ComponentV2 input) { return input.getName(); } + }); + } + + @Override + public Collection getComponentNames(ProvisionAction provisionAction) { +List filtered = + ImmutableList.copyOf(Collections2.filter(components, Predicates.equalTo(provisionAction))); +return getComponentNames(filtered); + } + + @Override + public Collection getComponents(ServiceId serviceId) { +return components.stream().filter(c -> c.getServiceId().equals(serviceId)).collect(Collectors.toList()); + } + + @Override + public boolean containsMasterComponent() { +return containsMasterComponent; + } + + @Override + @JsonIgnore + public Collection getServices() { +return services; + } + + @Override + @JsonIgnore + public Collection getServiceNames() { +return services.stream().map(s -> s.getName()).collect(Collectors.toList()); + } + + @Override + public Configuration getConfiguration() { +return configuration; + } + + @Override + public String getCardinality() { +return cardinality; + } + + public void setName(String name) { +this.name = name; + } + + public void setBlueprintName(String blueprintName) { +this.blueprintName = blueprintName; + } + + public void setComponents(List components) { +this.components = components; +this.containsMasterComponent = components.stream().anyMatch(c -> c.isMasterComponent()); +this.services = components.stream().map(c -> c.getServiceId()).collect(Collectors.toList()); + } + + public void setConfiguration(Configuration configuration) { +this.configuration = configuration; + } + + public void setCardinality(String cardinality) { +this.cardinality = cardinality; + } + +} + http://git-wip-us.apache.org/repos/asf/ambari/blob/f82497d4/ambari-server/src/main/java/org/apache/ambari/server/topology/RepositoryVersion.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/RepositoryVersion.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/RepositoryVersion.java new file mode 100644 index 000..8eb6663 --- /dev/null +++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/RepositoryVersion.java @@ -0,0 +1,71 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distribut
[2/4] ambari git commit: Blueprint V2 data model (benyoka)
Blueprint V2 data model (benyoka) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/f82497d4 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/f82497d4 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/f82497d4 Branch: refs/heads/branch-feature-AMBARI-14714 Commit: f82497d4d5c8d96dbf5629578a0205de0807e422 Parents: 17e4330 Author: Balazs Bence Sari Authored: Wed Oct 18 17:39:59 2017 +0200 Committer: Sandor Magyari Committed: Thu Oct 19 14:30:14 2017 +0200 -- .../ambari/server/controller/StackV2.java | 605 +++ .../server/controller/StackV2Factory.java | 219 +++ .../ambari/server/orm/dao/BlueprintV2DAO.java | 136 + .../server/orm/entities/BlueprintEntity.java| 1 - .../server/orm/entities/BlueprintV2Entity.java | 119 .../orm/entities/HostGroupComponentEntity.java | 17 +- .../ambari/server/orm/entities/StackEntity.java | 11 +- .../ambari/server/topology/BlueprintImplV2.java | 256 +++- .../ambari/server/topology/BlueprintV2.java | 55 +- .../server/topology/BlueprintV2Factory.java | 170 ++ .../server/topology/BlueprintValidatorV2.java | 43 ++ .../ambari/server/topology/ComponentV2.java | 88 ++- .../ambari/server/topology/Configurable.java| 40 ++ .../ambari/server/topology/Configuration.java | 7 + .../ambari/server/topology/HostGroupImpl.java | 2 - .../ambari/server/topology/HostGroupV2.java | 15 +- .../ambari/server/topology/HostGroupV2Impl.java | 124 .../server/topology/RepositoryVersion.java | 71 +++ .../server/topology/SecurityConfiguration.java | 7 +- .../apache/ambari/server/topology/Service.java | 85 +-- .../ambari/server/topology/ServiceGroup.java| 42 +- .../ambari/server/topology/ServiceId.java | 52 ++ .../validators/BlueprintImplV2Test.java | 9 + 23 files changed, 2034 insertions(+), 140 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/f82497d4/ambari-server/src/main/java/org/apache/ambari/server/controller/StackV2.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/StackV2.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/StackV2.java new file mode 100644 index 000..8d7de5d --- /dev/null +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/StackV2.java @@ -0,0 +1,605 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ambari.server.controller; + +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +import org.apache.ambari.server.state.AutoDeployInfo; +import org.apache.ambari.server.state.DependencyInfo; +import org.apache.ambari.server.state.PropertyDependencyInfo; +import org.apache.ambari.server.state.PropertyInfo; +import org.apache.ambari.server.state.ValueAttributesInfo; +import org.apache.ambari.server.topology.Cardinality; +import org.apache.ambari.server.topology.Configuration; + +/** + * Encapsulates stack information. + */ +public class StackV2 { + +/** Stack name */ +private final String name; + +/** Stack version */ +private final String version; + +/** Repo version */ +private final String repoVersion; + +/** Map of service name to components */ +private final Map> serviceComponents; + +/** Map of component to service */ +private final Map componentService; + +/** Map of component to dependencies */ +private final Map> dependencies; + +/** Map of dependency to conditional service */ +private final Map dependencyConditionalServiceMap; + +/** + * Map of database component name to configuration property which indicates whether + * the database in to be managed or if it is an external non-managed instance. + * If the value of the config property starts with 'New', the database is determined
[4/4] ambari git commit: AMBARI-22253. Modify TopologyManager to create service groups (magyari_sandor)
AMBARI-22253. Modify TopologyManager to create service groups (magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/841cc7e1 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/841cc7e1 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/841cc7e1 Branch: refs/heads/branch-feature-AMBARI-14714 Commit: 841cc7e12c9f6e689b7b97b7b75b92ed7744fa87 Parents: 37b1e6e Author: Sandor Magyari Authored: Thu Oct 19 14:20:39 2017 +0200 Committer: Sandor Magyari Committed: Thu Oct 19 14:30:31 2017 +0200 -- .../StackAdvisorBlueprintProcessor.java | 2 +- .../ambari/server/controller/AmbariServer.java | 3 +- .../ambari/server/controller/StackV2.java | 47 +- .../server/controller/StackV2Factory.java | 10 +- .../controller/internal/BaseClusterRequest.java | 8 +- .../BlueprintConfigurationProcessor.java| 4 +- .../internal/ConfigurationContext.java | 1 + .../internal/ProvisionClusterRequest.java | 7 +- .../internal/ScaleClusterRequest.java | 6 + .../server/controller/internal/StackV2.java | 834 --- .../server/controller/internal/UnitUpdater.java | 1 + .../ambari/server/topology/AmbariContext.java | 5 +- .../server/topology/BlueprintFactory.java | 4 +- .../ambari/server/topology/BlueprintImplV2.java | 49 +- .../ambari/server/topology/BlueprintV2.java | 10 +- .../topology/ClusterConfigurationRequest.java | 5 +- .../ambari/server/topology/ComponentV2.java | 12 +- .../ambari/server/topology/HostGroupV2.java | 11 +- .../ambari/server/topology/HostGroupV2Impl.java | 21 +- .../ambari/server/topology/HostRequest.java | 2 +- .../server/topology/PersistedStateImpl.java | 9 +- .../apache/ambari/server/topology/Service.java | 21 +- .../ambari/server/topology/TopologyManager.java | 2 +- .../validators/ClusterConfigTypeValidator.java | 5 +- .../RequiredConfigPropertiesValidator.java | 2 +- .../validators/RequiredPasswordValidator.java | 2 +- .../topology/validators/UnitValidator.java | 12 +- 27 files changed, 178 insertions(+), 917 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/841cc7e1/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessor.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessor.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessor.java index ba35cce..2e9ac9f 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessor.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessor.java @@ -28,8 +28,8 @@ import java.util.Set; import org.apache.ambari.server.api.services.stackadvisor.StackAdvisorRequest.StackAdvisorRequestType; import org.apache.ambari.server.api.services.stackadvisor.recommendations.RecommendationResponse; import org.apache.ambari.server.api.services.stackadvisor.recommendations.RecommendationResponse.BlueprintConfigurations; +import org.apache.ambari.server.controller.StackV2; import org.apache.ambari.server.controller.internal.ConfigurationTopologyException; -import org.apache.ambari.server.controller.internal.StackV2; import org.apache.ambari.server.state.ValueAttributesInfo; import org.apache.ambari.server.topology.AdvisedConfiguration; import org.apache.ambari.server.topology.BlueprintV2; http://git-wip-us.apache.org/repos/asf/ambari/blob/841cc7e1/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java index 6d4d1c9..f900452 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java @@ -115,6 +115,7 @@ import org.apache.ambari.server.stack.UpdateActiveRepoVersionOnStartup; import org.apache.ambari.server.state.Clusters; import org.apache.ambari.server.topology.AmbariContext; import org.apache.ambari.server.topology.BlueprintFactory; +import org.apache.ambari.server.topology.BlueprintV2Factory; import org.apache.ambari.server.topology.SecurityConfigurationFactory; import org.apache.ambari.server.topology.TopologyManager; import
[3/4] ambari git commit: Create first unit test for Blueprint v2 data model (benyoka)
Create first unit test for Blueprint v2 data model (benyoka) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/37b1e6e5 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/37b1e6e5 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/37b1e6e5 Branch: refs/heads/branch-feature-AMBARI-14714 Commit: 37b1e6e5132823d71b3cfe91ca4c270bd11a2013 Parents: f82497d Author: Balazs Bence Sari Authored: Wed Oct 18 18:29:56 2017 +0200 Committer: Sandor Magyari Committed: Thu Oct 19 14:30:23 2017 +0200 -- .../ambari/server/topology/BlueprintImplV2.java | 29 .../validators/BlueprintImplV2Test.java | 45 +- .../test/resources/blueprintv2/blueprintv2.json | 152 +++ 3 files changed, 196 insertions(+), 30 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/37b1e6e5/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintImplV2.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintImplV2.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintImplV2.java index 827fa39..b2119e6 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintImplV2.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintImplV2.java @@ -19,7 +19,6 @@ package org.apache.ambari.server.topology; -import java.io.File; import java.util.Collection; import java.util.HashMap; import java.util.List; @@ -38,11 +37,6 @@ import org.apache.commons.lang.StringUtils; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.core.Version; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.SerializationFeature; -import com.fasterxml.jackson.databind.module.SimpleAbstractTypeResolver; -import com.fasterxml.jackson.databind.module.SimpleModule; /** * Blueprint implementation. @@ -336,27 +330,4 @@ public class BlueprintImplV2 implements BlueprintV2 { public Blueprints() { } } - public static void main(String[] args) throws Exception { -ObjectMapper mapper = new ObjectMapper(); -SimpleModule module = new SimpleModule("CustomModel", Version.unknownVersion()); -SimpleAbstractTypeResolver resolver = new SimpleAbstractTypeResolver(); -resolver.addMapping(HostGroupV2.class, HostGroupV2Impl.class); -module.setAbstractTypes(resolver); -mapper.registerModule(module); -mapper.enable(SerializationFeature.INDENT_OUTPUT); -BlueprintImplV2 bp = mapper.readValue(new File("/Users/bsari/develop/blueprints/blueprintv2.json"), BlueprintImplV2.class); -String bpJson = mapper.writeValueAsString(bp); -System.out.println(bpJson); - System.out.println("\n\n\n\n"); -Map map = mapper.readValue(new File("/Users/bsari/develop/blueprints/blueprintv2.json"), HashMap.class); -System.out.println(map); - System.out.println("\n\n\n\n"); -String bpJson2 = mapper.writeValueAsString(map); -System.out.println(bpJson2); - System.out.println("\n\n\n\n"); -BlueprintImplV2 bp2 = mapper.readValue(bpJson2, BlueprintImplV2.class); -System.out.println(bp2); - } - - } http://git-wip-us.apache.org/repos/asf/ambari/blob/37b1e6e5/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/BlueprintImplV2Test.java -- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/BlueprintImplV2Test.java b/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/BlueprintImplV2Test.java index dbe269a..5a676bc 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/BlueprintImplV2Test.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/BlueprintImplV2Test.java @@ -1,9 +1,52 @@ package org.apache.ambari.server.topology.validators; +import java.util.HashMap; +import java.util.Map; + +import org.apache.ambari.server.topology.BlueprintImplV2; +import org.apache.ambari.server.topology.HostGroupV2; +import org.apache.ambari.server.topology.HostGroupV2Impl; +import org.junit.BeforeClass; +import org.junit.Test; + +import com.fasterxml.jackson.core.Version; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; +import com.fasterxml.jackson.databind
ambari git commit: AMBARI-22253. Modify TopologyManager to create service groups (magyari_sandor)
Repository: ambari Updated Branches: refs/heads/branch-feature-AMBARI-14714 65d44cd50 -> 58c833946 AMBARI-22253. Modify TopologyManager to create service groups (magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/58c83394 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/58c83394 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/58c83394 Branch: refs/heads/branch-feature-AMBARI-14714 Commit: 58c833946d8be370af2beb4735f8e21beea1359e Parents: 65d44cd Author: Sandor Magyari Authored: Tue Oct 17 15:09:05 2017 +0200 Committer: Sandor Magyari Committed: Tue Oct 17 15:43:40 2017 +0200 -- .../query/render/ClusterBlueprintRenderer.java | 45 +++-- .../StackAdvisorBlueprintProcessor.java | 27 +--- .../controller/internal/BaseClusterRequest.java | 17 - .../BlueprintConfigurationProcessor.java| 22 -- .../internal/ConfigurationContext.java | 4 +- .../internal/ExportBlueprintRequest.java| 25 +-- .../internal/ProvisionClusterRequest.java | 22 -- .../internal/ScaleClusterRequest.java | 8 +-- .../server/controller/internal/StackV2.java | 11 ++- .../server/controller/internal/UnitUpdater.java | 6 +- .../ambari/server/topology/AmbariContext.java | 71 .../server/topology/BlueprintFactory.java | 10 ++- .../ambari/server/topology/BlueprintImplV2.java | 6 +- .../ambari/server/topology/BlueprintV2.java | 6 +- .../server/topology/BlueprintValidatorImpl.java | 10 +-- .../topology/ClusterConfigurationRequest.java | 21 -- .../ambari/server/topology/ClusterTopology.java | 6 +- .../server/topology/ClusterTopologyImpl.java| 15 +++-- .../ambari/server/topology/HostGroupInfo.java | 10 +-- .../ambari/server/topology/HostRequest.java | 20 -- .../ambari/server/topology/LogicalRequest.java | 22 -- .../server/topology/PersistedStateImpl.java | 34 -- .../apache/ambari/server/topology/Service.java | 4 +- .../ambari/server/topology/TopologyManager.java | 42 +--- .../tasks/PersistHostResourcesTask.java | 17 +++-- .../validators/ClusterConfigTypeValidator.java | 6 +- .../validators/HiveServiceValidator.java| 11 ++- .../RequiredConfigPropertiesValidator.java | 15 - .../validators/RequiredPasswordValidator.java | 15 +++-- .../validators/StackConfigTypeValidator.java| 6 +- .../topology/validators/UnitValidator.java | 10 +-- .../topology/ClusterTopologyImplTest.java | 18 +++-- 32 files changed, 414 insertions(+), 148 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/58c83394/ambari-server/src/main/java/org/apache/ambari/server/api/query/render/ClusterBlueprintRenderer.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/query/render/ClusterBlueprintRenderer.java b/ambari-server/src/main/java/org/apache/ambari/server/api/query/render/ClusterBlueprintRenderer.java index 4f71255..7171fc7 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/api/query/render/ClusterBlueprintRenderer.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/api/query/render/ClusterBlueprintRenderer.java @@ -18,24 +18,57 @@ package org.apache.ambari.server.api.query.render; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + import org.apache.ambari.server.AmbariException; import org.apache.ambari.server.api.query.QueryInfo; import org.apache.ambari.server.api.services.Request; -import org.apache.ambari.server.api.services.*; +import org.apache.ambari.server.api.services.Result; +import org.apache.ambari.server.api.services.ResultImpl; +import org.apache.ambari.server.api.services.ResultPostProcessor; +import org.apache.ambari.server.api.services.ResultPostProcessorImpl; import org.apache.ambari.server.api.util.TreeNode; import org.apache.ambari.server.api.util.TreeNodeImpl; import org.apache.ambari.server.controller.AmbariManagementController; import org.apache.ambari.server.controller.AmbariServer; -import org.apache.ambari.server.controller.internal.*; -import org.apache.ambari.server.controller.spi.*; +import org.apache.ambari.server.controller.internal.ArtifactResourceProvider; +import org.apache.ambari.server.controller.internal.BlueprintConfigurationProcessor; +import org.apache.ambari.server.controller.internal.BlueprintResourceProvider; +import org.apache.ambari.server.controller.internal.ConfigurationContext; +imp
[2/4] ambari git commit: use V2 objects in TopologyManager
http://git-wip-us.apache.org/repos/asf/ambari/blob/65d44cd5/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackV2.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackV2.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackV2.java new file mode 100644 index 000..c5a6064 --- /dev/null +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackV2.java @@ -0,0 +1,829 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ambari.server.controller.internal; + +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +import org.apache.ambari.server.AmbariException; +import org.apache.ambari.server.controller.*; +import org.apache.ambari.server.orm.entities.StackEntity; + +import org.apache.ambari.server.state.AutoDeployInfo; +import org.apache.ambari.server.state.ComponentInfo; +import org.apache.ambari.server.state.DependencyInfo; +import org.apache.ambari.server.state.PropertyDependencyInfo; +import org.apache.ambari.server.state.PropertyInfo; +import org.apache.ambari.server.state.ValueAttributesInfo; + +import org.apache.ambari.server.topology.Cardinality; +import org.apache.ambari.server.topology.Configuration; + +/** + * Encapsulates stack information. + */ +public class StackV2 { + /** + * Stack name + */ + private String name; + + /** + * Stack version + */ + private String version; + + /** + * Repo version + */ + private String repoVersion; + + /** + * Map of service name to components + */ + private Map> serviceComponents = +new HashMap<>(); + + /** + * Map of component to service + */ + private Map componentService = new HashMap<>(); + + /** + * Map of component to dependencies + */ + private Map> dependencies = +new HashMap<>(); + + /** + * Map of dependency to conditional service + */ + private Map dependencyConditionalServiceMap = +new HashMap<>(); + + /** + * Map of database component name to configuration property which indicates whether + * the database in to be managed or if it is an external non-managed instance. + * If the value of the config property starts with 'New', the database is determined + * to be managed, otherwise it is non-managed. + */ + private Map dbDependencyInfo = new HashMap<>(); + + /** + * Map of component to required cardinality + */ + private Map cardinalityRequirements = new HashMap<>(); + + //todo: instead of all these maps from component -> * , + //todo: we should use a Component object with all of these attributes + private Set masterComponents = new HashSet<>(); + + /** + * Map of component to auto-deploy information + */ + private Map componentAutoDeployInfo = +new HashMap<>(); + + /** + * Map of service to config type properties + */ + private Map>> serviceConfigurations = +new HashMap<>(); + + /** + * Map of service to required type properties + */ + private Map>> requiredServiceConfigurations = +new HashMap<>(); + + /** + * Map of service to config type properties + */ + private Map> stackConfigurations = +new HashMap<>(); + + /** + * Map of service to set of excluded config types + */ + private Map> excludedConfigurationTypes = +new HashMap<>(); + + /** + * Ambari Management Controller, used to obtain Stack definitions + */ + private final AmbariManagementController controller; + + + /** + * Constructor. + * + * @param stack + * the stack (not {@code null}). + * @param ambariManagementController + * the management controller (not {@code null}). + * @throws AmbariException + */ + public StackV2(StackEntity stack, AmbariManagementController ambariManagementController) throws AmbariException { +this(stack.getStackName(), stack.getStackVersion(), ambariManagementController); + } + + /** + * Constructor. + * + * @param name stack name + * @param version stack version + * + * @throws Amba
[1/4] ambari git commit: use V2 objects in TopologyManager
Repository: ambari Updated Branches: refs/heads/branch-feature-AMBARI-14714 b0ff5da46 -> 65d44cd50 http://git-wip-us.apache.org/repos/asf/ambari/blob/65d44cd5/ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterTopologyImpl.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterTopologyImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterTopologyImpl.java index f50e60f..8feb979 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterTopologyImpl.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterTopologyImpl.java @@ -19,36 +19,34 @@ package org.apache.ambari.server.topology; -import static org.apache.ambari.server.controller.internal.ProvisionAction.INSTALL_AND_START; -import static org.apache.ambari.server.controller.internal.ProvisionAction.INSTALL_ONLY; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - import org.apache.ambari.server.AmbariException; import org.apache.ambari.server.controller.RequestStatusResponse; +import org.apache.ambari.server.controller.internal.ConfigurationContext; import org.apache.ambari.server.controller.internal.ProvisionAction; import org.apache.ambari.server.controller.internal.ProvisionClusterRequest; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.util.*; + +import static org.apache.ambari.server.controller.internal.ProvisionAction.INSTALL_AND_START; +import static org.apache.ambari.server.controller.internal.ProvisionAction.INSTALL_ONLY; + /** * Represents a cluster topology. * Topology includes the the associated blueprint, cluster configuration and hostgroup -> host mapping. */ public class ClusterTopologyImpl implements ClusterTopology { + private final static Logger LOG = LoggerFactory.getLogger(ClusterTopologyImpl.class); + private Long clusterId; //todo: currently topology is only associated with a single bp //todo: this will need to change to allow usage of multiple bp's for the same cluster //todo: for example: provision using bp1 and scale using bp2 - private Blueprint blueprint; - private Configuration configuration; + private BlueprintV2 blueprint; + private Collection serviceConfigs; private ConfigRecommendationStrategy configRecommendationStrategy; private ProvisionAction provisionAction = ProvisionAction.INSTALL_AND_START; private Map advisedConfigurations = new HashMap<>(); @@ -56,16 +54,13 @@ public class ClusterTopologyImpl implements ClusterTopology { private final AmbariContext ambariContext; private final String defaultPassword; - private final static Logger LOG = LoggerFactory.getLogger(ClusterTopologyImpl.class); - - //todo: will need to convert all usages of hostgroup name to use fully qualified name (BP/HG) //todo: for now, restrict scaling to the same BP public ClusterTopologyImpl(AmbariContext ambariContext, TopologyRequest topologyRequest) throws InvalidTopologyException { this.clusterId = topologyRequest.getClusterId(); // provision cluster currently requires that all hostgroups have same BP so it is ok to use root level BP here this.blueprint = topologyRequest.getBlueprint(); -this.configuration = topologyRequest.getConfiguration(); +this.serviceConfigs = topologyRequest.getServiceConfigs(); if (topologyRequest instanceof ProvisionClusterRequest) { this.defaultPassword = ((ProvisionClusterRequest) topologyRequest).getDefaultPassword(); } else { @@ -95,13 +90,18 @@ public class ClusterTopologyImpl implements ClusterTopology { } @Override - public Blueprint getBlueprint() { + public BlueprintV2 getBlueprint() { return blueprint; } @Override + @Deprecated public Configuration getConfiguration() { -return configuration; +return null; + } + + public Collection getServiceConfigs() { +return serviceConfigs; } @Override @@ -113,7 +113,7 @@ public class ClusterTopologyImpl implements ClusterTopology { @Override public Collection getHostGroupsForComponent(String component) { Collection resultGroups = new ArrayList<>(); -for (HostGroup group : getBlueprint().getHostGroups().values() ) { +for (HostGroupV2 group : getBlueprint().getHostGroups().values() ) { if (group.getComponentNames().contains(component)) { resultGroups.add(group.getName()); } @@ -178,49 +178,48 @@ public class ClusterTopologyImpl implements ClusterTopology { } @Override - public boolean isNameNodeHAEnabled() { -return isNameNodeHAEnabled(configuration.getFullProperties()); - } - - public static boolean isNameNodeHAEnabled(Map> configurationProperties) { -return configurationProperties.containsKey("hdfs-site") &&
[4/4] ambari git commit: use V2 objects in TopologyManager
use V2 objects in TopologyManager Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/65d44cd5 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/65d44cd5 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/65d44cd5 Branch: refs/heads/branch-feature-AMBARI-14714 Commit: 65d44cd505f5056499dc29f91d911e604a0b72d8 Parents: b0ff5da Author: Sandor Magyari Authored: Mon Oct 16 16:27:50 2017 +0200 Committer: Sandor Magyari Committed: Mon Oct 16 20:14:17 2017 +0200 -- .../query/render/ClusterBlueprintRenderer.java | 60 +- .../server/api/services/ServiceService.java | 2 +- .../StackAdvisorBlueprintProcessor.java | 37 +- .../users/ActiveWidgetLayoutService.java| 2 +- .../api/services/views/ViewInstanceService.java | 2 +- .../ambari/server/controller/StackV2.java | 826 -- .../controller/internal/BaseClusterRequest.java | 41 +- .../BlueprintConfigurationProcessor.java| 304 --- .../internal/ConfigurationContext.java | 59 ++ .../internal/ExportBlueprintRequest.java| 55 +- .../internal/ProvisionClusterRequest.java | 34 +- .../internal/ScaleClusterRequest.java | 20 +- .../server/controller/internal/StackV2.java | 829 +++ .../server/controller/internal/UnitUpdater.java | 20 +- .../ambari/server/topology/AmbariContext.java | 297 +++ .../server/topology/BlueprintFactory.java | 14 +- .../ambari/server/topology/BlueprintImplV2.java | 40 +- .../ambari/server/topology/BlueprintV2.java | 42 +- .../server/topology/BlueprintValidatorImpl.java | 78 +- .../topology/ClusterConfigurationRequest.java | 79 +- .../ambari/server/topology/ClusterTopology.java | 21 +- .../server/topology/ClusterTopologyImpl.java| 93 +-- .../ambari/server/topology/ComponentV2.java | 17 +- .../ambari/server/topology/HostGroupInfo.java | 27 +- .../ambari/server/topology/HostGroupV2.java | 6 + .../ambari/server/topology/HostRequest.java | 58 +- .../ambari/server/topology/LogicalRequest.java | 26 +- .../server/topology/PersistedStateImpl.java | 55 +- .../apache/ambari/server/topology/Service.java | 25 +- .../ambari/server/topology/ServiceGroup.java| 1 + .../ambari/server/topology/TopologyManager.java | 62 +- .../ambari/server/topology/TopologyRequest.java | 10 +- .../tasks/PersistHostResourcesTask.java | 23 +- .../validators/ClusterConfigTypeValidator.java | 11 +- .../validators/HiveServiceValidator.java| 50 +- .../RequiredConfigPropertiesValidator.java | 102 +-- .../validators/RequiredPasswordValidator.java | 32 +- .../validators/StackConfigTypeValidator.java| 37 +- .../topology/validators/UnitValidator.java | 42 +- .../server/api/services/AmbariMetaInfoTest.java | 2 +- .../api/services/RootServiceServiceTest.java| 2 +- .../server/api/services/ServiceServiceTest.java | 2 +- .../AmbariManagementControllerTest.java | 6 +- .../server/state/cluster/ClusterTest.java | 2 +- .../server/topology/BlueprintImplTest.java | 10 +- .../topology/ClusterTopologyImplTest.java | 58 +- 46 files changed, 1782 insertions(+), 1839 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/65d44cd5/ambari-server/src/main/java/org/apache/ambari/server/api/query/render/ClusterBlueprintRenderer.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/query/render/ClusterBlueprintRenderer.java b/ambari-server/src/main/java/org/apache/ambari/server/api/query/render/ClusterBlueprintRenderer.java index acdf9ed..4f71255 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/api/query/render/ClusterBlueprintRenderer.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/api/query/render/ClusterBlueprintRenderer.java @@ -18,57 +18,24 @@ package org.apache.ambari.server.api.query.render; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - import org.apache.ambari.server.AmbariException; import org.apache.ambari.server.api.query.QueryInfo; import org.apache.ambari.server.api.services.Request; -import org.apache.ambari.server.api.services.Result; -import org.apache.ambari.server.api.services.ResultImpl; -import org.apache.ambari.server.api.services.ResultPostProcessor; -import org.apache.ambari.server.api.services.ResultPostProcessorImpl; +import org.apache.ambari.server.api.services.*; import org.apache.ambari.server.api.util.TreeNode; import org.
[3/4] ambari git commit: use V2 objects in TopologyManager
http://git-wip-us.apache.org/repos/asf/ambari/blob/65d44cd5/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java index 03f84a5..4c51762 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java @@ -37,30 +37,19 @@ import java.util.Set; import java.util.regex.Matcher; import java.util.regex.Pattern; + +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Sets; + import org.apache.ambari.server.AmbariException; -import org.apache.ambari.server.state.Cluster; -import org.apache.ambari.server.state.ConfigHelper; -import org.apache.ambari.server.state.PropertyDependencyInfo; -import org.apache.ambari.server.state.StackId; -import org.apache.ambari.server.state.ValueAttributesInfo; -import org.apache.ambari.server.topology.AdvisedConfiguration; -import org.apache.ambari.server.topology.Blueprint; -import org.apache.ambari.server.topology.Cardinality; -import org.apache.ambari.server.topology.ClusterTopology; -import org.apache.ambari.server.topology.ConfigRecommendationStrategy; -import org.apache.ambari.server.topology.Configuration; -import org.apache.ambari.server.topology.HostGroup; -import org.apache.ambari.server.topology.HostGroupInfo; +import org.apache.ambari.server.state.*; +import org.apache.ambari.server.topology.*; +import org.apache.ambari.server.topology.Service; import org.apache.ambari.server.topology.validators.UnitValidatedProperty; import org.apache.commons.lang.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.google.common.base.Predicates; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.Maps; -import com.google.common.collect.Sets; - /** * Updates configuration properties based on cluster topology. This is done when exporting * a blueprint and when a cluster is provisioned via a blueprint. @@ -213,10 +202,11 @@ public class BlueprintConfigurationProcessor { new HawqHAFilter() }; private ClusterTopology clusterTopology; + public final ConfigurationContext configurationContext; - - public BlueprintConfigurationProcessor(ClusterTopology clusterTopology) { + public BlueprintConfigurationProcessor(ClusterTopology clusterTopology, ConfigurationContext configurationContext) { this.clusterTopology = clusterTopology; +this.configurationContext = configurationContext; initRemovePropertyUpdaters(); } @@ -309,7 +299,7 @@ public class BlueprintConfigurationProcessor { Map typeMap = clusterProps.get(type); if (typeMap != null && typeMap.containsKey(propertyName) && typeMap.get(propertyName) != null) { requiredHostGroups.addAll(updater.getRequiredHostGroups( -propertyName, typeMap.get(propertyName), clusterProps, clusterTopology)); +propertyName, typeMap.get(propertyName), clusterProps, clusterTopology, configurationContext)); } // host group configs @@ -318,7 +308,7 @@ public class BlueprintConfigurationProcessor { Map hgTypeMap = hgConfigProps.get(type); if (hgTypeMap != null && hgTypeMap.containsKey(propertyName)) { requiredHostGroups.addAll(updater.getRequiredHostGroups( - propertyName, hgTypeMap.get(propertyName), hgConfigProps, clusterTopology)); + propertyName, hgTypeMap.get(propertyName), hgConfigProps, clusterTopology, configurationContext)); } } } @@ -361,7 +351,7 @@ public class BlueprintConfigurationProcessor { if (typeMap != null && typeMap.containsKey(propertyName) && typeMap.get(propertyName) != null) { final String originalValue = typeMap.get(propertyName); final String updatedValue = - updater.updateForClusterCreate(propertyName, originalValue, clusterProps, clusterTopology); + updater.updateForClusterCreate(propertyName, originalValue, clusterProps, clusterTopology, configurationContext); if(updatedValue == null ) { continue; @@ -382,7 +372,7 @@ public class BlueprintConfigurationProcessor { if (hgTypeMap != null && hgTypeMap.containsKey(propertyName)) { final String originalValue = hgTypeMap.get(propertyName); final String updatedValue = -updater.updateForClusterCreate(propertyName, originalValue, hgConfigProps, clusterTopology); +
ambari git commit: AMBARI-22174. Remove unnecessary Kerberos related properties from BlueprintConfigurationProcessor (magyari_sandor)
Repository: ambari Updated Branches: refs/heads/trunk 33d67f3ea -> aeb1865c9 AMBARI-22174. Remove unnecessary Kerberos related properties from BlueprintConfigurationProcessor (magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/aeb1865c Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/aeb1865c Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/aeb1865c Branch: refs/heads/trunk Commit: aeb1865c95b86980ac31bc9362203f4bd84a027d Parents: 33d67f3 Author: Sandor Magyari Authored: Mon Jan 16 14:30:28 2017 +0100 Committer: Sandor Magyari Committed: Wed Oct 11 12:59:55 2017 +0200 -- .../BlueprintConfigurationProcessor.java| 6 - .../BlueprintConfigurationProcessorTest.java| 28 2 files changed, 34 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/aeb1865c/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java index 03f84a5..5a7cda0 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java @@ -2556,7 +2556,6 @@ public class BlueprintConfigurationProcessor { multiCoreSiteMap.put("hadoop.proxyuser.yarn.hosts", new MultipleHostTopologyUpdater("RESOURCEMANAGER")); multiCoreSiteMap.put("hadoop.security.key.provider.path", new MultipleHostTopologyUpdater("RANGER_KMS_SERVER", ';', false, false, true)); multiWebhcatSiteMap.put("templeton.hive.properties", new TempletonHivePropertyUpdater()); -multiWebhcatSiteMap.put("templeton.kerberos.principal", new MultipleHostTopologyUpdater("WEBHCAT_SERVER")); multiHiveSiteMap.put("hive.zookeeper.quorum", new MultipleHostTopologyUpdater("ZOOKEEPER_SERVER")); multiHiveSiteMap.put("hive.cluster.delegation.token.store.zookeeper.connectString", new MultipleHostTopologyUpdater("ZOOKEEPER_SERVER")); @@ -2674,9 +2673,6 @@ public class BlueprintConfigurationProcessor { oozieStringPropertyUpdaterMap = new HashMap<>(); } oozieStringPropertyUpdaterMap.put("oozie.base.url", new SingleHostTopologyUpdater("OOZIE_SERVER")); - oozieStringPropertyUpdaterMap.put("oozie.authentication.kerberos.principal", new SingleHostTopologyUpdater("OOZIE_SERVER")); - oozieStringPropertyUpdaterMap.put("oozie.ha.authentication.kerberos.principal", new SingleHostTopologyUpdater("OOZIE_SERVER")); - oozieStringPropertyUpdaterMap.put("oozie.service.HadoopAccessorService.kerberos.principal", new SingleHostTopologyUpdater("OOZIE_SERVER")); singleHostTopologyUpdaters.put("oozie-site", oozieStringPropertyUpdaterMap); multiCoreSiteMap.put("hadoop.proxyuser.oozie.hosts", new MultipleHostTopologyUpdater("OOZIE_SERVER")); @@ -2728,8 +2724,6 @@ public class BlueprintConfigurationProcessor { // FALCON falconStartupPropertiesMap.put("*.broker.url", new SingleHostTopologyUpdater("FALCON_SERVER")); - falconStartupPropertiesMap.put("*.falcon.service.authentication.kerberos.principal", new SingleHostTopologyUpdater("FALCON_SERVER")); - falconStartupPropertiesMap.put("*.falcon.http.authentication.kerberos.principal", new SingleHostTopologyUpdater("FALCON_SERVER")); // KAFKA kafkaBrokerMap.put("kafka.ganglia.metrics.host", new OptionalSingleHostTopologyUpdater("GANGLIA_SERVER")); http://git-wip-us.apache.org/repos/asf/ambari/blob/aeb1865c/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java -- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java index d137f2c..22b0e6b 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java +++ b/ambari-server/src/test/java/o
ambari git commit: AMBARI-22172. Change log level for ClusterNotFoundException (magyari_sandor)
Repository: ambari Updated Branches: refs/heads/trunk 2d23e123f -> 24c35893b AMBARI-22172. Change log level for ClusterNotFoundException (magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/24c35893 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/24c35893 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/24c35893 Branch: refs/heads/trunk Commit: 24c35893b0be52146bc821b6d44eece8fd49c50a Parents: 2d23e12 Author: Sandor Magyari Authored: Tue Oct 10 13:19:39 2017 +0200 Committer: Sandor Magyari Committed: Tue Oct 10 17:10:40 2017 +0200 -- .../ambari/server/controller/AmbariManagementControllerImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/24c35893/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java index 8c4888c..b0eb8ac 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java @@ -1126,7 +1126,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle try { cluster = clusters.getCluster(request.getClusterName()); } catch (ClusterNotFoundException e) { - LOG.error("Cluster not found ", e); + LOG.info(e.getMessage()); throw new ParentObjectNotFoundException("Parent Cluster resource doesn't exist", e); }
ambari git commit: AMBARI-21406. Refresh configurations without restart command (magyari_sandor)
Repository: ambari Updated Branches: refs/heads/trunk 8908d3e05 -> 57682942b AMBARI-21406. Refresh configurations without restart command (magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/57682942 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/57682942 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/57682942 Branch: refs/heads/trunk Commit: 57682942b7368a8de3f0a76f65e45b13c1626deb Parents: 8908d3e Author: Sandor Magyari Authored: Fri Aug 25 14:08:55 2017 +0200 Committer: Sandor Magyari Committed: Tue Oct 10 16:46:30 2017 +0200 -- .../libraries/script/script.py | 23 ++- .../AmbariCustomCommandExecutionHelper.java | 10 ++ .../AmbariManagementControllerImpl.java | 4 +- .../ServiceComponentHostResponse.java | 15 ++ .../internal/HostComponentResourceProvider.java | 4 + .../ambari/server/metadata/ActionMetadata.java | 1 + .../apache/ambari/server/stack/StackModule.java | 29 +++- .../ambari/server/state/ConfigHelper.java | 164 ++- .../ambari/server/state/PropertyInfo.java | 29 .../ambari/server/state/RefreshCommand.java | 52 ++ .../state/RefreshCommandConfiguration.java | 71 .../apache/ambari/server/state/StackInfo.java | 10 ++ .../svccomphost/ServiceComponentHostImpl.java | 10 ++ .../HDFS/2.1.0.2.0/configuration/core-site.xml | 12 ++ .../HDFS/2.1.0.2.0/configuration/hdfs-site.xml | 3 + .../HDFS/2.1.0.2.0/package/scripts/datanode.py | 13 +- .../HDFS/2.1.0.2.0/package/scripts/hdfs.py | 52 +- .../2.1.0.2.0/package/scripts/hdfs_client.py| 5 + .../2.1.0.2.0/package/scripts/hdfs_namenode.py | 21 +++ .../HDFS/2.1.0.2.0/package/scripts/namenode.py | 21 ++- .../HDFS/2.1.0.2.0/package/scripts/snamenode.py | 10 ++ .../HDFS/3.0.0.3.0/configuration/hdfs-site.xml | 6 + .../HDFS/3.0.0.3.0/package/scripts/datanode.py | 13 +- .../HDFS/3.0.0.3.0/package/scripts/hdfs.py | 52 +- .../3.0.0.3.0/package/scripts/hdfs_client.py| 5 + .../3.0.0.3.0/package/scripts/hdfs_namenode.py | 20 +++ .../HDFS/3.0.0.3.0/package/scripts/namenode.py | 21 ++- .../HDFS/3.0.0.3.0/package/scripts/snamenode.py | 10 ++ .../src/main/resources/configuration-schema.xsd | 12 ++ .../src/main/resources/properties.json | 1 + .../services/HDFS/configuration/hdfs-site.xml | 3 + .../ambari/server/state/ConfigHelperTest.java | 76 - .../ambari/server/state/PropertyInfoTest.java | 20 +++ .../python/stacks/2.0.6/HDFS/test_datanode.py | 17 ++ .../python/stacks/2.0.6/HDFS/test_namenode.py | 33 .../services/HDFS/configuration/hdfs-site.xml | 8 + 36 files changed, 835 insertions(+), 21 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/57682942/ambari-common/src/main/python/resource_management/libraries/script/script.py -- diff --git a/ambari-common/src/main/python/resource_management/libraries/script/script.py b/ambari-common/src/main/python/resource_management/libraries/script/script.py index bf8c0dc..12e6f98 100644 --- a/ambari-common/src/main/python/resource_management/libraries/script/script.py +++ b/ambari-common/src/main/python/resource_management/libraries/script/script.py @@ -1006,12 +1006,33 @@ class Script(object): def configure(self, env, upgrade_type=None, config_dir=None): """ -To be overridden by subclasses +To be overridden by subclasses (may invoke save_configs) :param upgrade_type: only valid during RU/EU, otherwise will be None :param config_dir: for some clients during RU, the location to save configs to, otherwise None """ self.fail_with_error('configure method isn\'t implemented') + def save_configs(self, env): +""" +To be overridden by subclasses +Creates / updates configuration files +""" +self.fail_with_error('save_configs method isn\'t implemented') + + def reconfigure(self, env): +""" +Default implementation of RECONFIGURE action which may be overridden by subclasses +""" +Logger.info("Refresh config files ...") +self.save_configs(env) + +config = self.get_config() +if "reconfigureAction" in config["commandParams"] and config["commandParams"]["reconfigureAction"] is not None: + reconfigure_action = config["commandParams"]["reconfigureAction"] + Logger.info("Call %s" % reconfigure_action) + method = self.choose_method_to_execute(reconfigure_action) + me
ambari git commit: AMBARI-14714. add new blueprint schema elements (magyari_sandor)
Repository: ambari Updated Branches: refs/heads/branch-feature-AMBARI-14714 9c8ed58d1 -> 1e90bd576 AMBARI-14714. add new blueprint schema elements (magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/1e90bd57 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/1e90bd57 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/1e90bd57 Branch: refs/heads/branch-feature-AMBARI-14714 Commit: 1e90bd576a228bea77e4c41f110775af99083c73 Parents: 9c8ed58 Author: Sandor Magyari Authored: Fri Oct 6 18:27:31 2017 +0200 Committer: Sandor Magyari Committed: Fri Oct 6 18:29:06 2017 +0200 -- .../apache/ambari/server/topology/Service.java | 81 .../ambari/server/topology/ServiceGroup.java| 67 2 files changed, 148 insertions(+) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/1e90bd57/ambari-server/src/main/java/org/apache/ambari/server/topology/Service.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/Service.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/Service.java new file mode 100644 index 000..66c0dc3 --- /dev/null +++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/Service.java @@ -0,0 +1,81 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ambari.server.topology; + + +import org.apache.ambari.server.controller.internal.Stack; + +import java.util.Set; + +public class Service { + + private final String type; + + private final String name; + + private final Stack stack; + + private final Configuration configuration; + + private final Set dependentServices; + + public Service(String type, Stack stack) { +this(type, null, stack, null, null); + } + + /** + * In case there's no name specified name will be set to type. + * @param type + * @param name + * @param stack + * @param configuration + */ + public Service(String type, String name, Stack stack, Configuration configuration, Set dependentServices) { +this.type = type; +if (name == null) { + this.name = type; +} else { + this.name = name; +} +this.stack = stack; +this.configuration = configuration; +this.dependentServices = dependentServices; + } + + /** + * Gets the name of this service + * + * @return component name + */ + public String getName() { +return this.name; + } + + public String getType() { +return type; + } + + public Stack getStack() { +return stack; + } + + public Configuration getConfiguration() { +return configuration; + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/1e90bd57/ambari-server/src/main/java/org/apache/ambari/server/topology/ServiceGroup.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/ServiceGroup.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/ServiceGroup.java new file mode 100644 index 000..8e66f02 --- /dev/null +++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/ServiceGroup.java @@ -0,0 +1,67 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for
ambari git commit: AMBARI-14714. add new v2 interfaces for blueprint
Repository: ambari Updated Branches: refs/heads/branch-feature-AMBARI-14714 9306544e5 -> 9c8ed58d1 AMBARI-14714. add new v2 interfaces for blueprint Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/9c8ed58d Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/9c8ed58d Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/9c8ed58d Branch: refs/heads/branch-feature-AMBARI-14714 Commit: 9c8ed58d11a904392bebb89b42049eed10932a17 Parents: 9306544 Author: Sandor Magyari Authored: Fri Oct 6 18:20:28 2017 +0200 Committer: Sandor Magyari Committed: Fri Oct 6 18:21:47 2017 +0200 -- .../ambari/server/controller/StackV2.java | 816 +++ .../ambari/server/topology/BlueprintImplV2.java | 134 +++ .../ambari/server/topology/BlueprintV2.java | 179 .../ambari/server/topology/ComponentV2.java | 72 ++ .../ambari/server/topology/HostGroupV2.java | 124 +++ 5 files changed, 1325 insertions(+) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/9c8ed58d/ambari-server/src/main/java/org/apache/ambari/server/controller/StackV2.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/StackV2.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/StackV2.java new file mode 100644 index 000..3e34951 --- /dev/null +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/StackV2.java @@ -0,0 +1,816 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ambari.server.controller; + +import org.apache.ambari.server.AmbariException; +import org.apache.ambari.server.orm.entities.StackEntity; +import org.apache.ambari.server.state.*; +import org.apache.ambari.server.topology.Cardinality; +import org.apache.ambari.server.topology.Configuration; + +import java.util.*; + +/** + * Encapsulates stack information. + */ +public class StackV2 { + /** + * Stack name + */ + private String name; + + /** + * Stack version + */ + private String version; + +/** + * Repo version + */ + private String repoVersion; + + /** + * Map of service name to components + */ + private Map> serviceComponents = +new HashMap<>(); + + /** + * Map of component to service + */ + private Map componentService = new HashMap<>(); + + /** + * Map of component to dependencies + */ + private Map> dependencies = +new HashMap<>(); + + /** + * Map of dependency to conditional service + */ + private Map dependencyConditionalServiceMap = +new HashMap<>(); + + /** + * Map of database component name to configuration property which indicates whether + * the database in to be managed or if it is an external non-managed instance. + * If the value of the config property starts with 'New', the database is determined + * to be managed, otherwise it is non-managed. + */ + private Map dbDependencyInfo = new HashMap<>(); + + /** + * Map of component to required cardinality + */ + private Map cardinalityRequirements = new HashMap<>(); + + //todo: instead of all these maps from component -> * , + //todo: we should use a Component object with all of these attributes + private Set masterComponents = new HashSet<>(); + + /** + * Map of component to auto-deploy information + */ + private Map componentAutoDeployInfo = +new HashMap<>(); + + /** + * Map of service to config type properties + */ + private Map>> serviceConfigurations = +new HashMap<>(); + + /** + * Map of service to required type properties + */ + private Map>> requiredServiceConfigurations = +new HashMap<>(); + + /** + * Map of service to config type properties + */ + private Map> stackConfigurations = +new HashMap<>(); + + /** + * Map of service to set of excluded config types + */ + private Map> excludedConfigurationTypes = +new HashMap<>(); + + /** + * Ambari Management Controller, used to obtain Stack definitions + */ + priva
ambari git commit: AMBARI-14714. add new blueprint schema elements (magyari_sandor)
Repository: ambari Updated Branches: refs/heads/branch-feature-AMBARI-14714-blueprint [created] efc066ac3 AMBARI-14714. add new blueprint schema elements (magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/efc066ac Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/efc066ac Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/efc066ac Branch: refs/heads/branch-feature-AMBARI-14714-blueprint Commit: efc066ac396e0e90f9598bf56c3e9a172df08831 Parents: 530df16 Author: Sandor Magyari Authored: Tue Oct 3 22:34:36 2017 +0200 Committer: Sandor Magyari Committed: Tue Oct 3 22:34:36 2017 +0200 -- .../funtest/server/tests/DeleteServiceTest.java | 8 +- .../ambari/server/mpack/MpackManager.java | 32 .../ambari/server/topology/Blueprint.java | 13 +++- .../ambari/server/topology/BlueprintImpl.java | 61 +++ .../ambari/server/topology/Component.java | 19 - .../ambari/server/topology/HostGroup.java | 10 +-- .../ambari/server/topology/HostGroupImpl.java | 15 ++-- .../server/topology/RepositoryVersion.java | 42 ++ .../apache/ambari/server/topology/Service.java | 81 .../ambari/server/topology/ServiceGroup.java| 67 10 files changed, 274 insertions(+), 74 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/efc066ac/ambari-funtest/src/test/java/org/apache/ambari/funtest/server/tests/DeleteServiceTest.java -- diff --git a/ambari-funtest/src/test/java/org/apache/ambari/funtest/server/tests/DeleteServiceTest.java b/ambari-funtest/src/test/java/org/apache/ambari/funtest/server/tests/DeleteServiceTest.java index 1bfc6a2..97d0b4c 100644 --- a/ambari-funtest/src/test/java/org/apache/ambari/funtest/server/tests/DeleteServiceTest.java +++ b/ambari-funtest/src/test/java/org/apache/ambari/funtest/server/tests/DeleteServiceTest.java @@ -128,7 +128,7 @@ public class DeleteServiceTest extends ServerTestBase { List serviceDesiredStateEntities = serviceDesiredStateDAO.findAll(); assertEquals(serviceDesiredStateEntities.size(), 1); ServiceDesiredStateEntity serviceDesiredStateEntity = serviceDesiredStateEntities.get(0); -assertEquals(serviceDesiredStateEntity.getServiceName(), serviceName); + // assertEquals(serviceDesiredStateEntity.getServiceName(), serviceName); assertEquals(serviceDesiredStateEntity.getDesiredState(), State.INSTALLED); /** @@ -166,7 +166,7 @@ public class DeleteServiceTest extends ServerTestBase { /** * ClusterServiceDAO - the service entry should have been removed. */ -clusterServiceEntity = clusterServiceDAO.findByClusterAndServiceNames(clusterName, serviceName); + // clusterServiceEntity = clusterServiceDAO.findByClusterAndServiceNames(clusterName, serviceName); assertTrue(clusterServiceEntity == null); /** @@ -174,7 +174,7 @@ public class DeleteServiceTest extends ServerTestBase { */ ServiceDesiredStateEntityPK serviceDesiredStateEntityPK = injector.getInstance(ServiceDesiredStateEntityPK.class); serviceDesiredStateEntityPK.setClusterId(clusterId); -serviceDesiredStateEntityPK.setServiceName(serviceName); + // serviceDesiredStateEntityPK.setServiceName(serviceName); serviceDesiredStateEntity = serviceDesiredStateDAO.findByPK(serviceDesiredStateEntityPK); assertTrue(serviceDesiredStateEntity == null); @@ -187,7 +187,7 @@ public class DeleteServiceTest extends ServerTestBase { /** * HostComponentStateDAO */ -hostComponentStateEntities = hostComponentStateDAO.findByService(serviceName); + // hostComponentStateEntities = hostComponentStateDAO.findByService(serviceName); assertEquals(hostComponentStateEntities.size(), 0); http://git-wip-us.apache.org/repos/asf/ambari/blob/efc066ac/ambari-server/src/main/java/org/apache/ambari/server/mpack/MpackManager.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/mpack/MpackManager.java b/ambari-server/src/main/java/org/apache/ambari/server/mpack/MpackManager.java index 86c12ce..12070fa 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/mpack/MpackManager.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/mpack/MpackManager.java @@ -17,21 +17,9 @@ */ package org.apache.ambari.server.mpack; -import java.io.BufferedInputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.OutputStream
ambari git commit: AMBARI-22012. BP deploys failing intermittently with error (magyari_sandor)
Repository: ambari Updated Branches: refs/heads/branch-2.6 e09a3c8c2 -> 3b9db5cf1 AMBARI-22012. BP deploys failing intermittently with error (magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/3b9db5cf Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/3b9db5cf Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/3b9db5cf Branch: refs/heads/branch-2.6 Commit: 3b9db5cf16a8d950cc2229ecacf468dfb024e5b5 Parents: e09a3c8 Author: Sandor Magyari Authored: Fri Sep 22 17:48:54 2017 +0200 Committer: Sandor Magyari Committed: Mon Sep 25 21:32:17 2017 +0200 -- .../events/ClusterConfigFinishedEvent.java | 15 +++- .../ambari/server/topology/TopologyManager.java | 89 +--- .../topology/tasks/ConfigureClusterTask.java| 13 ++- .../tasks/ConfigureClusterTaskFactory.java | 3 +- .../server/utils/ManagedThreadPoolExecutor.java | 83 ++ .../ClusterDeployWithStartOnlyTest.java | 2 +- ...InstallWithoutStartOnComponentLevelTest.java | 2 +- .../ClusterInstallWithoutStartTest.java | 2 +- .../topology/ConfigureClusterTaskTest.java | 20 - .../utils/ManagedThreadPoolExecutorTest.java| 51 +++ 10 files changed, 238 insertions(+), 42 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/3b9db5cf/ambari-server/src/main/java/org/apache/ambari/server/events/ClusterConfigFinishedEvent.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/events/ClusterConfigFinishedEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/events/ClusterConfigFinishedEvent.java index f0cac72..32c75f4 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/events/ClusterConfigFinishedEvent.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/events/ClusterConfigFinishedEvent.java @@ -23,17 +23,27 @@ package org.apache.ambari.server.events; * cluster configuration is successfully updated. */ public class ClusterConfigFinishedEvent extends AmbariEvent { + + private final long clusterId; private final String clusterName; - public ClusterConfigFinishedEvent(String clusterName) { + public ClusterConfigFinishedEvent(long clusterId, String clusterName) { super(AmbariEventType.CLUSTER_CONFIG_FINISHED); +this.clusterId = clusterId; this.clusterName = clusterName; } /** + * Get the cluster id + * @return + */ + public long getClusterId() { +return clusterId; + } + + /** * Get the cluster name - * * @return */ public String getClusterName() { @@ -46,6 +56,7 @@ public class ClusterConfigFinishedEvent extends AmbariEvent { @Override public String toString() { StringBuilder buffer = new StringBuilder("ClusterConfigChangedEvent{"); +buffer.append("clusterId=").append(getClusterId()); buffer.append("clusterName=").append(getClusterName()); buffer.append("}"); return buffer.toString(); http://git-wip-us.apache.org/repos/asf/ambari/blob/3b9db5cf/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyManager.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyManager.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyManager.java index 140bcb6..3029fff 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyManager.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyManager.java @@ -29,9 +29,10 @@ import java.util.List; import java.util.Map; import java.util.Set; import java.util.concurrent.Callable; -import java.util.concurrent.Executor; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; +import java.util.concurrent.LinkedBlockingQueue; +import java.util.concurrent.TimeUnit; import javax.inject.Inject; @@ -75,6 +76,7 @@ import org.apache.ambari.server.state.quicklinksprofile.QuickLinksProfile; import org.apache.ambari.server.topology.tasks.ConfigureClusterTask; import org.apache.ambari.server.topology.tasks.ConfigureClusterTaskFactory; import org.apache.ambari.server.topology.validators.TopologyValidatorService; +import org.apache.ambari.server.utils.ManagedThreadPoolExecutor; import org.apache.ambari.server.utils.RetryHelper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -103,9 +105,23 @@ public class TopologyManager { private static final String CLUSTER_CONFIG_TASK_MAX_TIME_IN_MILLIS_PROPERTY_NAME = "cluster_configure_task_timeout"; private PersistedState persistedState; + + /**
ambari git commit: AMBARI-22012. BP deploys failing intermittently with error (magyari_sandor)
Repository: ambari Updated Branches: refs/heads/trunk 6633a7bd4 -> b653ee0a5 AMBARI-22012. BP deploys failing intermittently with error (magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/b653ee0a Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/b653ee0a Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/b653ee0a Branch: refs/heads/trunk Commit: b653ee0a5967a8255f087f43a1cb6a878e765833 Parents: 6633a7b Author: Sandor Magyari Authored: Fri Sep 22 17:48:54 2017 +0200 Committer: Sandor Magyari Committed: Mon Sep 25 21:19:53 2017 +0200 -- .../events/ClusterConfigFinishedEvent.java | 15 +++- .../ambari/server/topology/TopologyManager.java | 88 +--- .../topology/tasks/ConfigureClusterTask.java| 13 ++- .../tasks/ConfigureClusterTaskFactory.java | 3 +- .../server/utils/ManagedThreadPoolExecutor.java | 83 ++ .../ClusterDeployWithStartOnlyTest.java | 2 +- ...InstallWithoutStartOnComponentLevelTest.java | 2 +- .../ClusterInstallWithoutStartTest.java | 2 +- .../topology/ConfigureClusterTaskTest.java | 18 +++- .../utils/ManagedThreadPoolExecutorTest.java| 51 10 files changed, 236 insertions(+), 41 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/b653ee0a/ambari-server/src/main/java/org/apache/ambari/server/events/ClusterConfigFinishedEvent.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/events/ClusterConfigFinishedEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/events/ClusterConfigFinishedEvent.java index cdb86ac..f0574d0 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/events/ClusterConfigFinishedEvent.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/events/ClusterConfigFinishedEvent.java @@ -23,17 +23,27 @@ package org.apache.ambari.server.events; * cluster configuration is successfully updated. */ public class ClusterConfigFinishedEvent extends AmbariEvent { + + private final long clusterId; private final String clusterName; - public ClusterConfigFinishedEvent(String clusterName) { + public ClusterConfigFinishedEvent(long clusterId, String clusterName) { super(AmbariEventType.CLUSTER_CONFIG_FINISHED); +this.clusterId = clusterId; this.clusterName = clusterName; } /** + * Get the cluster id + * @return + */ + public long getClusterId() { +return clusterId; + } + + /** * Get the cluster name - * * @return */ public String getClusterName() { @@ -46,6 +56,7 @@ public class ClusterConfigFinishedEvent extends AmbariEvent { @Override public String toString() { StringBuilder buffer = new StringBuilder("ClusterConfigChangedEvent{"); +buffer.append("clusterId=").append(getClusterId()); buffer.append("clusterName=").append(getClusterName()); buffer.append("}"); return buffer.toString(); http://git-wip-us.apache.org/repos/asf/ambari/blob/b653ee0a/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyManager.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyManager.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyManager.java index 3af62e8..9769fae 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyManager.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyManager.java @@ -29,9 +29,10 @@ import java.util.List; import java.util.Map; import java.util.Set; import java.util.concurrent.Callable; -import java.util.concurrent.Executor; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; +import java.util.concurrent.LinkedBlockingQueue; +import java.util.concurrent.TimeUnit; import org.apache.ambari.server.AmbariException; import org.apache.ambari.server.actionmanager.HostRoleCommand; @@ -73,6 +74,7 @@ import org.apache.ambari.server.state.quicklinksprofile.QuickLinksProfile; import org.apache.ambari.server.topology.tasks.ConfigureClusterTask; import org.apache.ambari.server.topology.tasks.ConfigureClusterTaskFactory; import org.apache.ambari.server.topology.validators.TopologyValidatorService; +import org.apache.ambari.server.utils.ManagedThreadPoolExecutor; import org.apache.ambari.server.utils.RetryHelper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -102,9 +104,23 @@ public class TopologyManager { private static final String CLUSTER_CONFIG_TASK_MAX_TIME_IN_MILLIS_PROPERTY_NAME = "cluster_conf
ambari git commit: AMBARI-22022. NullPointerException in ActionScheduler when using DEPENDENCY_ORDERED execution (magyari_sandor)
Repository: ambari Updated Branches: refs/heads/trunk 1a5b4943c -> 3e5f60ab9 AMBARI-22022. NullPointerException in ActionScheduler when using DEPENDENCY_ORDERED execution (magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/3e5f60ab Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/3e5f60ab Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/3e5f60ab Branch: refs/heads/trunk Commit: 3e5f60ab9d30761df08923c4e56dd518fc71d271 Parents: 1a5b494 Author: Sandor Magyari Authored: Thu Sep 21 14:35:51 2017 +0200 Committer: Sandor Magyari Committed: Thu Sep 21 15:44:54 2017 +0200 -- .../ambari/server/actionmanager/ActionScheduler.java | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/3e5f60ab/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java index 00e4184..0157f8b 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java @@ -921,12 +921,14 @@ class ActionScheduler implements Runnable { RoleCommandPair roleCommand = new RoleCommandPair(Role.valueOf(command.getRole()), command.getRoleCommand()); Set roleCommandDependencies = rco.getDependencies().get(roleCommand); - // remove eventual references to the same RoleCommand - roleCommandDependencies.remove(roleCommand); // check if there are any dependencies IN_PROGRESS - if (roleCommandDependencies != null && CollectionUtils.containsAny(rolesCommandsInProgress, roleCommandDependencies)) { -areCommandDependenciesFinished = false; + if (roleCommandDependencies != null) { +// remove eventual references to the same RoleCommand +roleCommandDependencies.remove(roleCommand); +if (CollectionUtils.containsAny(rolesCommandsInProgress, roleCommandDependencies)) { + areCommandDependenciesFinished = false; +} } }
ambari git commit: AMBARI-22005. Add host through blueprint failed (magyari_sandor)
Repository: ambari Updated Branches: refs/heads/branch-2.6 68e010cbd -> 4924c697b AMBARI-22005. Add host through blueprint failed (magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/4924c697 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/4924c697 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/4924c697 Branch: refs/heads/branch-2.6 Commit: 4924c697bb8935f95ca106c175377251b18bc710 Parents: 68e010c Author: Sandor Magyari Authored: Wed Sep 20 13:49:34 2017 +0200 Committer: Sandor Magyari Committed: Thu Sep 21 14:00:32 2017 +0200 -- .../ambari/server/controller/internal/ScaleClusterRequest.java | 2 +- .../server/controller/internal/ScaleClusterRequestTest.java| 6 +++--- .../org/apache/ambari/server/topology/TopologyManagerTest.java | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/4924c697/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ScaleClusterRequest.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ScaleClusterRequest.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ScaleClusterRequest.java index f960490..ad90a25 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ScaleClusterRequest.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ScaleClusterRequest.java @@ -217,7 +217,7 @@ public class ScaleClusterRequest extends BaseClusterRequest { */ //todo: this was copied exactly from HostResourceProvider private String getHostNameFromProperties(Map properties) { -String hostName = (String) properties.get(HostResourceProvider.HOST_NAME_PROPERTY_ID); +String hostName = (String) properties.get(HostResourceProvider.HOST_HOST_NAME_PROPERTY_ID); return hostName; } http://git-wip-us.apache.org/repos/asf/ambari/blob/4924c697/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ScaleClusterRequestTest.java -- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ScaleClusterRequestTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ScaleClusterRequestTest.java index 7e042a4..b839557 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ScaleClusterRequestTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ScaleClusterRequestTest.java @@ -294,7 +294,7 @@ public class ScaleClusterRequestTest { public void test_NoHostNameOrHostCount() throws Exception { Map properties = createScaleClusterPropertiesGroup1_HostName(CLUSTER_NAME, BLUEPRINT_NAME); // remove host name -properties.remove("host_name"); +properties.remove("Hosts/host_name"); // reset default host resource provider expectations to none reset(hostResourceProvider); @@ -336,7 +336,7 @@ public class ScaleClusterRequestTest { properties.put(HostResourceProvider.HOST_CLUSTER_NAME_PROPERTY_ID, clusterName); properties.put(HostResourceProvider.BLUEPRINT_PROPERTY_ID, blueprintName); properties.put(HostResourceProvider.HOST_GROUP_PROPERTY_ID, GROUP1_NAME); -properties.put(HostResourceProvider.HOST_NAME_PROPERTY_ID, HOST1_NAME); +properties.put(HostResourceProvider.HOST_HOST_NAME_PROPERTY_ID, HOST1_NAME); return properties; } @@ -381,7 +381,7 @@ public class ScaleClusterRequestTest { properties.put(HostResourceProvider.HOST_CLUSTER_NAME_PROPERTY_ID, clusterName); properties.put(HostResourceProvider.BLUEPRINT_PROPERTY_ID, blueprintName); properties.put(HostResourceProvider.HOST_GROUP_PROPERTY_ID, GROUP1_NAME); -properties.put(HostResourceProvider.HOST_NAME_PROPERTY_ID, HOST2_NAME); +properties.put(HostResourceProvider.HOST_HOST_NAME_PROPERTY_ID, HOST2_NAME); return properties; } http://git-wip-us.apache.org/repos/asf/ambari/blob/4924c697/ambari-server/src/test/java/org/apache/ambari/server/topology/TopologyManagerTest.java -- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/topology/TopologyManagerTest.java b/ambari-server/src/test/java/org/apache/ambari/server/topology/TopologyManagerTest.java index 863fae1..025473e 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/topology/TopologyManagerTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/topology/TopologyManagerTest.java @@ -537,7 +537,7 @@ public class TopologyManag
ambari git commit: AMBARI-21864. DEPENDENCY_ORDERED stage execution hangs in case of circular dependencies between role commands (magyari_sandor)
Repository: ambari Updated Branches: refs/heads/trunk af647f81c -> c774475b9 AMBARI-21864. DEPENDENCY_ORDERED stage execution hangs in case of circular dependencies between role commands (magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/c774475b Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/c774475b Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/c774475b Branch: refs/heads/trunk Commit: c774475b9281b4b04a1135e46e576896c3992e46 Parents: af647f8 Author: Sandor Magyari Authored: Fri Sep 1 17:12:20 2017 +0200 Committer: Sandor Magyari Committed: Tue Sep 5 14:10:07 2017 +0200 -- .../server/actionmanager/ActionScheduler.java | 41 +++- .../actionmanager/TestActionScheduler.java | 104 +++ 2 files changed, 141 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/c774475b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java index 9a45d1f..00e4184 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java @@ -218,7 +218,6 @@ class ActionScheduler implements Runnable { /** * Unit Test Constructor. - * * @param sleepTimeMilliSec * @param actionTimeoutMilliSec * @param db @@ -229,14 +228,17 @@ class ActionScheduler implements Runnable { * @param unitOfWork * @param ambariEventPublisher * @param configuration + * @param entityManagerProvider * @param hostRoleCommandDAO * @param hostRoleCommandFactory + * @param roleCommandOrderProvider */ protected ActionScheduler(long sleepTimeMilliSec, long actionTimeoutMilliSec, ActionDBAccessor db, ActionQueue actionQueue, Clusters fsmObject, int maxAttempts, HostsMap hostsMap, UnitOfWork unitOfWork, AmbariEventPublisher ambariEventPublisher, Configuration configuration, Provider entityManagerProvider, -HostRoleCommandDAO hostRoleCommandDAO, HostRoleCommandFactory hostRoleCommandFactory) { +HostRoleCommandDAO hostRoleCommandDAO, HostRoleCommandFactory hostRoleCommandFactory, +RoleCommandOrderProvider roleCommandOrderProvider) { sleepTime = sleepTimeMilliSec; actionTimeout = actionTimeoutMilliSec; @@ -252,12 +254,40 @@ class ActionScheduler implements Runnable { this.hostRoleCommandDAO = hostRoleCommandDAO; this.hostRoleCommandFactory = hostRoleCommandFactory; jpaPublisher = null; +this.roleCommandOrderProvider = roleCommandOrderProvider; serverActionExecutor = new ServerActionExecutor(db, sleepTime); initializeCaches(); } /** + * Unit Test Constructor. + * + * @param sleepTimeMilliSec + * @param actionTimeoutMilliSec + * @param db + * @param actionQueue + * @param fsmObject + * @param maxAttempts + * @param hostsMap + * @param unitOfWork + * @param ambariEventPublisher + * @param configuration + * @param hostRoleCommandDAO + * @param hostRoleCommandFactory + */ + protected ActionScheduler(long sleepTimeMilliSec, long actionTimeoutMilliSec, ActionDBAccessor db, +ActionQueue actionQueue, Clusters fsmObject, int maxAttempts, HostsMap hostsMap, +UnitOfWork unitOfWork, AmbariEventPublisher ambariEventPublisher, +Configuration configuration, Provider entityManagerProvider, +HostRoleCommandDAO hostRoleCommandDAO, HostRoleCommandFactory hostRoleCommandFactory) { + +this(sleepTimeMilliSec, actionTimeoutMilliSec, db, actionQueue, fsmObject, maxAttempts, hostsMap, unitOfWork, +ambariEventPublisher, configuration, entityManagerProvider, hostRoleCommandDAO, hostRoleCommandFactory, +null); + } + + /** * Initializes the caches. */ private void initializeCaches() { @@ -888,8 +918,11 @@ class ActionScheduler implements Runnable { boolean areCommandDependenciesFinished = true; RoleCommandOrder rco = roleCommandOrderProvider.getRoleCommandOrder(stage.getClusterId()); if (rco != null) { - Set roleCommandDependencies = rco.getDependencies().get(new -RoleCommandPair(Role.valueOf(command.getRole()), command.getRoleCommand())); + RoleCommandPair roleCommand =
ambari git commit: AMBARI-21749. Remove DB consistency check for topology tables (magyari_sandor)
Repository: ambari Updated Branches: refs/heads/trunk 1dba7786f -> 5f6ce4ea5 AMBARI-21749. Remove DB consistency check for topology tables (magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/5f6ce4ea Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/5f6ce4ea Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/5f6ce4ea Branch: refs/heads/trunk Commit: 5f6ce4ea53bcaaec35040c08600d606d7d194460 Parents: 1dba778 Author: Sandor Magyari Authored: Fri Aug 18 13:13:29 2017 +0200 Committer: Sandor Magyari Committed: Fri Aug 18 15:45:14 2017 +0200 -- .../checks/DatabaseConsistencyCheckHelper.java | 62 --- .../server/topology/PersistedStateImpl.java | 23 +++ .../DatabaseConsistencyCheckHelperTest.java | 63 3 files changed, 13 insertions(+), 135 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/5f6ce4ea/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java index 66baf8e..aae34ae 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java @@ -182,7 +182,6 @@ public class DatabaseConsistencyCheckHelper { checkForHostsWithoutState(); checkHostComponentStates(); checkServiceConfigs(); - checkTopologyTables(); checkForLargeTables(); LOG.info("*** Check database completed ***"); return checkResult; @@ -446,67 +445,6 @@ public class DatabaseConsistencyCheckHelper { } } - - /** - * This method checks that for each row in topology_request there is at least one row in topology_logical_request, - * topology_host_request, topology_host_task, topology_logical_task. - * */ - static void checkTopologyTables() { -LOG.info("Checking Topology tables"); - -String SELECT_REQUEST_COUNT_QUERY = "select count(tpr.id) from topology_request tpr"; - -String SELECT_JOINED_COUNT_QUERY = "select count(DISTINCT tpr.id) from topology_request tpr join " + - "topology_logical_request tlr on tpr.id = tlr.request_id"; - -String SELECT_HOST_REQUEST_COUNT_QUERY = "select count(thr.id) from topology_host_request thr"; - -String SELECT_HOST_JOINED_COUNT_QUERY = "select count(DISTINCT thr.id) from topology_host_request thr join " + -"topology_host_task tht on thr.id = tht.host_request_id join topology_logical_task " + -"tlt on tht.id = tlt.host_task_id"; - -Statement statement = null; - -if (connection == null) { - if (dbAccessor == null) { -dbAccessor = injector.getInstance(DBAccessor.class); - } - connection = dbAccessor.getConnection(); -} - -try { - statement = connection.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); - - int topologyRequestCount = runQuery(statement, SELECT_REQUEST_COUNT_QUERY); - int topologyRequestTablesJoinedCount = runQuery(statement, SELECT_JOINED_COUNT_QUERY); - - if (topologyRequestCount != topologyRequestTablesJoinedCount) { -error("Your topology request hierarchy is not complete for each row in topology_request should exist " + - "at least one row in topology_logical_request"); - } - - int topologyHostRequestCount = runQuery(statement, SELECT_HOST_REQUEST_COUNT_QUERY); - int topologyHostRequestTablesJoinedCount = runQuery(statement, SELECT_HOST_JOINED_COUNT_QUERY); - - if (topologyHostRequestCount != topologyHostRequestTablesJoinedCount) { -error("Your topology request hierarchy is not complete for each row in topology_host_request should exist " + -"at least one row in topology_host_task, topology_logical_task."); - } - -} catch (SQLException e) { - LOG.error("Exception occurred during topology request tables check: ", e); -} finally { - if (statement != null) { -try { - statement.close(); -} catch (SQLException e) { - LOG.error("Exception occurred during statement closing procedure: ", e); -} - } -} - - } - private static int runQuery(Statement statement, String query) { ResultSet r
ambari git commit: AMBARI-21749. Remove DB consistency check for topology tables (magyari_sandor)
Repository: ambari Updated Branches: refs/heads/branch-2.5 da9ea1cfb -> 5c09d0760 AMBARI-21749. Remove DB consistency check for topology tables (magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/5c09d076 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/5c09d076 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/5c09d076 Branch: refs/heads/branch-2.5 Commit: 5c09d0760eb62ff18f120b0688ff4eb7e9b63227 Parents: da9ea1c Author: Sandor Magyari Authored: Fri Aug 18 13:13:29 2017 +0200 Committer: Sandor Magyari Committed: Fri Aug 18 15:37:15 2017 +0200 -- .../checks/DatabaseConsistencyCheckHelper.java | 62 --- .../server/topology/PersistedStateImpl.java | 23 +++ .../DatabaseConsistencyCheckHelperTest.java | 63 3 files changed, 13 insertions(+), 135 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/5c09d076/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java index 533fad7..d59e676 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java @@ -187,7 +187,6 @@ public class DatabaseConsistencyCheckHelper { checkForHostsWithoutState(); checkHostComponentStatesCountEqualsHostComponentsDesiredStates(); checkServiceConfigs(); - checkTopologyTables(); checkForLargeTables(); checkConfigGroupHostMapping(true); LOG.info("*** Check database completed ***"); @@ -493,67 +492,6 @@ public class DatabaseConsistencyCheckHelper { } } - - /** - * This method checks that for each row in topology_request there is at least one row in topology_logical_request, - * topology_host_request, topology_host_task, topology_logical_task. - * */ - static void checkTopologyTables() { -LOG.info("Checking Topology tables"); - -String SELECT_REQUEST_COUNT_QUERY = "select count(tpr.id) from topology_request tpr"; - -String SELECT_JOINED_COUNT_QUERY = "select count(DISTINCT tpr.id) from topology_request tpr join " + - "topology_logical_request tlr on tpr.id = tlr.request_id"; - -String SELECT_HOST_REQUEST_COUNT_QUERY = "select count(thr.id) from topology_host_request thr"; - -String SELECT_HOST_JOINED_COUNT_QUERY = "select count(DISTINCT thr.id) from topology_host_request thr join " + -"topology_host_task tht on thr.id = tht.host_request_id join topology_logical_task " + -"tlt on tht.id = tlt.host_task_id"; - -Statement statement = null; - -if (connection == null) { - if (dbAccessor == null) { -dbAccessor = injector.getInstance(DBAccessor.class); - } - connection = dbAccessor.getConnection(); -} - -try { - statement = connection.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); - - int topologyRequestCount = runQuery(statement, SELECT_REQUEST_COUNT_QUERY); - int topologyRequestTablesJoinedCount = runQuery(statement, SELECT_JOINED_COUNT_QUERY); - - if (topologyRequestCount != topologyRequestTablesJoinedCount) { -error("Your topology request hierarchy is not complete for each row in topology_request should exist " + - "at least one row in topology_logical_request"); - } - - int topologyHostRequestCount = runQuery(statement, SELECT_HOST_REQUEST_COUNT_QUERY); - int topologyHostRequestTablesJoinedCount = runQuery(statement, SELECT_HOST_JOINED_COUNT_QUERY); - - if (topologyHostRequestCount != topologyHostRequestTablesJoinedCount) { -error("Your topology request hierarchy is not complete for each row in topology_host_request should exist " + -"at least one row in topology_host_task, topology_logical_task."); - } - -} catch (SQLException e) { - LOG.error("Exception occurred during topology request tables check: ", e); -} finally { - if (statement != null) { -try { - statement.close(); -} catch (SQLException e) { - LOG.error("Exception occurred during statement closing procedure: ", e); -} - } -} - - } - private static int
ambari git commit: AMBARI-21347. Service Page: Some Alerts are missing their Status (magyari_sandor)
Repository: ambari Updated Branches: refs/heads/branch-2.5 4b5e2137e -> dd250992a AMBARI-21347. Service Page: Some Alerts are missing their Status (magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/dd250992 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/dd250992 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/dd250992 Branch: refs/heads/branch-2.5 Commit: dd250992acd3c541f325ab0c30673bfc49176fda Parents: 4b5e213 Author: Sandor Magyari Authored: Mon Jun 26 20:01:59 2017 +0200 Committer: Sandor Magyari Committed: Tue Jun 27 12:21:29 2017 +0200 -- .../controller/AmbariManagementControllerImpl.java | 12 +++- 1 file changed, 11 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/dd250992/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java index 1db9bc9..827c785 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java @@ -187,6 +187,7 @@ import org.apache.ambari.server.state.StackInfo; import org.apache.ambari.server.state.State; import org.apache.ambari.server.state.UnlimitedKeyJCERequirement; import org.apache.ambari.server.state.configgroup.ConfigGroupFactory; +import org.apache.ambari.server.state.fsm.InvalidStateTransitionException; import org.apache.ambari.server.state.quicklinksprofile.QuickLinkVisibilityController; import org.apache.ambari.server.state.quicklinksprofile.QuickLinkVisibilityControllerFactory; import org.apache.ambari.server.state.quicklinksprofile.QuickLinksProfile; @@ -198,6 +199,7 @@ import org.apache.ambari.server.state.stack.WidgetLayout; import org.apache.ambari.server.state.stack.WidgetLayoutInfo; import org.apache.ambari.server.state.svccomphost.ServiceComponentHostInstallEvent; import org.apache.ambari.server.state.svccomphost.ServiceComponentHostOpInProgressEvent; +import org.apache.ambari.server.state.svccomphost.ServiceComponentHostOpSucceededEvent; import org.apache.ambari.server.state.svccomphost.ServiceComponentHostStartEvent; import org.apache.ambari.server.state.svccomphost.ServiceComponentHostStopEvent; import org.apache.ambari.server.state.svccomphost.ServiceComponentHostUpgradeEvent; @@ -3062,7 +3064,15 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle // START task should run configuration script. if (newState == State.INSTALLED && skipInstallTaskForComponent(requestProperties, cluster, scHost)) { LOG.info("Skipping create of INSTALL task for {} on {}.", scHost.getServiceComponentName(), scHost.getHostName()); - scHost.setState(State.INSTALLED); + // set state to INSTALLING, then immediately send an ServiceComponentHostOpSucceededEvent to allow + // transitioning from INSTALLING --> INSTALLED. + scHost.setState(State.INSTALLING); + long now = System.currentTimeMillis(); + try { +scHost.handleEvent(new ServiceComponentHostOpSucceededEvent(scHost.getServiceComponentName(), scHost.getHostName(), now)); + } catch (InvalidStateTransitionException e) { +LOG.error("Error transitioning ServiceComponentHost state to INSTALLED", e); + } } else { createHostAction(cluster, stage, scHost, configurations, configurationAttributes, configTags, roleCommand, requestParameters, event, skipFailure, effectiveClusterVersion, isUpgradeSuspended,
ambari git commit: AMBARI-21347. Service Page: Some Alerts are missing their Status (magyari_sandor)
Repository: ambari Updated Branches: refs/heads/trunk 08dd492e5 -> 9833bc182 AMBARI-21347. Service Page: Some Alerts are missing their Status (magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/9833bc18 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/9833bc18 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/9833bc18 Branch: refs/heads/trunk Commit: 9833bc182d9b44a69bb766de77311d4a3a50fa5e Parents: 08dd492 Author: Sandor Magyari Authored: Mon Jun 26 20:01:59 2017 +0200 Committer: Sandor Magyari Committed: Tue Jun 27 11:15:03 2017 +0200 -- .../controller/AmbariManagementControllerImpl.java | 12 +++- 1 file changed, 11 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/9833bc18/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java index ed707e7..6781f65 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java @@ -182,6 +182,7 @@ import org.apache.ambari.server.state.StackInfo; import org.apache.ambari.server.state.State; import org.apache.ambari.server.state.UnlimitedKeyJCERequirement; import org.apache.ambari.server.state.configgroup.ConfigGroupFactory; +import org.apache.ambari.server.state.fsm.InvalidStateTransitionException; import org.apache.ambari.server.state.quicklinksprofile.QuickLinkVisibilityController; import org.apache.ambari.server.state.quicklinksprofile.QuickLinkVisibilityControllerFactory; import org.apache.ambari.server.state.quicklinksprofile.QuickLinksProfile; @@ -193,6 +194,7 @@ import org.apache.ambari.server.state.stack.WidgetLayout; import org.apache.ambari.server.state.stack.WidgetLayoutInfo; import org.apache.ambari.server.state.svccomphost.ServiceComponentHostInstallEvent; import org.apache.ambari.server.state.svccomphost.ServiceComponentHostOpInProgressEvent; +import org.apache.ambari.server.state.svccomphost.ServiceComponentHostOpSucceededEvent; import org.apache.ambari.server.state.svccomphost.ServiceComponentHostStartEvent; import org.apache.ambari.server.state.svccomphost.ServiceComponentHostStopEvent; import org.apache.ambari.server.state.svccomphost.ServiceComponentHostUpgradeEvent; @@ -3023,7 +3025,15 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle // START task should run configuration script. if (newState == State.INSTALLED && skipInstallTaskForComponent(requestProperties, cluster, scHost)) { LOG.info("Skipping create of INSTALL task for {} on {}.", scHost.getServiceComponentName(), scHost.getHostName()); - scHost.setState(State.INSTALLED); + // set state to INSTALLING, then immediately send an ServiceComponentHostOpSucceededEvent to allow + // transitioning from INSTALLING --> INSTALLED. + scHost.setState(State.INSTALLING); + long now = System.currentTimeMillis(); + try { +scHost.handleEvent(new ServiceComponentHostOpSucceededEvent(scHost.getServiceComponentName(), scHost.getHostName(), now)); + } catch (InvalidStateTransitionException e) { +LOG.error("Error transitioning ServiceComponentHost state to INSTALLED", e); + } } else { // !!! can never be null RepositoryVersionEntity repoVersion = serviceComponent.getDesiredRepositoryVersion();
ambari git commit: AMBARI-21229. Logical Request: Provision Cluster API request status updated as COMPLETED as soon as BP deploy starts (magyari_sandor)
Repository: ambari Updated Branches: refs/heads/branch-2.5 d1a2c5751 -> 6726e67ac AMBARI-21229. Logical Request: Provision Cluster API request status updated as COMPLETED as soon as BP deploy starts (magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/6726e67a Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/6726e67a Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/6726e67a Branch: refs/heads/branch-2.5 Commit: 6726e67ac85282f52057c3b3a4010bd3b7c34ac7 Parents: d1a2c57 Author: Sandor Magyari Authored: Mon Jun 12 15:34:41 2017 +0200 Committer: Sandor Magyari Committed: Fri Jun 16 22:04:21 2017 +0200 -- .../controller/internal/RequestResourceProvider.java| 12 +++- .../apache/ambari/server/topology/LogicalRequest.java | 2 +- .../internal/RequestResourceProviderTest.java | 11 --- 3 files changed, 16 insertions(+), 9 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/6726e67a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RequestResourceProvider.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RequestResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RequestResourceProvider.java index 9cb994d..b4b26ce 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RequestResourceProvider.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RequestResourceProvider.java @@ -794,13 +794,15 @@ public class RequestResourceProvider extends AbstractControllerResourceProvider final CalculatedStatus status; LogicalRequest logicalRequest = topologyManager.getRequest(entity.getRequestId()); if (summary.isEmpty() && null != logicalRequest) { - // in this case, it appears that there are no tasks but this is a logical + // In this case, it appears that there are no tasks but this is a logical // topology request, so it's a matter of hosts simply not registering yet - // for tasks to be created - if (logicalRequest.hasPendingHostRequests()) { -status = CalculatedStatus.PENDING; - } else { + // for tasks to be created ==> status = PENDING. + // For a new LogicalRequest there should be at least one HostRequest, + // while if they were removed already ==> status = COMPLETED. + if (logicalRequest.getHostRequests().isEmpty()) { status = CalculatedStatus.COMPLETED; + } else { +status = CalculatedStatus.PENDING; } } else { // there are either tasks or this is not a logical request, so do normal http://git-wip-us.apache.org/repos/asf/ambari/blob/6726e67a/ambari-server/src/main/java/org/apache/ambari/server/topology/LogicalRequest.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/LogicalRequest.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/LogicalRequest.java index eb1c343..6b3af55 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/topology/LogicalRequest.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/LogicalRequest.java @@ -165,7 +165,7 @@ public class LogicalRequest extends Request { } public boolean hasPendingHostRequests() { -return !requestsWithReservedHosts.isEmpty() || !outstandingHostRequests.isEmpty(); +return !(requestsWithReservedHosts.isEmpty() && outstandingHostRequests.isEmpty()); } public Collection getCompletedHostRequests() { http://git-wip-us.apache.org/repos/asf/ambari/blob/6726e67a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RequestResourceProviderTest.java -- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RequestResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RequestResourceProviderTest.java index 6a6c007..590df04a 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RequestResourceProviderTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RequestResourceProviderTest.java @@ -32,6 +32,7 @@ import static org.powermock.api.easymock.PowerMock.reset; import static org.powermock.api.easymock.PowerMock.verify; import java.lang.reflect.Field; +import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Collect
ambari git commit: AMBARI-21229. Logical Request: Provision Cluster API request status updated as COMPLETED as soon as BP deploy starts (magyari_sandor)
Repository: ambari Updated Branches: refs/heads/trunk eb17e4c69 -> 8f2663b2e AMBARI-21229. Logical Request: Provision Cluster API request status updated as COMPLETED as soon as BP deploy starts (magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/8f2663b2 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/8f2663b2 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/8f2663b2 Branch: refs/heads/trunk Commit: 8f2663b2e6d543c75433359cb800a565e90f492e Parents: eb17e4c Author: Sandor Magyari Authored: Mon Jun 12 15:34:41 2017 +0200 Committer: Sandor Magyari Committed: Fri Jun 16 22:02:09 2017 +0200 -- .../controller/internal/RequestResourceProvider.java| 12 +++- .../apache/ambari/server/topology/LogicalRequest.java | 2 +- .../internal/RequestResourceProviderTest.java | 11 --- 3 files changed, 16 insertions(+), 9 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/8f2663b2/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RequestResourceProvider.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RequestResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RequestResourceProvider.java index deb0d7c..a8f7638 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RequestResourceProvider.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RequestResourceProvider.java @@ -794,13 +794,15 @@ public class RequestResourceProvider extends AbstractControllerResourceProvider final CalculatedStatus status; LogicalRequest logicalRequest = topologyManager.getRequest(entity.getRequestId()); if (summary.isEmpty() && null != logicalRequest) { - // in this case, it appears that there are no tasks but this is a logical + // In this case, it appears that there are no tasks but this is a logical // topology request, so it's a matter of hosts simply not registering yet - // for tasks to be created - if (logicalRequest.hasPendingHostRequests()) { -status = CalculatedStatus.PENDING; - } else { + // for tasks to be created ==> status = PENDING. + // For a new LogicalRequest there should be at least one HostRequest, + // while if they were removed already ==> status = COMPLETED. + if (logicalRequest.getHostRequests().isEmpty()) { status = CalculatedStatus.COMPLETED; + } else { +status = CalculatedStatus.PENDING; } } else { // there are either tasks or this is not a logical request, so do normal http://git-wip-us.apache.org/repos/asf/ambari/blob/8f2663b2/ambari-server/src/main/java/org/apache/ambari/server/topology/LogicalRequest.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/LogicalRequest.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/LogicalRequest.java index b5ee94b..4638dbf 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/topology/LogicalRequest.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/LogicalRequest.java @@ -165,7 +165,7 @@ public class LogicalRequest extends Request { } public boolean hasPendingHostRequests() { -return !requestsWithReservedHosts.isEmpty() || !outstandingHostRequests.isEmpty(); +return !(requestsWithReservedHosts.isEmpty() && outstandingHostRequests.isEmpty()); } public Collection getCompletedHostRequests() { http://git-wip-us.apache.org/repos/asf/ambari/blob/8f2663b2/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RequestResourceProviderTest.java -- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RequestResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RequestResourceProviderTest.java index 6bc856d..d243e73 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RequestResourceProviderTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RequestResourceProviderTest.java @@ -32,6 +32,7 @@ import static org.powermock.api.easymock.PowerMock.reset; import static org.powermock.api.easymock.PowerMock.verify; import java.lang.reflect.Field; +import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Collect
ambari git commit: AMBARI-21168. Deleting host from cluster leaves Ambari in inconsistent state (intermittently) (magyari_sandor)
Repository: ambari Updated Branches: refs/heads/branch-2.5 54ce6cca4 -> 9ed6d843e AMBARI-21168. Deleting host from cluster leaves Ambari in inconsistent state (intermittently) (magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/9ed6d843 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/9ed6d843 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/9ed6d843 Branch: refs/heads/branch-2.5 Commit: 9ed6d843e929c37314560200555bbab48cc02e2b Parents: 54ce6cc Author: Sandor Magyari Authored: Fri Jun 2 15:38:06 2017 +0200 Committer: Sandor Magyari Committed: Tue Jun 6 15:31:47 2017 +0200 -- .../server/state/svccomphost/ServiceComponentHostImpl.java | 5 + 1 file changed, 5 insertions(+) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/9ed6d843/ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java index 4d034f6..0ff4dad 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java @@ -862,6 +862,7 @@ public class ServiceComponentHostImpl implements ServiceComponentHost { } @Override + @Transactional public void setState(State state) { stateMachine.setCurrentState(state); HostComponentStateEntity stateEntity = getStateEntity(); @@ -890,6 +891,7 @@ public class ServiceComponentHostImpl implements ServiceComponentHost { } @Override + @Transactional public void setVersion(String version) { HostComponentStateEntity stateEntity = getStateEntity(); if (stateEntity != null) { @@ -917,6 +919,7 @@ public class ServiceComponentHostImpl implements ServiceComponentHost { } @Override + @Transactional public void setSecurityState(SecurityState securityState) { HostComponentStateEntity stateEntity = getStateEntity(); if (stateEntity != null) { @@ -966,6 +969,7 @@ public class ServiceComponentHostImpl implements ServiceComponentHost { * @param upgradeState the upgrade state */ @Override + @Transactional public void setUpgradeState(UpgradeState upgradeState) { HostComponentStateEntity stateEntity = getStateEntity(); if (stateEntity != null) { @@ -994,6 +998,7 @@ public class ServiceComponentHostImpl implements ServiceComponentHost { @Override + @Transactional public void handleEvent(ServiceComponentHostEvent event) throws InvalidStateTransitionException { if (LOG.isDebugEnabled()) {
ambari git commit: AMBARI-21168. Deleting host from cluster leaves Ambari in inconsistent state (intermittently) (magyari_sandor)
Repository: ambari Updated Branches: refs/heads/trunk 0dd9fbf34 -> d8d586888 AMBARI-21168. Deleting host from cluster leaves Ambari in inconsistent state (intermittently) (magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/d8d58688 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/d8d58688 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/d8d58688 Branch: refs/heads/trunk Commit: d8d586888d415d1c429ff6514e5b8435f6cb7e47 Parents: 0dd9fbf Author: Sandor Magyari Authored: Fri Jun 2 15:38:06 2017 +0200 Committer: Sandor Magyari Committed: Tue Jun 6 13:08:33 2017 +0200 -- .../server/state/svccomphost/ServiceComponentHostImpl.java | 5 + 1 file changed, 5 insertions(+) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/d8d58688/ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java index bb51733..9704dc5 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java @@ -871,6 +871,7 @@ public class ServiceComponentHostImpl implements ServiceComponentHost { } @Override + @Transactional public void setState(State state) { stateMachine.setCurrentState(state); HostComponentStateEntity stateEntity = getStateEntity(); @@ -899,6 +900,7 @@ public class ServiceComponentHostImpl implements ServiceComponentHost { } @Override + @Transactional public void setVersion(String version) { HostComponentStateEntity stateEntity = getStateEntity(); if (stateEntity != null) { @@ -926,6 +928,7 @@ public class ServiceComponentHostImpl implements ServiceComponentHost { } @Override + @Transactional public void setSecurityState(SecurityState securityState) { HostComponentStateEntity stateEntity = getStateEntity(); if (stateEntity != null) { @@ -975,6 +978,7 @@ public class ServiceComponentHostImpl implements ServiceComponentHost { * @param upgradeState the upgrade state */ @Override + @Transactional public void setUpgradeState(UpgradeState upgradeState) { HostComponentStateEntity stateEntity = getStateEntity(); if (stateEntity != null) { @@ -1003,6 +1007,7 @@ public class ServiceComponentHostImpl implements ServiceComponentHost { @Override + @Transactional public void handleEvent(ServiceComponentHostEvent event) throws InvalidStateTransitionException { if (LOG.isDebugEnabled()) {
ambari git commit: AMBARI-21067. Atlas config values not getting populated on BP cluster install with strategy : NEVER_APPLY (magyari_sandor)
Repository: ambari Updated Branches: refs/heads/branch-2.5 b958ffa39 -> fa9a0af4a AMBARI-21067. Atlas config values not getting populated on BP cluster install with strategy : NEVER_APPLY (magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/fa9a0af4 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/fa9a0af4 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/fa9a0af4 Branch: refs/heads/branch-2.5 Commit: fa9a0af4af6280814e36354b4b13d930239f5db7 Parents: b958ffa Author: Sandor Magyari Authored: Fri May 19 09:06:24 2017 +0200 Committer: Sandor Magyari Committed: Mon May 22 15:21:51 2017 +0200 -- .../0.7.0.2.5/configuration/application-properties.xml| 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/fa9a0af4/ambari-server/src/main/resources/common-services/ATLAS/0.7.0.2.5/configuration/application-properties.xml -- diff --git a/ambari-server/src/main/resources/common-services/ATLAS/0.7.0.2.5/configuration/application-properties.xml b/ambari-server/src/main/resources/common-services/ATLAS/0.7.0.2.5/configuration/application-properties.xml index 70af02c..f34d8be 100644 --- a/ambari-server/src/main/resources/common-services/ATLAS/0.7.0.2.5/configuration/application-properties.xml +++ b/ambari-server/src/main/resources/common-services/ATLAS/0.7.0.2.5/configuration/application-properties.xml @@ -24,7 +24,7 @@ atlas.audit.hbase.zookeeper.quorum - +localhost @@ -38,7 +38,7 @@ atlas.graph.storage.hostname - +localhost @@ -66,7 +66,7 @@ atlas.graph.index.search.solr.zookeeper-url - +localhost:2181/infra-solr The ZooKeeper quorum setup for Solr as comma separated value. @@ -145,7 +145,7 @@ atlas.kafka.bootstrap.servers - +localhost:6667 Comma separated list of Kafka broker endpoints in host:port form @@ -157,7 +157,7 @@ atlas.kafka.zookeeper.connect - +localhost:2181 Comma separated list of servers forming Zookeeper quorum used by Kafka.
ambari git commit: AMBARI-21067. Atlas config values not getting populated on BP cluster install with strategy : NEVER_APPLY (magyari_sandor)
Repository: ambari Updated Branches: refs/heads/trunk fd4a7a46a -> 74972de55 AMBARI-21067. Atlas config values not getting populated on BP cluster install with strategy : NEVER_APPLY (magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/74972de5 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/74972de5 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/74972de5 Branch: refs/heads/trunk Commit: 74972de559b21633288c03785dc672e792a172bb Parents: fd4a7a4 Author: Sandor Magyari Authored: Fri May 19 09:06:24 2017 +0200 Committer: Sandor Magyari Committed: Mon May 22 14:27:38 2017 +0200 -- .../0.7.0.2.5/configuration/application-properties.xml| 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/74972de5/ambari-server/src/main/resources/common-services/ATLAS/0.7.0.2.5/configuration/application-properties.xml -- diff --git a/ambari-server/src/main/resources/common-services/ATLAS/0.7.0.2.5/configuration/application-properties.xml b/ambari-server/src/main/resources/common-services/ATLAS/0.7.0.2.5/configuration/application-properties.xml index 70af02c..f34d8be 100644 --- a/ambari-server/src/main/resources/common-services/ATLAS/0.7.0.2.5/configuration/application-properties.xml +++ b/ambari-server/src/main/resources/common-services/ATLAS/0.7.0.2.5/configuration/application-properties.xml @@ -24,7 +24,7 @@ atlas.audit.hbase.zookeeper.quorum - +localhost @@ -38,7 +38,7 @@ atlas.graph.storage.hostname - +localhost @@ -66,7 +66,7 @@ atlas.graph.index.search.solr.zookeeper-url - +localhost:2181/infra-solr The ZooKeeper quorum setup for Solr as comma separated value. @@ -145,7 +145,7 @@ atlas.kafka.bootstrap.servers - +localhost:6667 Comma separated list of Kafka broker endpoints in host:port form @@ -157,7 +157,7 @@ atlas.kafka.zookeeper.connect - +localhost:2181 Comma separated list of servers forming Zookeeper quorum used by Kafka.
ambari git commit: AMBARI-21025. Avoid unnecessary calls to load stage summaries (magyari_sandor)
Repository: ambari Updated Branches: refs/heads/branch-2.5 d1f2bf4f7 -> d1a7c7c07 AMBARI-21025. Avoid unnecessary calls to load stage summaries (magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/d1a7c7c0 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/d1a7c7c0 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/d1a7c7c0 Branch: refs/heads/branch-2.5 Commit: d1a7c7c07758b1a5fbd838aa912d0d7f312843d7 Parents: d1f2bf4 Author: Sandor Magyari Authored: Wed May 10 16:22:07 2017 +0200 Committer: Sandor Magyari Committed: Tue May 16 14:48:19 2017 +0200 -- .../internal/StageResourceProvider.java | 76 +++- 1 file changed, 10 insertions(+), 66 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/d1a7c7c0/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StageResourceProvider.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StageResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StageResourceProvider.java index 5dcd799..03e604e 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StageResourceProvider.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StageResourceProvider.java @@ -210,8 +210,7 @@ public class StageResourceProvider extends AbstractControllerResourceProvider im // !!! poor mans cache. toResource() shouldn't be calling the db // every time, when the request id is likely the same for each stageEntity -Map> cache = -new HashMap>(); +Map> cache = new HashMap<>(); List entities = dao.findAll(request, predicate); for (StageEntity entity : entities) { @@ -231,8 +230,11 @@ public class StageResourceProvider extends AbstractControllerResourceProvider im if (null != lr) { Collection topologyManagerStages = lr.getStageEntities(); +// preload summaries as it contains summaries for all stages within this request +Map summary = topologyManager.getStageSummaries(requestId); +cache.put(requestId, summary); for (StageEntity entity : topologyManagerStages) { - Resource stageResource = toResource(entity, propertyIds); + Resource stageResource = toResource(cache, entity, propertyIds); if (predicate.evaluate(stageResource)) { results.add(stageResource); } @@ -241,7 +243,11 @@ public class StageResourceProvider extends AbstractControllerResourceProvider im } else { Collection topologyManagerStages = topologyManager.getStages(); for (StageEntity entity : topologyManagerStages) { -Resource stageResource = toResource(entity, propertyIds); +if (!cache.containsKey(entity.getRequestId())) { + Map summary = topologyManager.getStageSummaries(entity.getRequestId()); + cache.put(entity.getRequestId(), summary); +} +Resource stageResource = toResource(cache, entity, propertyIds); if (predicate.evaluate(stageResource)) { results.add(stageResource); } @@ -345,66 +351,4 @@ public class StageResourceProvider extends AbstractControllerResourceProvider im return resource; } - /** - * Converts the {@link StageEntity} to a {@link Resource}. - * - * @param entitythe entity to convert (not {@code null}) - * @param requestedIds the properties requested (not {@code null}) - * - * @return the new resource - */ - //todo: almost exactly the same as other toResource except how summaries are obtained - //todo: refactor to combine the two with the summary logic extracted - private Resource toResource(StageEntity entity, Set requestedIds) { - -Resource resource = new ResourceImpl(Resource.Type.Stage); - -Long clusterId = entity.getClusterId(); -if (clusterId != null && !clusterId.equals(Long.valueOf(-1L))) { - try { -Cluster cluster = clustersProvider.get().getClusterById(clusterId); - -setResourceProperty(resource, STAGE_CLUSTER_NAME, cluster.getClusterName(), requestedIds); - } catch (Exception e) { -LOG.error("Can not get information for cluster " + clusterId + ".", e ); - } -} - -Map summary = -topologyManager.getStageSummaries(entity.getRequestId()); - -setResourceProperty(resource, STAGE_STAGE_ID, entity.getStageId(), requestedIds); -setResourceProperty(resource, STAGE_REQUEST_ID, entity.getRequestId(), requestedIds); -setResourceProperty(resource, STAGE_CONTEXT, entity.getRequestContext(), reque
ambari git commit: AMBARI-21025. Avoid unnecessary calls to load stage summaries (magyari_sandor)
Repository: ambari Updated Branches: refs/heads/trunk b97d268a1 -> 8cebc18b8 AMBARI-21025. Avoid unnecessary calls to load stage summaries (magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/8cebc18b Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/8cebc18b Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/8cebc18b Branch: refs/heads/trunk Commit: 8cebc18b82e3e9df0c440675f26f8e6be32ebf06 Parents: b97d268 Author: Sandor Magyari Authored: Wed May 10 16:22:07 2017 +0200 Committer: Sandor Magyari Committed: Tue May 16 13:59:08 2017 +0200 -- .../internal/StageResourceProvider.java | 81 +++- 1 file changed, 10 insertions(+), 71 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/8cebc18b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StageResourceProvider.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StageResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StageResourceProvider.java index db9a0e2..ec3688d 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StageResourceProvider.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StageResourceProvider.java @@ -211,8 +211,7 @@ public class StageResourceProvider extends AbstractControllerResourceProvider im // !!! poor mans cache. toResource() shouldn't be calling the db // every time, when the request id is likely the same for each stageEntity -Map> cache = - new HashMap<>(); +Map> cache = new HashMap<>(); List entities = dao.findAll(request, predicate); for (StageEntity entity : entities) { @@ -232,8 +231,11 @@ public class StageResourceProvider extends AbstractControllerResourceProvider im if (null != lr) { Collection topologyManagerStages = lr.getStageEntities(); +// preload summaries as it contains summaries for all stages within this request +Map summary = topologyManager.getStageSummaries(requestId); +cache.put(requestId, summary); for (StageEntity entity : topologyManagerStages) { - Resource stageResource = toResource(entity, propertyIds); + Resource stageResource = toResource(cache, entity, propertyIds); if (predicate.evaluate(stageResource)) { results.add(stageResource); } @@ -242,7 +244,11 @@ public class StageResourceProvider extends AbstractControllerResourceProvider im } else { Collection topologyManagerStages = topologyManager.getStages(); for (StageEntity entity : topologyManagerStages) { -Resource stageResource = toResource(entity, propertyIds); +if (!cache.containsKey(entity.getRequestId())) { + Map summary = topologyManager.getStageSummaries(entity.getRequestId()); + cache.put(entity.getRequestId(), summary); +} +Resource stageResource = toResource(cache, entity, propertyIds); if (predicate.evaluate(stageResource)) { results.add(stageResource); } @@ -351,71 +357,4 @@ public class StageResourceProvider extends AbstractControllerResourceProvider im return resource; } - /** - * Converts the {@link StageEntity} to a {@link Resource}. - * - * @param entitythe entity to convert (not {@code null}) - * @param requestedIds the properties requested (not {@code null}) - * - * @return the new resource - */ - //todo: almost exactly the same as other toResource except how summaries are obtained - //todo: refactor to combine the two with the summary logic extracted - private Resource toResource(StageEntity entity, Set requestedIds) { - -Resource resource = new ResourceImpl(Resource.Type.Stage); - -Long clusterId = entity.getClusterId(); -if (clusterId != null && !clusterId.equals(Long.valueOf(-1L))) { - try { -Cluster cluster = clustersProvider.get().getClusterById(clusterId); - -setResourceProperty(resource, STAGE_CLUSTER_NAME, cluster.getClusterName(), requestedIds); - } catch (Exception e) { -LOG.error("Can not get information for cluster " + clusterId + ".", e ); - } -} - -Map summary = -topologyManager.getStageSummaries(entity.getRequestId()); - -setResourceProperty(resource, STAGE_STAGE_ID, entity.getStageId(), requestedIds); -setResourceProperty(resource, STAGE_REQUEST_ID, entity.getRequestId(), requestedIds); -setResourceProperty(resource, STAGE_CONTEXT, entity.getRequestContext(), requestedIds)
ambari git commit: AMBARI-20366. Filter out kerberos rules in exported blueprint (Amruta Borkar via magyari_sandor)
Repository: ambari Updated Branches: refs/heads/trunk 4b48b80c0 -> 1aad067cf AMBARI-20366. Filter out kerberos rules in exported blueprint (Amruta Borkar via magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/1aad067c Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/1aad067c Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/1aad067c Branch: refs/heads/trunk Commit: 1aad067cff1601d3c0ddd1f019df0fa9eb442199 Parents: 4b48b80 Author: Amruta Borkar Authored: Fri May 5 12:45:21 2017 +0200 Committer: Sandor Magyari Committed: Fri May 5 15:48:35 2017 +0200 -- .../BlueprintConfigurationProcessor.java| 56 +--- .../render/ClusterBlueprintRendererTest.java| 38 +++-- .../BlueprintConfigurationProcessorTest.java| 56 +--- 3 files changed, 133 insertions(+), 17 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/1aad067c/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java index 7381387..1a2947b 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java @@ -34,6 +34,8 @@ import java.util.Set; import java.util.regex.Matcher; import java.util.regex.Pattern; +import org.apache.ambari.server.AmbariException; +import org.apache.ambari.server.state.Cluster; import org.apache.ambari.server.state.PropertyDependencyInfo; import org.apache.ambari.server.state.ValueAttributesInfo; import org.apache.ambari.server.topology.AdvisedConfiguration; @@ -155,8 +157,10 @@ public class BlueprintConfigurationProcessor { * This will initially be used to filter out the Ranger Passwords, but * could be extended in the future for more generic purposes. */ - private static final PropertyFilter[] exportPropertyFilters = -{ new PasswordPropertyFilter(), + private PropertyFilter[] getExportPropertyFilters (Map> authToLocalPerClusterMap) +{ + return new PropertyFilter[] { + new PasswordPropertyFilter(), new SimplePropertyNameExportFilter("tez.tez-ui.history-url.base", "tez-site"), new SimplePropertyNameExportFilter("admin_server_host", "kerberos-env"), new SimplePropertyNameExportFilter("kdc_hosts", "kerberos-env"), @@ -168,8 +172,9 @@ public class BlueprintConfigurationProcessor { new SimplePropertyNameExportFilter("domains", "krb5-conf"), new SimplePropertyNameExportFilter("dfs_ha_initial_namenode_active", "hadoop-env"), new SimplePropertyNameExportFilter("dfs_ha_initial_namenode_standby", "hadoop-env"), - new StackPropertyTypeFilter() -}; + new StackPropertyTypeFilter(), + new KerberosAuthToLocalRulesFilter(authToLocalPerClusterMap)}; +} /** * Statically-defined list of filters to apply on cluster config @@ -518,6 +523,16 @@ public class BlueprintConfigurationProcessor { */ private void doFilterPriorToExport(Configuration configuration) { Map> properties = configuration.getFullProperties(); +Map> authToLocalPerClusterMap = null; +try { + String clusterName = clusterTopology.getAmbariContext().getClusterName(clusterTopology.getClusterId()); + Cluster cluster = clusterTopology.getAmbariContext().getController().getClusters().getCluster(clusterName); + authToLocalPerClusterMap = new HashMap>(); + authToLocalPerClusterMap.put(Long.valueOf(clusterTopology.getClusterId()), clusterTopology.getAmbariContext().getController().getKerberosHelper().getKerberosDescriptor(cluster).getAllAuthToLocalProperties()); + } catch (AmbariException e) { +LOG.error("Error while getting authToLocal properties. ", e); +} +PropertyFilter [] exportPropertyFilters = getExportPropertyFilters(authToLocalPerClusterMap); for (Map.Entry> configEntry : properties.entrySet()) { String type = configEntry.getKey(); try { @@ -534,7 +549,7 @@ public class BlueprintConfigurationProcessor { for (Map.Entry propertyEntry : typeProperties.entrySet()) { String propertyName = propertyEntry.getKey(); String propertyValue = propertyEntry.getValue(); -if (should
ambari git commit: AMBARI-20809. Support hostgroup downscale by host_count (magyari_sandor)
Repository: ambari Updated Branches: refs/heads/branch-2.5 a742913da -> 93d5fbedc AMBARI-20809. Support hostgroup downscale by host_count (magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/93d5fbed Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/93d5fbed Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/93d5fbed Branch: refs/heads/branch-2.5 Commit: 93d5fbedc9d89d5f41d5ecd1163cfdbe2bd8763e Parents: a742913 Author: Sandor Magyari Authored: Fri Apr 28 14:42:55 2017 +0200 Committer: Sandor Magyari Committed: Fri Apr 28 23:22:05 2017 +0200 -- .../checks/DatabaseConsistencyCheckHelper.java | 70 ++ .../server/controller/RequestRequest.java | 11 +++ .../internal/RequestResourceProvider.java | 77 ++-- .../ambari/server/topology/LogicalRequest.java | 38 +- .../ambari/server/topology/PersistedState.java | 7 ++ .../server/topology/PersistedStateImpl.java | 10 +++ .../ambari/server/topology/TopologyManager.java | 56 +++--- .../src/main/resources/properties.json | 2 + .../DatabaseConsistencyCheckHelperTest.java | 7 +- .../internal/RequestResourceProviderTest.java | 33 ++--- .../server/topology/LogicalRequestTest.java | 64 .../server/topology/TopologyManagerTest.java| 9 ++- 12 files changed, 308 insertions(+), 76 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/93d5fbed/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java index c33c4e3..34acc06 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java @@ -382,14 +382,14 @@ public class DatabaseConsistencyCheckHelper { String SELECT_REQUEST_COUNT_QUERY = "select count(tpr.id) from topology_request tpr"; String SELECT_JOINED_COUNT_QUERY = "select count(DISTINCT tpr.id) from topology_request tpr join " + - "topology_logical_request tlr on tpr.id = tlr.request_id join topology_host_request thr on tlr.id = " + - "thr.logical_request_id join topology_host_task tht on thr.id = tht.host_request_id join topology_logical_task " + - "tlt on tht.id = tlt.host_task_id"; + "topology_logical_request tlr on tpr.id = tlr.request_id"; -int topologyRequestCount = 0; -int topologyRequestTablesJoinedCount = 0; +String SELECT_HOST_REQUEST_COUNT_QUERY = "select count(thr.id) from topology_host_request thr"; + +String SELECT_HOST_JOINED_COUNT_QUERY = "select count(DISTINCT thr.id) from topology_host_request thr join " + +"topology_host_task tht on thr.id = tht.host_request_id join topology_logical_task " + +"tlt on tht.id = tlt.host_task_id"; -ResultSet rs = null; Statement statement = null; if (connection == null) { @@ -402,38 +402,25 @@ public class DatabaseConsistencyCheckHelper { try { statement = connection.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); - rs = statement.executeQuery(SELECT_REQUEST_COUNT_QUERY); - if (rs != null) { -while (rs.next()) { - topologyRequestCount = rs.getInt(1); -} - } - - rs = statement.executeQuery(SELECT_JOINED_COUNT_QUERY); - if (rs != null) { -while (rs.next()) { - topologyRequestTablesJoinedCount = rs.getInt(1); -} - } + int topologyRequestCount = runQuery(statement, SELECT_REQUEST_COUNT_QUERY); + int topologyRequestTablesJoinedCount = runQuery(statement, SELECT_JOINED_COUNT_QUERY); if (topologyRequestCount != topologyRequestTablesJoinedCount) { error("Your topology request hierarchy is not complete for each row in topology_request should exist " + - "at least one raw in topology_logical_request, topology_host_request, topology_host_task, " + - "topology_logical_task."); + "at least one row in topology_logical_request"); } + int topologyHostRequestCount = runQuery(statement, SELECT_HOST_REQUEST_COUNT_QUERY); + int topologyHostRequestTablesJoinedCount = runQuery(statement, SELECT_HOST_JOINED_COUNT_QUERY); + + if (topologyHostRequestCount != topolo
ambari git commit: AMBARI-20809. Support hostgroup downscale by host_count (magyari_sandor)
Repository: ambari Updated Branches: refs/heads/trunk 19f9c983e -> 79cca1c71 AMBARI-20809. Support hostgroup downscale by host_count (magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/79cca1c7 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/79cca1c7 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/79cca1c7 Branch: refs/heads/trunk Commit: 79cca1c7184f1661236971dac70d85a83fab6c11 Parents: 19f9c98 Author: Sandor Magyari Authored: Fri Apr 28 14:42:55 2017 +0200 Committer: Sandor Magyari Committed: Fri Apr 28 23:20:35 2017 +0200 -- .../checks/DatabaseConsistencyCheckHelper.java | 70 ++ .../server/controller/RequestRequest.java | 11 +++ .../internal/RequestResourceProvider.java | 77 ++-- .../ambari/server/topology/LogicalRequest.java | 38 +- .../ambari/server/topology/PersistedState.java | 7 ++ .../server/topology/PersistedStateImpl.java | 10 +++ .../ambari/server/topology/TopologyManager.java | 56 +++--- .../src/main/resources/properties.json | 2 + .../DatabaseConsistencyCheckHelperTest.java | 7 +- .../internal/RequestResourceProviderTest.java | 33 ++--- .../server/topology/LogicalRequestTest.java | 64 .../server/topology/TopologyManagerTest.java| 9 ++- 12 files changed, 308 insertions(+), 76 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/79cca1c7/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java index b2a03e4..0b7f122 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java @@ -455,14 +455,14 @@ public class DatabaseConsistencyCheckHelper { String SELECT_REQUEST_COUNT_QUERY = "select count(tpr.id) from topology_request tpr"; String SELECT_JOINED_COUNT_QUERY = "select count(DISTINCT tpr.id) from topology_request tpr join " + - "topology_logical_request tlr on tpr.id = tlr.request_id join topology_host_request thr on tlr.id = " + - "thr.logical_request_id join topology_host_task tht on thr.id = tht.host_request_id join topology_logical_task " + - "tlt on tht.id = tlt.host_task_id"; + "topology_logical_request tlr on tpr.id = tlr.request_id"; -int topologyRequestCount = 0; -int topologyRequestTablesJoinedCount = 0; +String SELECT_HOST_REQUEST_COUNT_QUERY = "select count(thr.id) from topology_host_request thr"; + +String SELECT_HOST_JOINED_COUNT_QUERY = "select count(DISTINCT thr.id) from topology_host_request thr join " + +"topology_host_task tht on thr.id = tht.host_request_id join topology_logical_task " + +"tlt on tht.id = tlt.host_task_id"; -ResultSet rs = null; Statement statement = null; if (connection == null) { @@ -475,38 +475,25 @@ public class DatabaseConsistencyCheckHelper { try { statement = connection.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); - rs = statement.executeQuery(SELECT_REQUEST_COUNT_QUERY); - if (rs != null) { -while (rs.next()) { - topologyRequestCount = rs.getInt(1); -} - } - - rs = statement.executeQuery(SELECT_JOINED_COUNT_QUERY); - if (rs != null) { -while (rs.next()) { - topologyRequestTablesJoinedCount = rs.getInt(1); -} - } + int topologyRequestCount = runQuery(statement, SELECT_REQUEST_COUNT_QUERY); + int topologyRequestTablesJoinedCount = runQuery(statement, SELECT_JOINED_COUNT_QUERY); if (topologyRequestCount != topologyRequestTablesJoinedCount) { error("Your topology request hierarchy is not complete for each row in topology_request should exist " + - "at least one raw in topology_logical_request, topology_host_request, topology_host_task, " + - "topology_logical_task."); + "at least one row in topology_logical_request"); } + int topologyHostRequestCount = runQuery(statement, SELECT_HOST_REQUEST_COUNT_QUERY); + int topologyHostRequestTablesJoinedCount = runQuery(statement, SELECT_HOST_JOINED_COUNT_QUERY); + + if (topologyHostRequestCount != topologyHost
ambari git commit: AMBARI-20818. Blueprint processor fails when StackAdvisor recommends unnecessary configuration types (magyari_sandor)
Repository: ambari Updated Branches: refs/heads/branch-2.5 7df0518f2 -> 9583ede2a AMBARI-20818. Blueprint processor fails when StackAdvisor recommends unnecessary configuration types (magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/9583ede2 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/9583ede2 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/9583ede2 Branch: refs/heads/branch-2.5 Commit: 9583ede2aef55646dc2c11dc03648cee966258ba Parents: 7df0518 Author: Sandor Magyari Authored: Fri Apr 21 18:50:38 2017 +0200 Committer: Sandor Magyari Committed: Tue Apr 25 14:03:55 2017 +0200 -- .../StackAdvisorBlueprintProcessor.java | 14 +++- .../BlueprintConfigurationProcessor.java| 88 ++-- .../ambari/server/topology/Blueprint.java | 8 ++ .../ambari/server/topology/BlueprintImpl.java | 15 .../topology/ClusterConfigurationRequest.java | 59 + .../StackAdvisorBlueprintProcessorTest.java | 4 + .../BlueprintConfigurationProcessorTest.java| 4 + .../ClusterConfigurationRequestTest.java| 18 ++-- .../ClusterDeployWithStartOnlyTest.java | 1 + ...InstallWithoutStartOnComponentLevelTest.java | 1 + .../ClusterInstallWithoutStartTest.java | 1 + 11 files changed, 120 insertions(+), 93 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/9583ede2/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessor.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessor.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessor.java index cc09ae8..b7b8770 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessor.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessor.java @@ -40,6 +40,7 @@ import org.apache.ambari.server.controller.internal.Stack; import org.apache.ambari.server.orm.entities.BlueprintConfiguration; import org.apache.ambari.server.state.ValueAttributesInfo; import org.apache.ambari.server.topology.AdvisedConfiguration; +import org.apache.ambari.server.topology.Blueprint; import org.apache.ambari.server.topology.ClusterTopology; import org.apache.ambari.server.topology.ConfigRecommendationStrategy; import org.apache.ambari.server.topology.HostGroup; @@ -176,12 +177,17 @@ public class StackAdvisorBlueprintProcessor { Map recommendedConfigurations = response.getRecommendations().getBlueprint().getConfigurations(); +Blueprint blueprint = topology.getBlueprint(); + for (Map.Entry configEntry : recommendedConfigurations.entrySet()) { String configType = configEntry.getKey(); - BlueprintConfigurations blueprintConfig = filterBlueprintConfig(configType, configEntry.getValue(), - userProvidedConfigurations, topology); - topology.getAdvisedConfigurations().put(configType, new AdvisedConfiguration( -blueprintConfig.getProperties(), blueprintConfig.getPropertyAttributes())); + // add recommended config type only if related service is present in Blueprint + if (blueprint.isValidConfigType(configType)) { +BlueprintConfigurations blueprintConfig = filterBlueprintConfig(configType, configEntry.getValue(), +userProvidedConfigurations, topology); +topology.getAdvisedConfigurations().put(configType, new AdvisedConfiguration( +blueprintConfig.getProperties(), blueprintConfig.getPropertyAttributes())); + } } } http://git-wip-us.apache.org/repos/asf/ambari/blob/9583ede2/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java index e77d718..061cdf7 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java @@ -412,7 +412,10 @@ public class BlueprintConfigurationProcessor { } } -setMissingConfigurations(clusterConfig, configTypesUpdated); +// Explicitly set any properties that are required but
ambari git commit: AMBARI-20818. Blueprint processor fails when StackAdvisor recommends unnecessary configuration types (magyari_sandor)
Repository: ambari Updated Branches: refs/heads/trunk fa5447474 -> 64c9ef8a5 AMBARI-20818. Blueprint processor fails when StackAdvisor recommends unnecessary configuration types (magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/64c9ef8a Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/64c9ef8a Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/64c9ef8a Branch: refs/heads/trunk Commit: 64c9ef8a58717f00251e57ebc61870b39d63c692 Parents: fa54474 Author: Sandor Magyari Authored: Fri Apr 21 18:50:38 2017 +0200 Committer: Sandor Magyari Committed: Tue Apr 25 13:38:32 2017 +0200 -- .../StackAdvisorBlueprintProcessor.java | 14 +++- .../BlueprintConfigurationProcessor.java| 87 ++-- .../ambari/server/topology/Blueprint.java | 8 ++ .../ambari/server/topology/BlueprintImpl.java | 15 .../topology/ClusterConfigurationRequest.java | 59 + .../StackAdvisorBlueprintProcessorTest.java | 4 + .../BlueprintConfigurationProcessorTest.java| 4 + .../ClusterConfigurationRequestTest.java| 18 ++-- .../ClusterDeployWithStartOnlyTest.java | 1 + ...InstallWithoutStartOnComponentLevelTest.java | 1 + .../ClusterInstallWithoutStartTest.java | 1 + 11 files changed, 119 insertions(+), 93 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/64c9ef8a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessor.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessor.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessor.java index d306e25..7731b22 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessor.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessor.java @@ -32,6 +32,7 @@ import org.apache.ambari.server.controller.internal.ConfigurationTopologyExcepti import org.apache.ambari.server.controller.internal.Stack; import org.apache.ambari.server.state.ValueAttributesInfo; import org.apache.ambari.server.topology.AdvisedConfiguration; +import org.apache.ambari.server.topology.Blueprint; import org.apache.ambari.server.topology.ClusterTopology; import org.apache.ambari.server.topology.ConfigRecommendationStrategy; import org.apache.ambari.server.topology.HostGroup; @@ -175,12 +176,17 @@ public class StackAdvisorBlueprintProcessor { Map recommendedConfigurations = response.getRecommendations().getBlueprint().getConfigurations(); +Blueprint blueprint = topology.getBlueprint(); + for (Map.Entry configEntry : recommendedConfigurations.entrySet()) { String configType = configEntry.getKey(); - BlueprintConfigurations blueprintConfig = filterBlueprintConfig(configType, configEntry.getValue(), - userProvidedConfigurations, topology); - topology.getAdvisedConfigurations().put(configType, new AdvisedConfiguration( -blueprintConfig.getProperties(), blueprintConfig.getPropertyAttributes())); + // add recommended config type only if related service is present in Blueprint + if (blueprint.isValidConfigType(configType)) { +BlueprintConfigurations blueprintConfig = filterBlueprintConfig(configType, configEntry.getValue(), +userProvidedConfigurations, topology); +topology.getAdvisedConfigurations().put(configType, new AdvisedConfiguration( +blueprintConfig.getProperties(), blueprintConfig.getPropertyAttributes())); + } } } http://git-wip-us.apache.org/repos/asf/ambari/blob/64c9ef8a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java index bb771a5..7381387 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java @@ -408,7 +408,10 @@ public class BlueprintConfigurationProcessor { } } -setMissingConfigurations(clusterConfig, configTypesUpdated); +// Explicitly set any properties that are required but
ambari git commit: AMBARI-20628. Ambari doesn't set properties correctly (magyari_sandor)
Repository: ambari Updated Branches: refs/heads/branch-2.5 777eacd2b -> 80e3cf0fe AMBARI-20628. Ambari doesn't set properties correctly (magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/80e3cf0f Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/80e3cf0f Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/80e3cf0f Branch: refs/heads/branch-2.5 Commit: 80e3cf0fe7c4c30e93245d972859939a6fd9020f Parents: 777eacd Author: Sandor Magyari Authored: Thu Apr 13 17:04:14 2017 +0200 Committer: Sandor Magyari Committed: Fri Apr 14 10:21:08 2017 +0200 -- .../StackAdvisorBlueprintProcessor.java | 55 .../topology/ClusterConfigurationRequest.java | 8 +-- .../StackAdvisorBlueprintProcessorTest.java | 2 - 3 files changed, 16 insertions(+), 49 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/80e3cf0f/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessor.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessor.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessor.java index eb3d7e2..cc09ae8 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessor.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessor.java @@ -40,10 +40,8 @@ import org.apache.ambari.server.controller.internal.Stack; import org.apache.ambari.server.orm.entities.BlueprintConfiguration; import org.apache.ambari.server.state.ValueAttributesInfo; import org.apache.ambari.server.topology.AdvisedConfiguration; -import org.apache.ambari.server.topology.Blueprint; import org.apache.ambari.server.topology.ClusterTopology; import org.apache.ambari.server.topology.ConfigRecommendationStrategy; -import org.apache.ambari.server.topology.Configuration; import org.apache.ambari.server.topology.HostGroup; import org.apache.ambari.server.topology.HostGroupInfo; import org.slf4j.Logger; @@ -76,13 +74,13 @@ public class StackAdvisorBlueprintProcessor { /** * Recommend configurations by the stack advisor, then store the results in cluster topology. * @param clusterTopology cluster topology instance - * @param existingConfigurations Existing configurations of cluster + * @param userProvidedConfigurations User configurations of cluster provided in Blueprint + Cluster template */ - public void adviseConfiguration(ClusterTopology clusterTopology, Map> existingConfigurations) throws ConfigurationTopologyException { + public void adviseConfiguration(ClusterTopology clusterTopology, Map> userProvidedConfigurations) throws ConfigurationTopologyException { StackAdvisorRequest request = createStackAdvisorRequest(clusterTopology, StackAdvisorRequestType.CONFIGURATIONS); try { RecommendationResponse response = stackAdvisorHelper.recommend(request); - addAdvisedConfigurationsToTopology(response, clusterTopology, existingConfigurations); + addAdvisedConfigurationsToTopology(response, clusterTopology, userProvidedConfigurations); } catch (StackAdvisorException e) { throw new ConfigurationTopologyException(RECOMMENDATION_FAILED, e); } catch (IllegalArgumentException e) { @@ -95,7 +93,7 @@ public class StackAdvisorBlueprintProcessor { Map> hgComponentsMap = gatherHostGroupComponents(clusterTopology); Map> hgHostsMap = gatherHostGroupBindings(clusterTopology); Map> componentHostsMap = gatherComponentsHostsMap(hgComponentsMap, - hgHostsMap); +hgHostsMap); return StackAdvisorRequest.StackAdvisorRequestBuilder .forStack(stack.getName(), stack.getVersion()) .forServices(new ArrayList(clusterTopology.getBlueprint().getServices())) @@ -168,7 +166,7 @@ public class StackAdvisorBlueprintProcessor { } private void addAdvisedConfigurationsToTopology(RecommendationResponse response, - ClusterTopology topology, Map> existingConfigurations) { + ClusterTopology topology, Map> userProvidedConfigurations) { Preconditions.checkArgument(response.getRecommendations() != null, "Recommendation response is empty."); Preconditions.checkArgument(response.getRecommendations().getBlueprint() != null, @@ -176,67 +174,36 @@ public class StackAdvisorBlueprintProcessor { Preconditions.checkArgument(response.getRecommendations().getB
ambari git commit: AMBARI-20628. Ambari doesn't set properties correctly (magyari_sandor)
Repository: ambari Updated Branches: refs/heads/trunk c57300a35 -> bf6379509 AMBARI-20628. Ambari doesn't set properties correctly (magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/bf637950 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/bf637950 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/bf637950 Branch: refs/heads/trunk Commit: bf637950901f2b0f213c1cc149f5e49b8a8d0968 Parents: c57300a Author: Sandor Magyari Authored: Thu Apr 13 17:04:14 2017 +0200 Committer: Sandor Magyari Committed: Fri Apr 14 10:20:09 2017 +0200 -- .../StackAdvisorBlueprintProcessor.java | 55 .../topology/ClusterConfigurationRequest.java | 8 +-- .../StackAdvisorBlueprintProcessorTest.java | 2 - 3 files changed, 16 insertions(+), 49 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/bf637950/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessor.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessor.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessor.java index 0abcc14..d306e25 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessor.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessor.java @@ -32,10 +32,8 @@ import org.apache.ambari.server.controller.internal.ConfigurationTopologyExcepti import org.apache.ambari.server.controller.internal.Stack; import org.apache.ambari.server.state.ValueAttributesInfo; import org.apache.ambari.server.topology.AdvisedConfiguration; -import org.apache.ambari.server.topology.Blueprint; import org.apache.ambari.server.topology.ClusterTopology; import org.apache.ambari.server.topology.ConfigRecommendationStrategy; -import org.apache.ambari.server.topology.Configuration; import org.apache.ambari.server.topology.HostGroup; import org.apache.ambari.server.topology.HostGroupInfo; import org.slf4j.Logger; @@ -75,13 +73,13 @@ public class StackAdvisorBlueprintProcessor { /** * Recommend configurations by the stack advisor, then store the results in cluster topology. * @param clusterTopology cluster topology instance - * @param existingConfigurations Existing configurations of cluster + * @param userProvidedConfigurations User configurations of cluster provided in Blueprint + Cluster template */ - public void adviseConfiguration(ClusterTopology clusterTopology, Map> existingConfigurations) throws ConfigurationTopologyException { + public void adviseConfiguration(ClusterTopology clusterTopology, Map> userProvidedConfigurations) throws ConfigurationTopologyException { StackAdvisorRequest request = createStackAdvisorRequest(clusterTopology, StackAdvisorRequestType.CONFIGURATIONS); try { RecommendationResponse response = stackAdvisorHelper.recommend(request); - addAdvisedConfigurationsToTopology(response, clusterTopology, existingConfigurations); + addAdvisedConfigurationsToTopology(response, clusterTopology, userProvidedConfigurations); } catch (StackAdvisorException e) { throw new ConfigurationTopologyException(RECOMMENDATION_FAILED, e); } catch (IllegalArgumentException e) { @@ -94,7 +92,7 @@ public class StackAdvisorBlueprintProcessor { Map> hgComponentsMap = gatherHostGroupComponents(clusterTopology); Map> hgHostsMap = gatherHostGroupBindings(clusterTopology); Map> componentHostsMap = gatherComponentsHostsMap(hgComponentsMap, - hgHostsMap); +hgHostsMap); return StackAdvisorRequest.StackAdvisorRequestBuilder .forStack(stack.getName(), stack.getVersion()) .forServices(new ArrayList<>(clusterTopology.getBlueprint().getServices())) @@ -167,7 +165,7 @@ public class StackAdvisorBlueprintProcessor { } private void addAdvisedConfigurationsToTopology(RecommendationResponse response, - ClusterTopology topology, Map> existingConfigurations) { + ClusterTopology topology, Map> userProvidedConfigurations) { Preconditions.checkArgument(response.getRecommendations() != null, "Recommendation response is empty."); Preconditions.checkArgument(response.getRecommendations().getBlueprint() != null, @@ -175,67 +173,36 @@ public class StackAdvisorBlueprintProcessor { Preconditions.checkArgument(response.getRecom
ambari git commit: Revert "AMBARI-20628. Ambari doesn't set properties correctly (magyari_sandor)"
Repository: ambari Updated Branches: refs/heads/branch-2.5 94d7497dd -> 05b429714 Revert "AMBARI-20628. Ambari doesn't set properties correctly (magyari_sandor)" This reverts commit adbc4e848504dd3d25e9c09f81371a8880279231. Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/05b42971 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/05b42971 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/05b42971 Branch: refs/heads/branch-2.5 Commit: 05b42971481c67d0b83cbbc052d7b6ad4e85d5aa Parents: 94d7497 Author: Sandor Magyari Authored: Wed Apr 12 20:27:08 2017 +0200 Committer: Sandor Magyari Committed: Wed Apr 12 20:27:08 2017 +0200 -- .../stackadvisor/StackAdvisorBlueprintProcessor.java | 8 ++-- .../stackadvisor/StackAdvisorBlueprintProcessorTest.java | 4 ++-- 2 files changed, 4 insertions(+), 8 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/05b42971/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessor.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessor.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessor.java index b7365fb..eb3d7e2 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessor.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessor.java @@ -176,11 +176,7 @@ public class StackAdvisorBlueprintProcessor { Preconditions.checkArgument(response.getRecommendations().getBlueprint().getConfigurations() != null, "Configurations are missing from the recommendation blueprint response."); -Map> userProvidedProperties = existingConfigurations; -if (topology.getConfigRecommendationStrategy() == ConfigRecommendationStrategy.ONLY_STACK_DEFAULTS_APPLY) { - userProvidedProperties = getUserProvidedProperties(topology, existingConfigurations); -} - +Map> userProvidedProperties = getUserProvidedProperties(topology, existingConfigurations); Map recommendedConfigurations = response.getRecommendations().getBlueprint().getConfigurations(); for (Map.Entry configEntry : recommendedConfigurations.entrySet()) { @@ -188,7 +184,7 @@ public class StackAdvisorBlueprintProcessor { BlueprintConfigurations blueprintConfig = filterBlueprintConfig(configType, configEntry.getValue(), userProvidedProperties, topology); topology.getAdvisedConfigurations().put(configType, new AdvisedConfiguration( - blueprintConfig.getProperties(), blueprintConfig.getPropertyAttributes())); +blueprintConfig.getProperties(), blueprintConfig.getPropertyAttributes())); } } http://git-wip-us.apache.org/repos/asf/ambari/blob/05b42971/ambari-server/src/test/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessorTest.java -- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessorTest.java b/ambari-server/src/test/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessorTest.java index 91fdda2..3f4b273 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessorTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessorTest.java @@ -113,7 +113,7 @@ public class StackAdvisorBlueprintProcessorTest { expect(clusterTopology.getAdvisedConfigurations()).andReturn(advisedConfigurations).anyTimes(); expect(clusterTopology.getConfiguration()).andReturn(configuration).anyTimes(); expect(clusterTopology.isClusterKerberosEnabled()).andReturn(false).anyTimes(); - expect(clusterTopology.getConfigRecommendationStrategy()).andReturn(ConfigRecommendationStrategy.ONLY_STACK_DEFAULTS_APPLY).anyTimes(); + expect(clusterTopology.getConfigRecommendationStrategy()).andReturn(ConfigRecommendationStrategy.ONLY_STACK_DEFAULTS_APPLY); expect(blueprint.getStack()).andReturn(stack).anyTimes(); expect(stack.getVersion()).andReturn("2.3").anyTimes(); expect(stack.getName()).andReturn("HDP").anyTimes(); @@ -148,7 +148,7 @@ public class StackAdvisorBlueprintProcessorTest { expect(clusterTopology.getAdvisedConfigurations()).andReturn(advisedConfigurations).anyTimes(); expect(clusterTopology
ambari git commit: Revert "AMBARI-20628. Ambari doesn't set properties correctly (magyari_sandor)"
Repository: ambari Updated Branches: refs/heads/trunk 64e88e05d -> ef34cb4ee Revert "AMBARI-20628. Ambari doesn't set properties correctly (magyari_sandor)" This reverts commit 9741236f3c8b4a8a293fa0b7db5c64c0e7aa704d. Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/ef34cb4e Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/ef34cb4e Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/ef34cb4e Branch: refs/heads/trunk Commit: ef34cb4ee57c58687ba7db7adfbb5960c0b267da Parents: 64e88e0 Author: Sandor Magyari Authored: Wed Apr 12 20:24:53 2017 +0200 Committer: Sandor Magyari Committed: Wed Apr 12 20:24:53 2017 +0200 -- .../stackadvisor/StackAdvisorBlueprintProcessor.java | 8 ++-- .../stackadvisor/StackAdvisorBlueprintProcessorTest.java | 4 ++-- 2 files changed, 4 insertions(+), 8 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/ef34cb4e/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessor.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessor.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessor.java index b7eca71..0abcc14 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessor.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessor.java @@ -175,11 +175,7 @@ public class StackAdvisorBlueprintProcessor { Preconditions.checkArgument(response.getRecommendations().getBlueprint().getConfigurations() != null, "Configurations are missing from the recommendation blueprint response."); -Map> userProvidedProperties = existingConfigurations; -if (topology.getConfigRecommendationStrategy() == ConfigRecommendationStrategy.ONLY_STACK_DEFAULTS_APPLY) { - userProvidedProperties = getUserProvidedProperties(topology, existingConfigurations); -} - +Map> userProvidedProperties = getUserProvidedProperties(topology, existingConfigurations); Map recommendedConfigurations = response.getRecommendations().getBlueprint().getConfigurations(); for (Map.Entry configEntry : recommendedConfigurations.entrySet()) { @@ -187,7 +183,7 @@ public class StackAdvisorBlueprintProcessor { BlueprintConfigurations blueprintConfig = filterBlueprintConfig(configType, configEntry.getValue(), userProvidedProperties, topology); topology.getAdvisedConfigurations().put(configType, new AdvisedConfiguration( - blueprintConfig.getProperties(), blueprintConfig.getPropertyAttributes())); +blueprintConfig.getProperties(), blueprintConfig.getPropertyAttributes())); } } http://git-wip-us.apache.org/repos/asf/ambari/blob/ef34cb4e/ambari-server/src/test/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessorTest.java -- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessorTest.java b/ambari-server/src/test/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessorTest.java index 3febd48..49f070a 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessorTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessorTest.java @@ -114,7 +114,7 @@ public class StackAdvisorBlueprintProcessorTest { expect(clusterTopology.getAdvisedConfigurations()).andReturn(advisedConfigurations).anyTimes(); expect(clusterTopology.getConfiguration()).andReturn(configuration).anyTimes(); expect(clusterTopology.isClusterKerberosEnabled()).andReturn(false).anyTimes(); - expect(clusterTopology.getConfigRecommendationStrategy()).andReturn(ConfigRecommendationStrategy.ONLY_STACK_DEFAULTS_APPLY).anyTimes(); + expect(clusterTopology.getConfigRecommendationStrategy()).andReturn(ConfigRecommendationStrategy.ONLY_STACK_DEFAULTS_APPLY); expect(blueprint.getStack()).andReturn(stack).anyTimes(); expect(stack.getVersion()).andReturn("2.3").anyTimes(); expect(stack.getName()).andReturn("HDP").anyTimes(); @@ -149,7 +149,7 @@ public class StackAdvisorBlueprintProcessorTest { expect(clusterTopology.getAdvisedConfigurations()).andReturn(advisedConfigurations).anyTimes(); expect(clusterTopology.getConfiguratio
ambari git commit: AMBARI-20551. Blueprint export fails if config-type is not mapped to any service after upgrade (Amruta Borkar via alejandro)
Repository: ambari Updated Branches: refs/heads/branch-2.5 8b440e7f6 -> 3ca58f29b AMBARI-20551. Blueprint export fails if config-type is not mapped to any service after upgrade (Amruta Borkar via alejandro) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/3ca58f29 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/3ca58f29 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/3ca58f29 Branch: refs/heads/branch-2.5 Commit: 3ca58f29baf94bf96ac7e5bc1ad343fdf2d7b700 Parents: 8b440e7 Author: Alejandro Fernandez Authored: Thu Apr 6 16:32:58 2017 -0700 Committer: Sandor Magyari Committed: Tue Apr 11 16:13:49 2017 +0200 -- .../internal/BlueprintConfigurationProcessor.java | 9 + 1 file changed, 9 insertions(+) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/3ca58f29/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java index ae927c7..e77d718 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java @@ -521,6 +521,15 @@ public class BlueprintConfigurationProcessor { Map> properties = configuration.getFullProperties(); for (Map.Entry> configEntry : properties.entrySet()) { String type = configEntry.getKey(); + try { + clusterTopology.getBlueprint().getStack().getServiceForConfigType(type); +} catch (IllegalArgumentException illegalArgumentException) { +LOG.error(new StringBuilder(String.format("Error encountered while trying to obtain the service name for config type [%s]. ", type)) +.append("Further processing on this config type will be skipped. ") +.append("This usually means that a service's definitions have been manually removed from the Ambari stack definitions. ") +.append("If the stack definitions have not been changed manually, this may indicate a stack definition error in Ambari. ").toString(), illegalArgumentException); +continue; +} Map typeProperties = configEntry.getValue(); for (Map.Entry propertyEntry : typeProperties.entrySet()) {
ambari git commit: AMBARI-20628. Ambari doesn't set properties correctly (magyari_sandor)
Repository: ambari Updated Branches: refs/heads/branch-2.5 0345d1bf2 -> adbc4e848 AMBARI-20628. Ambari doesn't set properties correctly (magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/adbc4e84 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/adbc4e84 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/adbc4e84 Branch: refs/heads/branch-2.5 Commit: adbc4e848504dd3d25e9c09f81371a8880279231 Parents: 0345d1b Author: Sandor Magyari Authored: Thu Mar 30 12:04:19 2017 +0200 Committer: Sandor Magyari Committed: Fri Mar 31 14:54:34 2017 +0200 -- .../stackadvisor/StackAdvisorBlueprintProcessor.java | 8 ++-- .../stackadvisor/StackAdvisorBlueprintProcessorTest.java | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/adbc4e84/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessor.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessor.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessor.java index eb3d7e2..b7365fb 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessor.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessor.java @@ -176,7 +176,11 @@ public class StackAdvisorBlueprintProcessor { Preconditions.checkArgument(response.getRecommendations().getBlueprint().getConfigurations() != null, "Configurations are missing from the recommendation blueprint response."); -Map> userProvidedProperties = getUserProvidedProperties(topology, existingConfigurations); +Map> userProvidedProperties = existingConfigurations; +if (topology.getConfigRecommendationStrategy() == ConfigRecommendationStrategy.ONLY_STACK_DEFAULTS_APPLY) { + userProvidedProperties = getUserProvidedProperties(topology, existingConfigurations); +} + Map recommendedConfigurations = response.getRecommendations().getBlueprint().getConfigurations(); for (Map.Entry configEntry : recommendedConfigurations.entrySet()) { @@ -184,7 +188,7 @@ public class StackAdvisorBlueprintProcessor { BlueprintConfigurations blueprintConfig = filterBlueprintConfig(configType, configEntry.getValue(), userProvidedProperties, topology); topology.getAdvisedConfigurations().put(configType, new AdvisedConfiguration( -blueprintConfig.getProperties(), blueprintConfig.getPropertyAttributes())); + blueprintConfig.getProperties(), blueprintConfig.getPropertyAttributes())); } } http://git-wip-us.apache.org/repos/asf/ambari/blob/adbc4e84/ambari-server/src/test/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessorTest.java -- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessorTest.java b/ambari-server/src/test/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessorTest.java index 3f4b273..91fdda2 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessorTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessorTest.java @@ -113,7 +113,7 @@ public class StackAdvisorBlueprintProcessorTest { expect(clusterTopology.getAdvisedConfigurations()).andReturn(advisedConfigurations).anyTimes(); expect(clusterTopology.getConfiguration()).andReturn(configuration).anyTimes(); expect(clusterTopology.isClusterKerberosEnabled()).andReturn(false).anyTimes(); - expect(clusterTopology.getConfigRecommendationStrategy()).andReturn(ConfigRecommendationStrategy.ONLY_STACK_DEFAULTS_APPLY); + expect(clusterTopology.getConfigRecommendationStrategy()).andReturn(ConfigRecommendationStrategy.ONLY_STACK_DEFAULTS_APPLY).anyTimes(); expect(blueprint.getStack()).andReturn(stack).anyTimes(); expect(stack.getVersion()).andReturn("2.3").anyTimes(); expect(stack.getName()).andReturn("HDP").anyTimes(); @@ -148,7 +148,7 @@ public class StackAdvisorBlueprintProcessorTest { expect(clusterTopology.getAdvisedConfigurations()).andReturn(advisedConfigurations).anyTimes(); expect(clusterTopology.getConfiguration()).andReturn(configuration).anyTimes(); expect(clusterTopology
ambari git commit: AMBARI-20628. Ambari doesn't set properties correctly (magyari_sandor)
Repository: ambari Updated Branches: refs/heads/trunk f37a342a0 -> 9741236f3 AMBARI-20628. Ambari doesn't set properties correctly (magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/9741236f Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/9741236f Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/9741236f Branch: refs/heads/trunk Commit: 9741236f3c8b4a8a293fa0b7db5c64c0e7aa704d Parents: f37a342 Author: Sandor Magyari Authored: Thu Mar 30 12:04:19 2017 +0200 Committer: Sandor Magyari Committed: Fri Mar 31 14:52:03 2017 +0200 -- .../stackadvisor/StackAdvisorBlueprintProcessor.java | 8 ++-- .../stackadvisor/StackAdvisorBlueprintProcessorTest.java | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/9741236f/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessor.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessor.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessor.java index 0abcc14..b7eca71 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessor.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessor.java @@ -175,7 +175,11 @@ public class StackAdvisorBlueprintProcessor { Preconditions.checkArgument(response.getRecommendations().getBlueprint().getConfigurations() != null, "Configurations are missing from the recommendation blueprint response."); -Map> userProvidedProperties = getUserProvidedProperties(topology, existingConfigurations); +Map> userProvidedProperties = existingConfigurations; +if (topology.getConfigRecommendationStrategy() == ConfigRecommendationStrategy.ONLY_STACK_DEFAULTS_APPLY) { + userProvidedProperties = getUserProvidedProperties(topology, existingConfigurations); +} + Map recommendedConfigurations = response.getRecommendations().getBlueprint().getConfigurations(); for (Map.Entry configEntry : recommendedConfigurations.entrySet()) { @@ -183,7 +187,7 @@ public class StackAdvisorBlueprintProcessor { BlueprintConfigurations blueprintConfig = filterBlueprintConfig(configType, configEntry.getValue(), userProvidedProperties, topology); topology.getAdvisedConfigurations().put(configType, new AdvisedConfiguration( -blueprintConfig.getProperties(), blueprintConfig.getPropertyAttributes())); + blueprintConfig.getProperties(), blueprintConfig.getPropertyAttributes())); } } http://git-wip-us.apache.org/repos/asf/ambari/blob/9741236f/ambari-server/src/test/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessorTest.java -- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessorTest.java b/ambari-server/src/test/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessorTest.java index 49f070a..3febd48 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessorTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessorTest.java @@ -114,7 +114,7 @@ public class StackAdvisorBlueprintProcessorTest { expect(clusterTopology.getAdvisedConfigurations()).andReturn(advisedConfigurations).anyTimes(); expect(clusterTopology.getConfiguration()).andReturn(configuration).anyTimes(); expect(clusterTopology.isClusterKerberosEnabled()).andReturn(false).anyTimes(); - expect(clusterTopology.getConfigRecommendationStrategy()).andReturn(ConfigRecommendationStrategy.ONLY_STACK_DEFAULTS_APPLY); + expect(clusterTopology.getConfigRecommendationStrategy()).andReturn(ConfigRecommendationStrategy.ONLY_STACK_DEFAULTS_APPLY).anyTimes(); expect(blueprint.getStack()).andReturn(stack).anyTimes(); expect(stack.getVersion()).andReturn("2.3").anyTimes(); expect(stack.getName()).andReturn("HDP").anyTimes(); @@ -149,7 +149,7 @@ public class StackAdvisorBlueprintProcessorTest { expect(clusterTopology.getAdvisedConfigurations()).andReturn(advisedConfigurations).anyTimes(); expect(clusterTopology.getConfiguration()).andReturn(configuration).anyTimes(); expect(clusterTopology.isCluster
ambari git commit: AMBARI-20513. Storm alerts appear after disabling security [upgrade] (magyari_sandor)
Repository: ambari Updated Branches: refs/heads/branch-2.5 fedf15faa -> 4c593d7d8 AMBARI-20513. Storm alerts appear after disabling security [upgrade] (magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/4c593d7d Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/4c593d7d Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/4c593d7d Branch: refs/heads/branch-2.5 Commit: 4c593d7d8951018d16e05c132cb8377d99392ec5 Parents: fedf15f Author: Sandor Magyari Authored: Wed Mar 22 14:54:04 2017 +0100 Committer: Sandor Magyari Committed: Thu Mar 30 13:28:52 2017 +0200 -- .../main/resources/stacks/HDP/2.2/services/stack_advisor.py | 4 ++-- .../src/test/python/stacks/2.2/common/test_stack_advisor.py | 8 .../src/test/python/stacks/2.5/common/test_stack_advisor.py | 3 +++ 3 files changed, 13 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/4c593d7d/ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py -- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py b/ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py index e87769d..fafba14 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py +++ b/ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py @@ -864,7 +864,7 @@ class HDP22StackAdvisor(HDP21StackAdvisor): putStormSiteProperty = self.putProperty(configurations, "storm-site", services) putStormSiteAttributes = self.putPropertyAttribute(configurations, "storm-site") storm_site = getServicesSiteProperties(services, "storm-site") -security_enabled = (storm_site is not None and "storm.zookeeper.superACL" in storm_site) +security_enabled = self.isSecurityEnabled(services) if "ranger-env" in services["configurations"] and "ranger-storm-plugin-properties" in services["configurations"] and \ "ranger-storm-plugin-enabled" in services["configurations"]["ranger-env"]["properties"]: putStormRangerPluginProperty = self.putProperty(configurations, "ranger-storm-plugin-properties", services) @@ -891,7 +891,7 @@ class HDP22StackAdvisor(HDP21StackAdvisor): if security_enabled: if rangerPluginEnabled and (rangerPluginEnabled.lower() == 'Yes'.lower()): putStormSiteProperty('nimbus.authorizer',rangerClass) - elif (services["configurations"]["storm-site"]["properties"]["nimbus.authorizer"] == rangerClass): + else: putStormSiteProperty('nimbus.authorizer', nonRangerClass) else: putStormSiteAttributes('nimbus.authorizer', 'delete', 'true') http://git-wip-us.apache.org/repos/asf/ambari/blob/4c593d7d/ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py -- diff --git a/ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py b/ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py index 15923e8..9c6bef1 100644 --- a/ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py +++ b/ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py @@ -3045,6 +3045,7 @@ class TestHDP22StackAdvisor(TestCase): "StackServices": { "service_name" : "STORM", "service_version" : "2.6.0.2.2" + } }, { @@ -3066,6 +3067,11 @@ class TestHDP22StackAdvisor(TestCase): "stack_version": "2.2" }, "configurations": { +"cluster-env": { + "properties": { +"security_enabled": "false" + } +}, "storm-site": { "properties": { "nimbus.authorizer" : "backtype.storm.security.auth.authorizer.SimpleACLAuthorizer" @@ -3097,6 +3103,7 @@ class TestHDP22StackAdvisor(TestCase): services['configurations']['storm-site']['properties']['nimbus.authorizer'] = '' services['configurations']['ranger-storm-plugin-properties']['properties']['ranger-storm-plugin-enabled'] = 'Yes' services['configurations']['storm-site']['properties']['storm.zookeeper.superACL&
ambari git commit: AMBARI-20601. Prune files contained in zkmigrator.jar to a minimal set (Attila Magyar via magyari_sandor)
Repository: ambari Updated Branches: refs/heads/branch-2.5 74638c378 -> fedf15faa AMBARI-20601. Prune files contained in zkmigrator.jar to a minimal set (Attila Magyar via magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/fedf15fa Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/fedf15fa Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/fedf15fa Branch: refs/heads/branch-2.5 Commit: fedf15faa578cf1ed6c55b12825cd6396fd736a6 Parents: 74638c3 Author: Attila Magyar Authored: Tue Mar 28 19:15:09 2017 +0200 Committer: Sandor Magyari Committed: Thu Mar 30 12:15:59 2017 +0200 -- ambari-agent/pom.xml | 9 + 1 file changed, 9 insertions(+) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/fedf15fa/ambari-agent/pom.xml -- diff --git a/ambari-agent/pom.xml b/ambari-agent/pom.xml index c0bf11e..03df72b 100644 --- a/ambari-agent/pom.xml +++ b/ambari-agent/pom.xml @@ -404,6 +404,15 @@ ${project.build.directory}${dirsep}zkmigrator.jar + true + + + org.apache.zookeeper:zookeeper + commons-cli:commons-cli + org.slf4j:* + log4j:* + +
ambari git commit: AMBARI-20583. Allow for larger Ephemeral DH Keys in Ambari server running on JVM versions 1.8 and above (Attila Magyar via sandor_magyari)
Repository: ambari Updated Branches: refs/heads/branch-2.5 51b3eed43 -> 74638c378 AMBARI-20583. Allow for larger Ephemeral DH Keys in Ambari server running on JVM versions 1.8 and above (Attila Magyar via sandor_magyari) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/74638c37 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/74638c37 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/74638c37 Branch: refs/heads/branch-2.5 Commit: 74638c378d816cf4e27a2a09aa1ffcfbe11f98f1 Parents: 51b3eed Author: Attila Magyar Authored: Tue Mar 28 19:10:40 2017 +0200 Committer: Sandor Magyari Committed: Thu Mar 30 12:13:37 2017 +0200 -- ambari-server/docs/configuration/index.md | 1 + .../server/configuration/Configuration.java | 20 ++ .../ambari/server/controller/AmbariServer.java | 3 +++ .../server/configuration/ConfigurationTest.java | 22 4 files changed, 46 insertions(+) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/74638c37/ambari-server/docs/configuration/index.md -- diff --git a/ambari-server/docs/configuration/index.md b/ambari-server/docs/configuration/index.md index f836fc9..ded6178 100644 --- a/ambari-server/docs/configuration/index.md +++ b/ambari-server/docs/configuration/index.md @@ -190,6 +190,7 @@ The following are the properties which can be used to configure Ambari. | security.server.one_way_ssl.port | The port that the Ambari Agents will use to communicate with the Ambari Server over SSL. |`8440` | | security.server.passphrase | The password to the Ambari Server to supply to new Ambari Agent hosts being bootstrapped. |`AMBARI_PASSPHRASE` | | security.server.passphrase_env_var | An environment variable which can be used to supply the Ambari Server password when bootstrapping new Ambari Agents. |`AMBARI_PASSPHRASE` | +| security.server.tls.ephemeral_dh_key_size | The Ephemeral TLS Diffie-Hellman (DH) key size. Supported from Java 8. |`2048` | | security.server.truststore_name | The name of the truststore file ambari uses to store trusted certificates. Located in `security.server.keys_dir` |`keystore.p12` | | security.server.truststore_type | The type of the truststore file specified in `security.server.truststore_name`. Self-signed certificates can be `PKCS12` while CA signed certificates are `JKS` |`PKCS12` | | security.server.two_way_ssl | Determines whether two-way SSL should be used between Ambari Server and Ambari Agents so that the agents must also use SSL. |`false` | http://git-wip-us.apache.org/repos/asf/ambari/blob/74638c37/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java b/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java index 3166121..b3088eb 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java @@ -2644,6 +2644,14 @@ public class Configuration { public static final ConfigurationProperty SERVER_STARTUP_WEB_TIMEOUT = new ConfigurationProperty<>( "server.startup.web.timeout", 50); + /** + * The Ephemeral TLS Diffie-Hellman (DH) key size. + * Supported from Java 8. + */ + @Markdown(description = "The Ephemeral TLS Diffie-Hellman (DH) key size. Supported from Java 8.") + public static final ConfigurationProperty TLS_EPHEMERAL_DH_KEY_SIZE = new ConfigurationProperty<>( +"security.server.tls.ephemeral_dh_key_size", 2048); + private static final Logger LOG = LoggerFactory.getLogger( Configuration.class); @@ -2961,6 +2969,7 @@ public class Configuration { configsMap.put(KDC_PORT.getKey(), getProperty(KDC_PORT)); configsMap.put(AGENT_PACKAGE_PARALLEL_COMMANDS_LIMIT.getKey(), getProperty(AGENT_PACKAGE_PARALLEL_COMMANDS_LIMIT)); configsMap.put(PROXY_ALLOWED_HOST_PORTS.getKey(), getProperty(PROXY_ALLOWED_HOST_PORTS)); +configsMap.put(TLS_EPHEMERAL_DH_KEY_SIZE.getKey(), getProperty(TLS_EPHEMERAL_DH_KEY_SIZE)); File passFile = new File( configsMap.get(SRVR_KSTR_DIR.getKey()) + File.separator @@ -5450,6 +5459,17 @@ public class Configuration { } /** + * @return Ephemeral TLS DH key size + */ + public int getTlsEphemeralDhKeySize() { +int keySize = NumberUtils.toInt(getProperty(TLS_EPHEMERAL_DH_KEY_SIZE)); +if (keySize == 0) { + throw new IllegalArgumentException("Invalid " + TLS_EPHEMERAL_DH_KEY_SIZE + " " + getProperty(TLS_EPHEMERAL_DH_KEY_SIZE));
ambari git commit: AMBARI-20601. Prune files contained in zkmigrator.jar to a minimal set (Attila Magyar via magyari_sandor)
Repository: ambari Updated Branches: refs/heads/trunk 4690fe7c6 -> 53f5b63c7 AMBARI-20601. Prune files contained in zkmigrator.jar to a minimal set (Attila Magyar via magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/53f5b63c Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/53f5b63c Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/53f5b63c Branch: refs/heads/trunk Commit: 53f5b63c70f5667732c83853e7d4bffd841aac9f Parents: 4690fe7 Author: Attila Magyar Authored: Tue Mar 28 19:15:09 2017 +0200 Committer: Sandor Magyari Committed: Tue Mar 28 19:17:53 2017 +0200 -- ambari-agent/pom.xml | 9 + 1 file changed, 9 insertions(+) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/53f5b63c/ambari-agent/pom.xml -- diff --git a/ambari-agent/pom.xml b/ambari-agent/pom.xml index 292fd07..fb08ce2 100644 --- a/ambari-agent/pom.xml +++ b/ambari-agent/pom.xml @@ -406,6 +406,15 @@ ${project.build.directory}${dirsep}zkmigrator.jar + true + + + org.apache.zookeeper:zookeeper + commons-cli:commons-cli + org.slf4j:* + log4j:* + +
ambari git commit: AMBARI-20583. Allow for larger Ephemeral DH Keys in Ambari server running on JVM versions 1.8 and above (Attila Magyar via sandor_magyari)
Repository: ambari Updated Branches: refs/heads/trunk 8842be0c8 -> 165ec700f AMBARI-20583. Allow for larger Ephemeral DH Keys in Ambari server running on JVM versions 1.8 and above (Attila Magyar via sandor_magyari) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/165ec700 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/165ec700 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/165ec700 Branch: refs/heads/trunk Commit: 165ec700f0f4e5c83a30bb7591df0fa1a8cfec9a Parents: 8842be0 Author: Attila Magyar Authored: Tue Mar 28 19:10:40 2017 +0200 Committer: Sandor Magyari Committed: Tue Mar 28 19:10:40 2017 +0200 -- ambari-server/docs/configuration/index.md | 1 + .../server/configuration/Configuration.java | 20 +++ .../ambari/server/controller/AmbariServer.java | 3 +++ .../server/configuration/ConfigurationTest.java | 21 4 files changed, 45 insertions(+) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/165ec700/ambari-server/docs/configuration/index.md -- diff --git a/ambari-server/docs/configuration/index.md b/ambari-server/docs/configuration/index.md index 90865b6..ff9ce54 100644 --- a/ambari-server/docs/configuration/index.md +++ b/ambari-server/docs/configuration/index.md @@ -195,6 +195,7 @@ The following are the properties which can be used to configure Ambari. | security.server.one_way_ssl.port | The port that the Ambari Agents will use to communicate with the Ambari Server over SSL. |`8440` | | security.server.passphrase | The password to the Ambari Server to supply to new Ambari Agent hosts being bootstrapped. |`AMBARI_PASSPHRASE` | | security.server.passphrase_env_var | An environment variable which can be used to supply the Ambari Server password when bootstrapping new Ambari Agents. |`AMBARI_PASSPHRASE` | +| security.server.tls.ephemeral_dh_key_size | The Ephemeral TLS Diffie-Hellman (DH) key size. Supported from Java 8. |`2048` | | security.server.truststore_name | The name of the truststore file ambari uses to store trusted certificates. Located in `security.server.keys_dir` |`keystore.p12` | | security.server.truststore_type | The type of the truststore file specified in `security.server.truststore_name`. Self-signed certificates can be `PKCS12` while CA signed certificates are `JKS` |`PKCS12` | | security.server.two_way_ssl | Determines whether two-way SSL should be used between Ambari Server and Ambari Agents so that the agents must also use SSL. |`false` | http://git-wip-us.apache.org/repos/asf/ambari/blob/165ec700/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java b/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java index 93ebd9a..537b993 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java @@ -2687,6 +2687,14 @@ public class Configuration { public static final ConfigurationProperty SERVER_STARTUP_WEB_TIMEOUT = new ConfigurationProperty<>( "server.startup.web.timeout", 50); + /** + * The Ephemeral TLS Diffie-Hellman (DH) key size. + * Supported from Java 8. + */ + @Markdown(description = "The Ephemeral TLS Diffie-Hellman (DH) key size. Supported from Java 8.") + public static final ConfigurationProperty TLS_EPHEMERAL_DH_KEY_SIZE = new ConfigurationProperty<>( +"security.server.tls.ephemeral_dh_key_size", 2048); + private static final Logger LOG = LoggerFactory.getLogger( Configuration.class); @@ -2874,6 +2882,7 @@ public class Configuration { configsMap.put(KDC_PORT.getKey(), getProperty(KDC_PORT)); configsMap.put(AGENT_PACKAGE_PARALLEL_COMMANDS_LIMIT.getKey(), getProperty(AGENT_PACKAGE_PARALLEL_COMMANDS_LIMIT)); configsMap.put(PROXY_ALLOWED_HOST_PORTS.getKey(), getProperty(PROXY_ALLOWED_HOST_PORTS)); +configsMap.put(TLS_EPHEMERAL_DH_KEY_SIZE.getKey(), getProperty(TLS_EPHEMERAL_DH_KEY_SIZE)); File passFile = new File( configsMap.get(SRVR_KSTR_DIR.getKey()) + File.separator @@ -5559,6 +5568,17 @@ public class Configuration { } /** + * @return Ephemeral TLS DH key size + */ + public int getTlsEphemeralDhKeySize() { +int keySize = NumberUtils.toInt(getProperty(TLS_EPHEMERAL_DH_KEY_SIZE)); +if (keySize == 0) { + throw new IllegalArgumentException("Invalid " + TLS_EPHEMERAL_DH_KEY_SIZE + " " + getProperty(TLS_EPHEMERAL_DH_KEY_SIZE)); +} +
ambari git commit: AMBARI-20513. Storm alerts appear after disabling security [upgrade] (magyari_sandor)
Repository: ambari Updated Branches: refs/heads/trunk ca2c83582 -> 64fc0e23c AMBARI-20513. Storm alerts appear after disabling security [upgrade] (magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/64fc0e23 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/64fc0e23 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/64fc0e23 Branch: refs/heads/trunk Commit: 64fc0e23c599682d53e337a58dd573825d551504 Parents: ca2c835 Author: Sandor Magyari Authored: Wed Mar 22 14:54:04 2017 +0100 Committer: Sandor Magyari Committed: Thu Mar 23 08:24:31 2017 +0100 -- .../main/resources/stacks/HDP/2.2/services/stack_advisor.py | 4 ++-- .../src/test/python/stacks/2.2/common/test_stack_advisor.py | 8 .../src/test/python/stacks/2.5/common/test_stack_advisor.py | 3 +++ 3 files changed, 13 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/64fc0e23/ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py -- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py b/ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py index d753c51..800edbe 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py +++ b/ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py @@ -918,7 +918,7 @@ class HDP22StackAdvisor(HDP21StackAdvisor): putStormSiteProperty = self.putProperty(configurations, "storm-site", services) putStormSiteAttributes = self.putPropertyAttribute(configurations, "storm-site") storm_site = getServicesSiteProperties(services, "storm-site") -security_enabled = (storm_site is not None and "storm.zookeeper.superACL" in storm_site) +security_enabled = self.isSecurityEnabled(services) if "ranger-env" in services["configurations"] and "ranger-storm-plugin-properties" in services["configurations"] and \ "ranger-storm-plugin-enabled" in services["configurations"]["ranger-env"]["properties"]: putStormRangerPluginProperty = self.putProperty(configurations, "ranger-storm-plugin-properties", services) @@ -945,7 +945,7 @@ class HDP22StackAdvisor(HDP21StackAdvisor): if security_enabled: if rangerPluginEnabled and (rangerPluginEnabled.lower() == 'Yes'.lower()): putStormSiteProperty('nimbus.authorizer',rangerClass) - elif (services["configurations"]["storm-site"]["properties"]["nimbus.authorizer"] == rangerClass): + else: putStormSiteProperty('nimbus.authorizer', nonRangerClass) else: putStormSiteAttributes('nimbus.authorizer', 'delete', 'true') http://git-wip-us.apache.org/repos/asf/ambari/blob/64fc0e23/ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py -- diff --git a/ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py b/ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py index a2b7714..571ff26 100644 --- a/ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py +++ b/ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py @@ -3045,6 +3045,7 @@ class TestHDP22StackAdvisor(TestCase): "StackServices": { "service_name" : "STORM", "service_version" : "2.6.0.2.2" + } }, { @@ -3066,6 +3067,11 @@ class TestHDP22StackAdvisor(TestCase): "stack_version": "2.2" }, "configurations": { +"cluster-env": { + "properties": { +"security_enabled": "false" + } +}, "storm-site": { "properties": { "nimbus.authorizer" : "backtype.storm.security.auth.authorizer.SimpleACLAuthorizer" @@ -3097,6 +3103,7 @@ class TestHDP22StackAdvisor(TestCase): services['configurations']['storm-site']['properties']['nimbus.authorizer'] = '' services['configurations']['ranger-storm-plugin-properties']['properties']['ranger-storm-plugin-enabled'] = 'Yes' services['configurations']['storm-site']['properties']['storm.zookeeper.superACL'] =
ambari git commit: AMBARI-20440. Concurrent odification of HostComponentDesiredState entity results in Blueprint based deployment stuck in PENDING state (magyari_sandor)
Repository: ambari Updated Branches: refs/heads/branch-2.5 0b9ce3f06 -> ec8fc2bb2 AMBARI-20440. Concurrent odification of HostComponentDesiredState entity results in Blueprint based deployment stuck in PENDING state (magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/ec8fc2bb Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/ec8fc2bb Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/ec8fc2bb Branch: refs/heads/branch-2.5 Commit: ec8fc2bb2b3632a5e76b089fc98b95ce518de264 Parents: 0b9ce3f Author: Sandor Magyari Authored: Tue Mar 14 18:41:42 2017 +0100 Committer: Sandor Magyari Committed: Thu Mar 16 14:18:16 2017 +0100 -- .../ambari/server/state/svccomphost/ServiceComponentHostImpl.java | 1 + 1 file changed, 1 insertion(+) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/ec8fc2bb/ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java index 6f01048..6e4979c 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java @@ -1513,6 +1513,7 @@ public class ServiceComponentHostImpl implements ServiceComponentHost { } @Override + @Transactional public void setRestartRequired(boolean restartRequired) { LOG.debug("Set RestartRequired on serviceName = {} componentName = {} hostName = {} to {}", getServiceName(), getServiceComponentName(), getHostName(), restartRequired);
ambari git commit: AMBARI-20440. Concurrent odification of HostComponentDesiredState entity results in Blueprint based deployment stuck in PENDING state (magyari_sandor)
Repository: ambari Updated Branches: refs/heads/trunk a57bfacfc -> b5b5ac46a AMBARI-20440. Concurrent odification of HostComponentDesiredState entity results in Blueprint based deployment stuck in PENDING state (magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/b5b5ac46 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/b5b5ac46 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/b5b5ac46 Branch: refs/heads/trunk Commit: b5b5ac46aed06427868183a9cef57ef1a4071d6c Parents: a57bfac Author: Sandor Magyari Authored: Tue Mar 14 18:41:42 2017 +0100 Committer: Sandor Magyari Committed: Thu Mar 16 14:17:32 2017 +0100 -- .../ambari/server/state/svccomphost/ServiceComponentHostImpl.java | 1 + 1 file changed, 1 insertion(+) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/b5b5ac46/ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java index 6f01048..6e4979c 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java @@ -1513,6 +1513,7 @@ public class ServiceComponentHostImpl implements ServiceComponentHost { } @Override + @Transactional public void setRestartRequired(boolean restartRequired) { LOG.debug("Set RestartRequired on serviceName = {} componentName = {} hostName = {} to {}", getServiceName(), getServiceComponentName(), getHostName(), restartRequired);
ambari git commit: AMBARI-20178. Add authentication for Topology tasks (magyari_sandor)
Repository: ambari Updated Branches: refs/heads/branch-2.5 098e4fc09 -> ac167d09e AMBARI-20178. Add authentication for Topology tasks (magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/ac167d09 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/ac167d09 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/ac167d09 Branch: refs/heads/branch-2.5 Commit: ac167d09ea91ce99f203325f5d5aa72724536ad4 Parents: 098e4fc Author: Sandor Magyari Authored: Thu Mar 2 15:15:31 2017 +0100 Committer: Sandor Magyari Committed: Thu Mar 2 19:05:48 2017 +0100 -- .../server/controller/ControllerModule.java | 45 +++-- .../internal/ClusterResourceProvider.java | 2 + .../InternalAuthenticationInterceptor.java | 51 ++ .../RunWithInternalSecurityContext.java | 36 .../ambari/server/topology/AmbariContext.java | 7 +- .../server/topology/HostOfferResponse.java | 8 +- .../ambari/server/topology/HostRequest.java | 178 ++- .../server/topology/PersistedStateImpl.java | 1 + .../ambari/server/topology/TopologyManager.java | 98 ++ .../ambari/server/topology/TopologyTask.java| 47 - .../topology/tasks/ConfigureClusterTask.java| 122 + .../tasks/ConfigureClusterTaskFactory.java | 30 .../server/topology/tasks/InstallHostTask.java | 70 .../tasks/PersistHostResourcesTask.java | 59 ++ .../tasks/RegisterWithConfigGroupTask.java | 50 ++ .../server/topology/tasks/StartHostTask.java| 67 +++ .../server/topology/tasks/TopologyHostTask.java | 59 ++ .../server/topology/tasks/TopologyTask.java | 42 + .../ambari/server/agent/AgentResourceTest.java | 3 + .../server/state/cluster/ClustersTest.java | 2 +- .../ClusterDeployWithStartOnlyTest.java | 3 + ...InstallWithoutStartOnComponentLevelTest.java | 3 + .../ClusterInstallWithoutStartTest.java | 3 + .../topology/ConfigureClusterTaskTest.java | 33 ++-- .../server/topology/TopologyManagerTest.java| 3 + .../ambari/server/utils/StageUtilsTest.java | 2 + 26 files changed, 689 insertions(+), 335 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/ac167d09/ambari-server/src/main/java/org/apache/ambari/server/controller/ControllerModule.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/ControllerModule.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/ControllerModule.java index 52b0190..53c10c3 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/ControllerModule.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ControllerModule.java @@ -18,6 +18,23 @@ package org.apache.ambari.server.controller; +import static com.google.inject.matcher.Matchers.annotatedWith; +import static com.google.inject.matcher.Matchers.any; +import static org.eclipse.persistence.config.PersistenceUnitProperties.CREATE_JDBC_DDL_FILE; +import static org.eclipse.persistence.config.PersistenceUnitProperties.CREATE_ONLY; +import static org.eclipse.persistence.config.PersistenceUnitProperties.CREATE_OR_EXTEND; +import static org.eclipse.persistence.config.PersistenceUnitProperties.DDL_BOTH_GENERATION; +import static org.eclipse.persistence.config.PersistenceUnitProperties.DDL_GENERATION; +import static org.eclipse.persistence.config.PersistenceUnitProperties.DDL_GENERATION_MODE; +import static org.eclipse.persistence.config.PersistenceUnitProperties.DROP_AND_CREATE; +import static org.eclipse.persistence.config.PersistenceUnitProperties.DROP_JDBC_DDL_FILE; +import static org.eclipse.persistence.config.PersistenceUnitProperties.JDBC_DRIVER; +import static org.eclipse.persistence.config.PersistenceUnitProperties.JDBC_PASSWORD; +import static org.eclipse.persistence.config.PersistenceUnitProperties.JDBC_URL; +import static org.eclipse.persistence.config.PersistenceUnitProperties.JDBC_USER; +import static org.eclipse.persistence.config.PersistenceUnitProperties.NON_JTA_DATASOURCE; +import static org.eclipse.persistence.config.PersistenceUnitProperties.THROW_EXCEPTIONS; + import java.beans.PropertyVetoException; import java.security.SecureRandom; import java.text.MessageFormat; @@ -88,13 +105,14 @@ import org.apache.ambari.server.scheduler.ExecutionSchedulerImpl; import org.apache.ambari.server.security.SecurityHelper; import org.apache.ambari.server.security.SecurityHelperImpl; import org.apache.ambari.server.security.authorization.AuthorizationHelper; +import org.apache.ambari.server.security.authorization.internal.InternalAuthenticationIntercep
ambari git commit: AMBARI-20178. Add authentication for Topology tasks (magyari_sandor)
Repository: ambari Updated Branches: refs/heads/trunk d481b788b -> 5ab46f0cc AMBARI-20178. Add authentication for Topology tasks (magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/5ab46f0c Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/5ab46f0c Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/5ab46f0c Branch: refs/heads/trunk Commit: 5ab46f0cca5cb2dc6250f44ebe2a3603435706fe Parents: d481b78 Author: Sandor Magyari Authored: Thu Mar 2 15:15:31 2017 +0100 Committer: Sandor Magyari Committed: Thu Mar 2 18:58:01 2017 +0100 -- .../server/controller/ControllerModule.java | 14 +- .../internal/ClusterResourceProvider.java | 2 + .../InternalAuthenticationInterceptor.java | 51 ++ .../RunWithInternalSecurityContext.java | 36 .../ambari/server/topology/AmbariContext.java | 7 +- .../server/topology/HostOfferResponse.java | 2 +- .../ambari/server/topology/HostRequest.java | 178 ++- .../server/topology/PersistedStateImpl.java | 1 + .../ambari/server/topology/TopologyManager.java | 101 ++- .../ambari/server/topology/TopologyTask.java| 47 - .../topology/tasks/ConfigureClusterTask.java| 122 + .../tasks/ConfigureClusterTaskFactory.java | 30 .../server/topology/tasks/InstallHostTask.java | 70 .../tasks/PersistHostResourcesTask.java | 59 ++ .../tasks/RegisterWithConfigGroupTask.java | 50 ++ .../server/topology/tasks/StartHostTask.java| 67 +++ .../server/topology/tasks/TopologyHostTask.java | 59 ++ .../server/topology/tasks/TopologyTask.java | 42 + .../ambari/server/agent/AgentResourceTest.java | 3 + .../server/state/cluster/ClustersTest.java | 2 +- .../ClusterDeployWithStartOnlyTest.java | 3 + ...InstallWithoutStartOnComponentLevelTest.java | 3 + .../ClusterInstallWithoutStartTest.java | 3 + .../topology/ConfigureClusterTaskTest.java | 7 +- .../server/topology/TopologyManagerTest.java| 3 + .../ambari/server/utils/StageUtilsTest.java | 2 + 26 files changed, 657 insertions(+), 307 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/5ab46f0c/ambari-server/src/main/java/org/apache/ambari/server/controller/ControllerModule.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/ControllerModule.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/ControllerModule.java index 482d602..4fa2362 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/ControllerModule.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ControllerModule.java @@ -18,6 +18,8 @@ package org.apache.ambari.server.controller; +import static com.google.inject.matcher.Matchers.annotatedWith; +import static com.google.inject.matcher.Matchers.any; import static org.eclipse.persistence.config.PersistenceUnitProperties.CREATE_JDBC_DDL_FILE; import static org.eclipse.persistence.config.PersistenceUnitProperties.CREATE_ONLY; import static org.eclipse.persistence.config.PersistenceUnitProperties.CREATE_OR_EXTEND; @@ -103,6 +105,8 @@ import org.apache.ambari.server.scheduler.ExecutionSchedulerImpl; import org.apache.ambari.server.security.SecurityHelper; import org.apache.ambari.server.security.SecurityHelperImpl; import org.apache.ambari.server.security.authorization.AuthorizationHelper; +import org.apache.ambari.server.security.authorization.internal.InternalAuthenticationInterceptor; +import org.apache.ambari.server.security.authorization.internal.RunWithInternalSecurityContext; import org.apache.ambari.server.security.encryption.CredentialStoreService; import org.apache.ambari.server.security.encryption.CredentialStoreServiceImpl; import org.apache.ambari.server.serveraction.kerberos.KerberosOperationHandlerFactory; @@ -145,6 +149,7 @@ import org.apache.ambari.server.topology.BlueprintFactory; import org.apache.ambari.server.topology.PersistedState; import org.apache.ambari.server.topology.PersistedStateImpl; import org.apache.ambari.server.topology.SecurityConfigurationFactory; +import org.apache.ambari.server.topology.tasks.ConfigureClusterTaskFactory; import org.apache.ambari.server.view.ViewInstanceHandlerList; import org.eclipse.jetty.server.SessionIdManager; import org.eclipse.jetty.server.SessionManager; @@ -396,6 +401,10 @@ public class ControllerModule extends AbstractModule { bindNotificationDispatchers(null); registerUpgradeChecks(null); bind(HookService.class).to(UserHookService.class); + +InternalAuthenticationIntercep
ambari git commit: AMBARI-19991. cluster deployment fails if cluster template has fewer host_groups than that in blueprint (Amruta Borkar via magyari_sandor)
Repository: ambari Updated Branches: refs/heads/trunk b789b7c10 -> 45b423b7b AMBARI-19991. cluster deployment fails if cluster template has fewer host_groups than that in blueprint (Amruta Borkar via magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/45b423b7 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/45b423b7 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/45b423b7 Branch: refs/heads/trunk Commit: 45b423b7be199115f36cad828fd77a45fed21b63 Parents: b789b7c Author: Amruta Borkar Authored: Wed Feb 22 11:43:09 2017 +0100 Committer: Sandor Magyari Committed: Wed Feb 22 13:03:24 2017 +0100 -- .../java/org/apache/ambari/server/topology/TopologyManager.java | 3 +++ 1 file changed, 3 insertions(+) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/45b423b7/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyManager.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyManager.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyManager.java index c4c3dd2..a26624e 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyManager.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyManager.java @@ -1050,6 +1050,9 @@ public class TopologyManager { if (groupInfo != null) { LOG.info("TopologyManager.ConfigureClusterTask areHostGroupsResolved: host group name = {} requires {} hosts to be mapped, but only {} are available.", groupInfo.getHostGroupName(), groupInfo.getRequestedHostCount(), groupInfo.getHostNames().size()); + } else { + LOG.error("TopologyManager.ConfigureClusterTask areHostGroupsResolved: host group name = {} is required group and does not map to any hosts. Use add host API to add host to this host group.", + hostGroup); } break; } else {
ambari git commit: AMBARI-20044. NullPointerException after server restart in case not all hosts were joined (magyari_sandor)
Repository: ambari Updated Branches: refs/heads/branch-2.5 f1fa4ec6a -> e5f188dd7 AMBARI-20044. NullPointerException after server restart in case not all hosts were joined (magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/e5f188dd Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/e5f188dd Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/e5f188dd Branch: refs/heads/branch-2.5 Commit: e5f188dd776296b847e461ee8428a3b3c7608564 Parents: f1fa4ec Author: Sandor Magyari Authored: Thu Feb 16 16:22:59 2017 +0100 Committer: Sandor Magyari Committed: Fri Feb 17 17:36:56 2017 +0100 -- .../main/java/org/apache/ambari/server/topology/HostRequest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/e5f188dd/ambari-server/src/main/java/org/apache/ambari/server/topology/HostRequest.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/HostRequest.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/HostRequest.java index a18999b..a6f677a 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/topology/HostRequest.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/HostRequest.java @@ -313,7 +313,7 @@ public class HostRequest implements Comparable { for (HostRoleCommand logicalTask : logicalTasks.values()) { // set host on command detail if it is set to null String commandDetail = logicalTask.getCommandDetail(); - if (commandDetail != null && commandDetail.contains("null")) { + if (commandDetail != null && commandDetail.contains("null") && hostname != null) { logicalTask.setCommandDetail(commandDetail.replace("null", hostname)); } Long physicalTaskId = physicalTasks.get(logicalTask.getTaskId());
ambari git commit: AMBARI-20044. NullPointerException after server restart in case not all hosts were joined (magyari_sandor)
Repository: ambari Updated Branches: refs/heads/trunk c8c134ee7 -> bcf728933 AMBARI-20044. NullPointerException after server restart in case not all hosts were joined (magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/bcf72893 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/bcf72893 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/bcf72893 Branch: refs/heads/trunk Commit: bcf7289331765c6f67b99fd08a2674c90fa53589 Parents: c8c134e Author: Sandor Magyari Authored: Thu Feb 16 16:22:59 2017 +0100 Committer: Sandor Magyari Committed: Fri Feb 17 17:35:42 2017 +0100 -- .../main/java/org/apache/ambari/server/topology/HostRequest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/bcf72893/ambari-server/src/main/java/org/apache/ambari/server/topology/HostRequest.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/HostRequest.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/HostRequest.java index a18999b..a6f677a 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/topology/HostRequest.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/HostRequest.java @@ -313,7 +313,7 @@ public class HostRequest implements Comparable { for (HostRoleCommand logicalTask : logicalTasks.values()) { // set host on command detail if it is set to null String commandDetail = logicalTask.getCommandDetail(); - if (commandDetail != null && commandDetail.contains("null")) { + if (commandDetail != null && commandDetail.contains("null") && hostname != null) { logicalTask.setCommandDetail(commandDetail.replace("null", hostname)); } Long physicalTaskId = physicalTasks.get(logicalTask.getTaskId());
ambari git commit: AMBARI-19984. ambari-server upgrade is not idempotent (Attila Magyar via magyari_sandor)
Repository: ambari Updated Branches: refs/heads/branch-2.5 537c95471 -> 29343d775 AMBARI-19984. ambari-server upgrade is not idempotent (Attila Magyar via magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/29343d77 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/29343d77 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/29343d77 Branch: refs/heads/branch-2.5 Commit: 29343d775b7ef983b67c3c0516190ae33cb02669 Parents: 537c954 Author: Attila Magyar Authored: Wed Feb 15 14:13:40 2017 +0100 Committer: Sandor Magyari Committed: Wed Feb 15 14:17:34 2017 +0100 -- .../server/orm/entities/PermissionEntity.java | 32 ++-- .../internal/InternalAuthenticationToken.java | 24 +- .../server/upgrade/AbstractUpgradeCatalog.java | 2 +- .../security/TestAuthenticationFactory.java | 44 +++--- .../authorization/AuthorizationHelperTest.java | 24 +++--- .../server/upgrade/UpgradeCatalog242Test.java | 27 +++ .../server/upgrade/UpgradeCatalog250Test.java | 85 +--- 7 files changed, 115 insertions(+), 123 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/29343d77/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/PermissionEntity.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/PermissionEntity.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/PermissionEntity.java index b6f1557..892bb13 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/PermissionEntity.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/PermissionEntity.java @@ -18,6 +18,9 @@ package org.apache.ambari.server.orm.entities; +import java.util.Collection; +import java.util.LinkedHashSet; +import java.util.Set; import javax.persistence.Column; import javax.persistence.Entity; @@ -34,7 +37,8 @@ import javax.persistence.NamedQuery; import javax.persistence.OneToOne; import javax.persistence.Table; import javax.persistence.TableGenerator; -import java.util.Collection; + +import org.apache.ambari.server.security.authorization.RoleAuthorization; /** * Represents an admin permission. @@ -119,7 +123,7 @@ public class PermissionEntity { joinColumns = {@JoinColumn(name = "permission_id")}, inverseJoinColumns = {@JoinColumn(name = "authorization_id")} ) - private Collection authorizations; + private Set authorizations = new LinkedHashSet<>(); /** * The permission's explicit sort order @@ -229,12 +233,26 @@ public class PermissionEntity { } /** - * Sets the collection of granular authorizations for this PermissionEntity - * - * @param authorizations a collection of granular authorizations + * Add roleAuthorization if it's not already added + */ + public void addAuthorization(RoleAuthorizationEntity roleAuthorization) { +authorizations.add(roleAuthorization); + } + + /** + * Add multiple role authorizations */ - public void setAuthorizations(Collection authorizations) { -this.authorizations = authorizations; + public void addAuthorizations(Collection roleAuthorizations) { +for (RoleAuthorization roleAuthorization : roleAuthorizations) { + addAuthorization(createRoleAuthorizationEntity(roleAuthorization)); +} + } + + private static RoleAuthorizationEntity createRoleAuthorizationEntity(RoleAuthorization authorization) { +RoleAuthorizationEntity roleAuthorizationEntity = new RoleAuthorizationEntity(); +roleAuthorizationEntity.setAuthorizationId(authorization.getId()); +roleAuthorizationEntity.setAuthorizationName(authorization.name()); +return roleAuthorizationEntity; } /** http://git-wip-us.apache.org/repos/asf/ambari/blob/29343d77/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/internal/InternalAuthenticationToken.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/internal/InternalAuthenticationToken.java b/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/internal/InternalAuthenticationToken.java index c83a132..81233e3 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/internal/InternalAuthenticationToken.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/internal/InternalAuthenticationToken.java @@ -18,16 +18,14 @@ package org.apache.ambari.server.security.authorization.internal; -import java.util.ArrayList; import java.util.Collection; import java.u
ambari git commit: AMBARI-19984. ambari-server upgrade is not idempotent (magyari_sandor)
Repository: ambari Updated Branches: refs/heads/trunk 11893d463 -> 513b52756 AMBARI-19984. ambari-server upgrade is not idempotent (magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/513b5275 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/513b5275 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/513b5275 Branch: refs/heads/trunk Commit: 513b527564cef89dff2154504ef4108d6eea5123 Parents: 11893d4 Author: Sandor Magyari Authored: Wed Feb 15 13:46:29 2017 +0100 Committer: Sandor Magyari Committed: Wed Feb 15 14:00:04 2017 +0100 -- .../server/orm/entities/PermissionEntity.java | 30 -- .../internal/InternalAuthenticationToken.java | 24 +--- .../server/upgrade/AbstractUpgradeCatalog.java | 2 +- .../security/TestAuthenticationFactory.java | 44 -- .../authorization/AuthorizationHelperTest.java | 24 .../server/upgrade/UpgradeCatalog242Test.java | 27 +++-- .../server/upgrade/UpgradeCatalog250Test.java | 61 ++-- 7 files changed, 104 insertions(+), 108 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/513b5275/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/PermissionEntity.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/PermissionEntity.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/PermissionEntity.java index fb01cca..a7a07f3 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/PermissionEntity.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/PermissionEntity.java @@ -20,6 +20,8 @@ package org.apache.ambari.server.orm.entities; import java.util.Collection; +import java.util.LinkedHashSet; +import java.util.Set; import javax.persistence.Column; import javax.persistence.Entity; @@ -37,6 +39,8 @@ import javax.persistence.OneToOne; import javax.persistence.Table; import javax.persistence.TableGenerator; +import org.apache.ambari.server.security.authorization.RoleAuthorization; + /** * Represents an admin permission. */ @@ -120,7 +124,7 @@ public class PermissionEntity { joinColumns = {@JoinColumn(name = "permission_id")}, inverseJoinColumns = {@JoinColumn(name = "authorization_id")} ) - private Collection authorizations; + private Set authorizations = new LinkedHashSet<>(); /** * The permission's explicit sort order @@ -230,12 +234,26 @@ public class PermissionEntity { } /** - * Sets the collection of granular authorizations for this PermissionEntity - * - * @param authorizations a collection of granular authorizations + * Add roleAuthorization if it's not already added + */ + public void addAuthorization(RoleAuthorizationEntity roleAuthorization) { +authorizations.add(roleAuthorization); + } + + /** + * Add multiple role authorizations */ - public void setAuthorizations(Collection authorizations) { -this.authorizations = authorizations; + public void addAuthorizations(Collection roleAuthorizations) { +for (RoleAuthorization roleAuthorization : roleAuthorizations) { + addAuthorization(createRoleAuthorizationEntity(roleAuthorization)); +} + } + + private static RoleAuthorizationEntity createRoleAuthorizationEntity(RoleAuthorization authorization) { +RoleAuthorizationEntity roleAuthorizationEntity = new RoleAuthorizationEntity(); +roleAuthorizationEntity.setAuthorizationId(authorization.getId()); +roleAuthorizationEntity.setAuthorizationName(authorization.name()); +return roleAuthorizationEntity; } /** http://git-wip-us.apache.org/repos/asf/ambari/blob/513b5275/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/internal/InternalAuthenticationToken.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/internal/InternalAuthenticationToken.java b/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/internal/InternalAuthenticationToken.java index 8e69004..920db7a 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/internal/InternalAuthenticationToken.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/internal/InternalAuthenticationToken.java @@ -18,16 +18,14 @@ package org.apache.ambari.server.security.authorization.internal; -import java.util.ArrayList; import java.util.Collection; import java.util.Collections; -import java.util.Lis
ambari git commit: AMBARI-19961. KERBEROS_CLIENT is not included automatically in all hostgroups when scaling a cluster after server restart (magyari_sandor)
Repository: ambari Updated Branches: refs/heads/branch-2.5 c2952d059 -> 771274a47 AMBARI-19961. KERBEROS_CLIENT is not included automatically in all hostgroups when scaling a cluster after server restart (magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/771274a4 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/771274a4 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/771274a4 Branch: refs/heads/branch-2.5 Commit: 771274a479f5d4f5c13f39ea723dc4de705337d7 Parents: c2952d0 Author: Sandor Magyari Authored: Fri Feb 10 22:09:29 2017 +0100 Committer: Sandor Magyari Committed: Tue Feb 14 09:31:21 2017 +0100 -- .../ambari/server/topology/TopologyManager.java | 6 .../server/topology/TopologyManagerTest.java| 35 +--- 2 files changed, 36 insertions(+), 5 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/771274a4/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyManager.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyManager.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyManager.java index 3103c34..c4c3dd2 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyManager.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyManager.java @@ -174,6 +174,12 @@ public class TopologyManager { synchronized (initializationLock) { if (!isInitialized) { replayRequests(persistedState.getAllRequests()); + // ensure KERBEROS_CLIENT is present in each hostgroup even if it's not in original BP + for(ClusterTopology clusterTopology : clusterTopologyMap.values()) { +if (clusterTopology.isClusterKerberosEnabled()) { + addKerberosClient(clusterTopology); +} + } isInitialized = true; } http://git-wip-us.apache.org/repos/asf/ambari/blob/771274a4/ambari-server/src/test/java/org/apache/ambari/server/topology/TopologyManagerTest.java -- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/topology/TopologyManagerTest.java b/ambari-server/src/test/java/org/apache/ambari/server/topology/TopologyManagerTest.java index cf92911..0d2c731 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/topology/TopologyManagerTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/topology/TopologyManagerTest.java @@ -150,6 +150,9 @@ public class TopologyManagerTest { private ResourceProvider resourceProvider; @Mock(type = MockType.STRICT) private SettingDAO settingDAO; + @Mock(type = MockType.NICE) + private ClusterTopology clusterTopologyMock; + @Mock(type = MockType.STRICT) private Future mockFuture; @@ -343,7 +346,6 @@ public class TopologyManagerTest { persistedState.persistLogicalRequest(logicalRequest, 1); expectLastCall().anyTimes(); - Class clazz = TopologyManager.class; Field f = clazz.getDeclaredField("executor"); @@ -365,12 +367,12 @@ public class TopologyManagerTest { PowerMock.verify(System.class); verify(blueprint, stack, request, group1, group2, ambariContext, logicalRequestFactory, logicalRequest, configurationRequest, configurationRequest2, configurationRequest3, -requestStatusResponse, executor, persistedState, mockFuture, settingDAO); +requestStatusResponse, executor, persistedState, clusterTopologyMock, mockFuture, settingDAO); PowerMock.reset(System.class); reset(blueprint, stack, request, group1, group2, ambariContext, logicalRequestFactory, logicalRequest, configurationRequest, configurationRequest2, configurationRequest3, -requestStatusResponse, executor, persistedState, mockFuture, settingDAO); +requestStatusResponse, executor, persistedState, clusterTopologyMock, mockFuture, settingDAO); } @Test @@ -384,6 +386,29 @@ public class TopologyManagerTest { } @Test + public void testAddKerberosClientAtTopologyInit() throws Exception { +Map> allRequests = new HashMap<>(); +List requestList = new ArrayList<>(); +requestList.add(logicalRequest); +expect(logicalRequest.hasCompleted()).andReturn(true).anyTimes(); +allRequests.put(clusterTopologyMock, requestList); + expect(requestStatusResponse.getTasks()).andReturn(Collections.emptyList()).anyTimes(); +expect(clusterTopologyMock.isClusterKerberosEnabled()).andReturn(true); + expect(clusterTopologyMock.getClusterId()).andReturn(CLUSTER_ID).anyTimes(); +expect
ambari git commit: AMBARI-19961. KERBEROS_CLIENT is not included automatically in all hostgroups when scaling a cluster after server restart (magyari_sandor)
Repository: ambari Updated Branches: refs/heads/trunk 6bb86b103 -> eb1b9cfaa AMBARI-19961. KERBEROS_CLIENT is not included automatically in all hostgroups when scaling a cluster after server restart (magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/eb1b9cfa Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/eb1b9cfa Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/eb1b9cfa Branch: refs/heads/trunk Commit: eb1b9cfaa869e25577b3502b68c08efbbf1cbaf5 Parents: 6bb86b1 Author: Sandor Magyari Authored: Fri Feb 10 22:09:29 2017 +0100 Committer: Sandor Magyari Committed: Tue Feb 14 09:30:29 2017 +0100 -- .../ambari/server/topology/TopologyManager.java | 6 .../server/topology/TopologyManagerTest.java| 35 +--- 2 files changed, 36 insertions(+), 5 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/eb1b9cfa/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyManager.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyManager.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyManager.java index 3103c34..c4c3dd2 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyManager.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyManager.java @@ -174,6 +174,12 @@ public class TopologyManager { synchronized (initializationLock) { if (!isInitialized) { replayRequests(persistedState.getAllRequests()); + // ensure KERBEROS_CLIENT is present in each hostgroup even if it's not in original BP + for(ClusterTopology clusterTopology : clusterTopologyMap.values()) { +if (clusterTopology.isClusterKerberosEnabled()) { + addKerberosClient(clusterTopology); +} + } isInitialized = true; } http://git-wip-us.apache.org/repos/asf/ambari/blob/eb1b9cfa/ambari-server/src/test/java/org/apache/ambari/server/topology/TopologyManagerTest.java -- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/topology/TopologyManagerTest.java b/ambari-server/src/test/java/org/apache/ambari/server/topology/TopologyManagerTest.java index 07060b7..4f087f0 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/topology/TopologyManagerTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/topology/TopologyManagerTest.java @@ -149,6 +149,9 @@ public class TopologyManagerTest { private ResourceProvider resourceProvider; @Mock(type = MockType.STRICT) private SettingDAO settingDAO; + @Mock(type = MockType.NICE) + private ClusterTopology clusterTopologyMock; + @Mock(type = MockType.STRICT) private Future mockFuture; @@ -342,7 +345,6 @@ public class TopologyManagerTest { persistedState.persistLogicalRequest(logicalRequest, 1); expectLastCall().anyTimes(); - Class clazz = TopologyManager.class; Field f = clazz.getDeclaredField("executor"); @@ -364,12 +366,12 @@ public class TopologyManagerTest { PowerMock.verify(System.class); verify(blueprint, stack, request, group1, group2, ambariContext, logicalRequestFactory, logicalRequest, configurationRequest, configurationRequest2, configurationRequest3, -requestStatusResponse, executor, persistedState, mockFuture, settingDAO); +requestStatusResponse, executor, persistedState, clusterTopologyMock, mockFuture, settingDAO); PowerMock.reset(System.class); reset(blueprint, stack, request, group1, group2, ambariContext, logicalRequestFactory, logicalRequest, configurationRequest, configurationRequest2, configurationRequest3, -requestStatusResponse, executor, persistedState, mockFuture, settingDAO); +requestStatusResponse, executor, persistedState, clusterTopologyMock, mockFuture, settingDAO); } @Test @@ -383,6 +385,29 @@ public class TopologyManagerTest { } @Test + public void testAddKerberosClientAtTopologyInit() throws Exception { +Map> allRequests = new HashMap<>(); +List requestList = new ArrayList<>(); +requestList.add(logicalRequest); +expect(logicalRequest.hasCompleted()).andReturn(true).anyTimes(); +allRequests.put(clusterTopologyMock, requestList); + expect(requestStatusResponse.getTasks()).andReturn(Collections.emptyList()).anyTimes(); +expect(clusterTopologyMock.isClusterKerberosEnabled()).andReturn(true); + expect(clusterTopologyMock.getClusterId()).andReturn(CLUSTER_ID).anyTimes(); +expect
ambari git commit: AMBARI-19866. Scale requests are failing after removing services from original components of a hostgroup (magyari_sandor)
Repository: ambari Updated Branches: refs/heads/trunk de420a88a -> 61cebe7c4 AMBARI-19866. Scale requests are failing after removing services from original components of a hostgroup (magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/61cebe7c Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/61cebe7c Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/61cebe7c Branch: refs/heads/trunk Commit: 61cebe7c4ff8f3312d74d3c1e8dce84ec4934d6b Parents: de420a8 Author: Sandor Magyari Authored: Tue Feb 7 15:43:19 2017 +0100 Committer: Sandor Magyari Committed: Thu Feb 9 08:27:32 2017 +0100 -- .../ambari/server/topology/AmbariContext.java | 36 +- .../server/topology/AmbariContextTest.java | 69 +++- 2 files changed, 87 insertions(+), 18 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/61cebe7c/ambari-server/src/main/java/org/apache/ambari/server/topology/AmbariContext.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/AmbariContext.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/AmbariContext.java index 5e887d4..adca3a3 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/topology/AmbariContext.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/AmbariContext.java @@ -186,7 +186,7 @@ public class AmbariContext { }); } catch (AmbariException e) { - e.printStackTrace(); + LOG.error("Failed to create Cluster resource: ", e); throw new RuntimeException("Failed to create Cluster resource: " + e, e); } } @@ -231,14 +231,14 @@ public class AmbariContext { new RequestImpl(null, Collections.singleton(installProps), null, null), predicate); getServiceResourceProvider().updateResources( - new RequestImpl(null, Collections.singleton(startProps), null, null), predicate); +new RequestImpl(null, Collections.singleton(startProps), null, null), predicate); } catch (Exception e) { // just log as this won't prevent cluster from being provisioned correctly LOG.error("Unable to update state of services during cluster provision: " + e, e); } } - public void createAmbariHostResources(long clusterId, String hostName, Map> components) { + public void createAmbariHostResources(long clusterId, String hostName, Map> components) { Host host; try { host = getController().getClusters().getHost(hostName); @@ -248,13 +248,14 @@ public class AmbariContext { "Unable to obtain host instance '%s' when persisting host resources", hostName)); } -String clusterName = null; +Cluster cluster = null; try { - clusterName = getClusterName(clusterId); + cluster = getController().getClusters().getClusterById(clusterId); } catch (AmbariException e) { - LOG.error("Cannot get cluster name for clusterId = " + clusterId, e); + LOG.error("Cannot get cluster for clusterId = " + clusterId, e); throw new RuntimeException(e); } +String clusterName = cluster.getClusterName(); Map properties = new HashMap(); properties.put(HostResourceProvider.HOST_CLUSTER_NAME_PROPERTY_ID, clusterName); @@ -264,18 +265,23 @@ public class AmbariContext { try { getHostResourceProvider().createHosts(new RequestImpl(null, Collections.singleton(properties), null, null)); } catch (AmbariException e) { - e.printStackTrace(); + LOG.error("Unable to create host component resource for host {}", hostName, e); throw new RuntimeException(String.format("Unable to create host resource for host '%s': %s", hostName, e.toString()), e); } final Set requests = new HashSet(); + for (Map.Entry> entry : components.entrySet()) { String service = entry.getKey(); for (String component : entry.getValue()) { //todo: handle this in a generic manner. These checks are all over the code -if (!component.equals("AMBARI_SERVER")) { - requests.add(new ServiceComponentHostRequest(clusterName, service, component, hostName, null)); +try { + if (cluster.getService(service) != null && !component.equals("AMBARI_SERVER")) { +requests.add(new ServiceComponentHostRequest(clusterName, service, component, hostName, null)); + } +} catch(AmbariException se) { + LOG.warn("Service already deleted from cluster: {}", service); } } } @@ -28
ambari git commit: AMBARI-19866. Scale requests are failing after removing services from original components of a hostgroup (magyari_sandor)
Repository: ambari Updated Branches: refs/heads/branch-2.5 66d6e3e95 -> 8bcbf3a5e AMBARI-19866. Scale requests are failing after removing services from original components of a hostgroup (magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/8bcbf3a5 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/8bcbf3a5 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/8bcbf3a5 Branch: refs/heads/branch-2.5 Commit: 8bcbf3a5e2e49920e09b65b3eebd6872f2420c3a Parents: 66d6e3e Author: Sandor Magyari Authored: Tue Feb 7 15:43:19 2017 +0100 Committer: Sandor Magyari Committed: Thu Feb 9 08:34:18 2017 +0100 -- .../ambari/server/topology/AmbariContext.java | 36 +- .../server/topology/AmbariContextTest.java | 69 +++- 2 files changed, 87 insertions(+), 18 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/8bcbf3a5/ambari-server/src/main/java/org/apache/ambari/server/topology/AmbariContext.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/AmbariContext.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/AmbariContext.java index 5e887d4..adca3a3 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/topology/AmbariContext.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/AmbariContext.java @@ -186,7 +186,7 @@ public class AmbariContext { }); } catch (AmbariException e) { - e.printStackTrace(); + LOG.error("Failed to create Cluster resource: ", e); throw new RuntimeException("Failed to create Cluster resource: " + e, e); } } @@ -231,14 +231,14 @@ public class AmbariContext { new RequestImpl(null, Collections.singleton(installProps), null, null), predicate); getServiceResourceProvider().updateResources( - new RequestImpl(null, Collections.singleton(startProps), null, null), predicate); +new RequestImpl(null, Collections.singleton(startProps), null, null), predicate); } catch (Exception e) { // just log as this won't prevent cluster from being provisioned correctly LOG.error("Unable to update state of services during cluster provision: " + e, e); } } - public void createAmbariHostResources(long clusterId, String hostName, Map> components) { + public void createAmbariHostResources(long clusterId, String hostName, Map> components) { Host host; try { host = getController().getClusters().getHost(hostName); @@ -248,13 +248,14 @@ public class AmbariContext { "Unable to obtain host instance '%s' when persisting host resources", hostName)); } -String clusterName = null; +Cluster cluster = null; try { - clusterName = getClusterName(clusterId); + cluster = getController().getClusters().getClusterById(clusterId); } catch (AmbariException e) { - LOG.error("Cannot get cluster name for clusterId = " + clusterId, e); + LOG.error("Cannot get cluster for clusterId = " + clusterId, e); throw new RuntimeException(e); } +String clusterName = cluster.getClusterName(); Map properties = new HashMap(); properties.put(HostResourceProvider.HOST_CLUSTER_NAME_PROPERTY_ID, clusterName); @@ -264,18 +265,23 @@ public class AmbariContext { try { getHostResourceProvider().createHosts(new RequestImpl(null, Collections.singleton(properties), null, null)); } catch (AmbariException e) { - e.printStackTrace(); + LOG.error("Unable to create host component resource for host {}", hostName, e); throw new RuntimeException(String.format("Unable to create host resource for host '%s': %s", hostName, e.toString()), e); } final Set requests = new HashSet(); + for (Map.Entry> entry : components.entrySet()) { String service = entry.getKey(); for (String component : entry.getValue()) { //todo: handle this in a generic manner. These checks are all over the code -if (!component.equals("AMBARI_SERVER")) { - requests.add(new ServiceComponentHostRequest(clusterName, service, component, hostName, null)); +try { + if (cluster.getService(service) != null && !component.equals("AMBARI_SERVER")) { +requests.add(new ServiceComponentHostRequest(clusterName, service, component, hostName, null)); + } +} catch(AmbariException se) { + LOG.warn("Service already deleted from cluster: {}", service); } }
ambari git commit: AMBARI-19879. Updating yarn-env and hadoop-env templates with ZK secure options on stack upgrade (Attila Magyar via magyari_sandor)
Repository: ambari Updated Branches: refs/heads/branch-2.5 f2518aeed -> 8ef31458a AMBARI-19879. Updating yarn-env and hadoop-env templates with ZK secure options on stack upgrade (Attila Magyar via magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/8ef31458 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/8ef31458 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/8ef31458 Branch: refs/heads/branch-2.5 Commit: 8ef31458a989dec5fb2b7f35223dd689fdeaba7b Parents: f2518ae Author: Attila Magyar Authored: Tue Feb 7 14:42:03 2017 +0100 Committer: Sandor Magyari Committed: Tue Feb 7 14:42:03 2017 +0100 -- .../HDFS/2.1.0.2.0/package/scripts/zkfc_slave.py | 3 +-- .../stacks/HDP/2.3/upgrades/config-upgrade.xml| 9 + .../HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml | 12 .../resources/stacks/HDP/2.3/upgrades/upgrade-2.6.xml | 2 ++ .../stacks/HDP/2.4/upgrades/config-upgrade.xml| 8 .../HDP/2.4/upgrades/nonrolling-upgrade-2.6.xml | 14 ++ .../resources/stacks/HDP/2.4/upgrades/upgrade-2.6.xml | 2 ++ .../stacks/HDP/2.5/upgrades/config-upgrade.xml| 8 .../HDP/2.5/upgrades/nonrolling-upgrade-2.6.xml | 13 + .../resources/stacks/HDP/2.5/upgrades/upgrade-2.6.xml | 2 ++ 10 files changed, 71 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/8ef31458/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/zkfc_slave.py -- diff --git a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/zkfc_slave.py b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/zkfc_slave.py index 275d349..74b72c7 100644 --- a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/zkfc_slave.py +++ b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/zkfc_slave.py @@ -39,8 +39,6 @@ from resource_management.libraries.functions.stack_features import check_stack_f from resource_management.libraries.script import Script from resource_management.core.resources.zkmigrator import ZkMigrator - - class ZkfcSlave(Script): def get_component_name(self): import params @@ -62,6 +60,7 @@ class ZkfcSlave(Script): import params env.set_params(params) hdfs("zkfc_slave") +utils.set_up_zkfc_security(params) pass @OsFamilyImpl(os_family=OsFamilyImpl.DEFAULT) http://git-wip-us.apache.org/repos/asf/ambari/blob/8ef31458/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/config-upgrade.xml -- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/config-upgrade.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/config-upgrade.xml index f3e8ddd..f86b03d 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/config-upgrade.xml +++ b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/config-upgrade.xml @@ -375,6 +375,11 @@ + + +hadoop-env + + @@ -504,6 +509,10 @@ + +yarn-env + + http://git-wip-us.apache.org/repos/asf/ambari/blob/8ef31458/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml -- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml index dc53c67..8b7451e 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml +++ b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml @@ -286,6 +286,12 @@ + + + Adding HDFS ZKFC Security ACLs + + + @@ -293,6 +299,12 @@ + + + Adding YARN Security ACLs + + + http://git-wip-us.apache.org/repos/asf/ambari/blob/8ef31458/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.6.xml -- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.6.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.6.xml index 290d3c5..01fc102 100644 --- a/ambari-server/src/main/resourc
ambari git commit: AMBARI-19879. Updating yarn-env and hadoop-env templates with ZK secure options on stack upgrade (Attila Magyar via magyari_sandor)
Repository: ambari Updated Branches: refs/heads/trunk 9b8055cc4 -> 3561cf7be AMBARI-19879. Updating yarn-env and hadoop-env templates with ZK secure options on stack upgrade (Attila Magyar via magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/3561cf7b Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/3561cf7b Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/3561cf7b Branch: refs/heads/trunk Commit: 3561cf7bef0c0ca55ca1b178168bf6a441a8f835 Parents: 9b8055c Author: Attila Magyar Authored: Tue Feb 7 14:31:01 2017 +0100 Committer: Sandor Magyari Committed: Tue Feb 7 14:31:01 2017 +0100 -- .../HDFS/2.1.0.2.0/package/scripts/zkfc_slave.py | 3 +-- .../HDFS/3.0.0.3.0/package/scripts/zkfc_slave.py | 1 + .../stacks/HDP/2.3/upgrades/config-upgrade.xml| 9 + .../HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml | 12 .../resources/stacks/HDP/2.3/upgrades/upgrade-2.6.xml | 2 ++ .../stacks/HDP/2.4/upgrades/config-upgrade.xml| 8 .../HDP/2.4/upgrades/nonrolling-upgrade-2.6.xml | 14 ++ .../resources/stacks/HDP/2.4/upgrades/upgrade-2.6.xml | 2 ++ .../stacks/HDP/2.5/upgrades/config-upgrade.xml| 8 .../HDP/2.5/upgrades/nonrolling-upgrade-2.6.xml | 13 + .../resources/stacks/HDP/2.5/upgrades/upgrade-2.6.xml | 2 ++ 11 files changed, 72 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/3561cf7b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/zkfc_slave.py -- diff --git a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/zkfc_slave.py b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/zkfc_slave.py index c2ff457..be0d2ed 100644 --- a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/zkfc_slave.py +++ b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/zkfc_slave.py @@ -39,8 +39,6 @@ from resource_management.libraries.functions.stack_features import check_stack_f from resource_management.libraries.script import Script from resource_management.core.resources.zkmigrator import ZkMigrator - - class ZkfcSlave(Script): def get_component_name(self): import params @@ -62,6 +60,7 @@ class ZkfcSlave(Script): import params env.set_params(params) hdfs("zkfc_slave") +utils.set_up_zkfc_security(params) pass @OsFamilyImpl(os_family=OsFamilyImpl.DEFAULT) http://git-wip-us.apache.org/repos/asf/ambari/blob/3561cf7b/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/zkfc_slave.py -- diff --git a/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/zkfc_slave.py b/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/zkfc_slave.py index 6a0d71f..19a78c7 100644 --- a/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/zkfc_slave.py +++ b/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/zkfc_slave.py @@ -60,6 +60,7 @@ class ZkfcSlave(Script): import params env.set_params(params) hdfs("zkfc_slave") +utils.set_up_zkfc_security(params) pass @OsFamilyImpl(os_family=OsFamilyImpl.DEFAULT) http://git-wip-us.apache.org/repos/asf/ambari/blob/3561cf7b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/config-upgrade.xml -- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/config-upgrade.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/config-upgrade.xml index f96b246..0277a4e 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/config-upgrade.xml +++ b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/config-upgrade.xml @@ -375,6 +375,11 @@ + + +hadoop-env + + @@ -502,6 +507,10 @@ + +yarn-env + + http://git-wip-us.apache.org/repos/asf/ambari/blob/3561cf7b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml -- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml
ambari git commit: AMBARI-19824. Add consistency checker for blueprint tables (magyari_sandor)
Repository: ambari Updated Branches: refs/heads/branch-2.5 99ec0a7f0 -> 7eac12f20 AMBARI-19824. Add consistency checker for blueprint tables (magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/7eac12f2 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/7eac12f2 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/7eac12f2 Branch: refs/heads/branch-2.5 Commit: 7eac12f20dd46c0a4b6d705b045998d49840a575 Parents: 99ec0a7 Author: Sandor Magyari Authored: Thu Feb 2 00:11:15 2017 +0100 Committer: Sandor Magyari Committed: Fri Feb 3 13:48:06 2017 +0200 -- .../checks/DatabaseConsistencyCheckHelper.java | 78 .../DatabaseConsistencyCheckHelperTest.java | 58 +++ 2 files changed, 136 insertions(+) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/7eac12f2/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java index f424c3e..878d0fa 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java @@ -137,6 +137,7 @@ public class DatabaseConsistencyCheckHelper { checkForHostsWithoutState(); checkHostComponentStatesCountEqualsHostComponentsDesiredStates(); checkServiceConfigs(); +checkTopologyTables(); LOG.info("*** Check database completed ***"); } @@ -342,6 +343,83 @@ public class DatabaseConsistencyCheckHelper { } } + + /** + * This method checks that for each row in topology_request there is at least one row in topology_logical_request, + * topology_host_request, topology_host_task, topology_logical_task. + * */ + public static void checkTopologyTables() { +LOG.info("Checking Topology tables"); + +String SELECT_REQUEST_COUNT_QUERY = "select count(tpr.id) from topology_request tpr"; + +String SELECT_JOINED_COUNT_QUERY = "select count(DISTINCT tpr.id) from topology_request tpr join " + + "topology_logical_request tlr on tpr.id = tlr.request_id join topology_host_request thr on tlr.id = " + + "thr.logical_request_id join topology_host_task tht on thr.id = tht.host_request_id join topology_logical_task " + + "tlt on tht.id = tlt.host_task_id"; + +int topologyRequestCount = 0; +int topologyRequestTablesJoinedCount = 0; + +ResultSet rs = null; +Statement statement = null; + +if (connection == null) { + if (dbAccessor == null) { +dbAccessor = injector.getInstance(DBAccessor.class); + } + connection = dbAccessor.getConnection(); +} + +try { + statement = connection.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); + + rs = statement.executeQuery(SELECT_REQUEST_COUNT_QUERY); + if (rs != null) { +while (rs.next()) { + topologyRequestCount = rs.getInt(1); +} + } + + rs = statement.executeQuery(SELECT_JOINED_COUNT_QUERY); + if (rs != null) { +while (rs.next()) { + topologyRequestTablesJoinedCount = rs.getInt(1); +} + } + + if (topologyRequestCount != topologyRequestTablesJoinedCount) { +LOG.error("Your topology request hierarchy is not complete for each row in topology_request should exist " + + "at least one raw in topology_logical_request, topology_host_request, topology_host_task, " + + "topology_logical_task."); +errorsFound = true; + } + + +} catch (SQLException e) { + LOG.error("Exception occurred during topology request tables check: ", e); +} finally { + if (rs != null) { +try { + rs.close(); +} catch (SQLException e) { + LOG.error("Exception occurred during result set closing procedure: ", e); +} + } + + if (statement != null) { +try { + statement.close(); +} catch (SQLException e) { + LOG.error("Exception occurred during statement closing procedure: ", e); +} + } +} + + } + + + /** * This method checks if count of host component states equals count * of desired host component states. According to ambari logic these http://git-wip-us.apache.o
ambari git commit: AMBARI-19824. Add consistency checker for blueprint tables (magyari_sandor)
Repository: ambari Updated Branches: refs/heads/trunk 779995dd5 -> 4ad3a2b36 AMBARI-19824. Add consistency checker for blueprint tables (magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/4ad3a2b3 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/4ad3a2b3 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/4ad3a2b3 Branch: refs/heads/trunk Commit: 4ad3a2b3611a38aeea3d64411feec8776a6af554 Parents: 779995d Author: Sandor Magyari Authored: Thu Feb 2 00:11:15 2017 +0100 Committer: Sandor Magyari Committed: Fri Feb 3 13:47:01 2017 +0200 -- .../checks/DatabaseConsistencyCheckHelper.java | 78 .../DatabaseConsistencyCheckHelperTest.java | 58 +++ 2 files changed, 136 insertions(+) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/4ad3a2b3/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java index ea5fa15..7aa8652 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java @@ -137,6 +137,7 @@ public class DatabaseConsistencyCheckHelper { checkForHostsWithoutState(); checkHostComponentStates(); checkServiceConfigs(); +checkTopologyTables(); LOG.info("*** Check database completed ***"); } @@ -342,6 +343,83 @@ public class DatabaseConsistencyCheckHelper { } } + + /** + * This method checks that for each row in topology_request there is at least one row in topology_logical_request, + * topology_host_request, topology_host_task, topology_logical_task. + * */ + public static void checkTopologyTables() { +LOG.info("Checking Topology tables"); + +String SELECT_REQUEST_COUNT_QUERY = "select count(tpr.id) from topology_request tpr"; + +String SELECT_JOINED_COUNT_QUERY = "select count(DISTINCT tpr.id) from topology_request tpr join " + + "topology_logical_request tlr on tpr.id = tlr.request_id join topology_host_request thr on tlr.id = " + + "thr.logical_request_id join topology_host_task tht on thr.id = tht.host_request_id join topology_logical_task " + + "tlt on tht.id = tlt.host_task_id"; + +int topologyRequestCount = 0; +int topologyRequestTablesJoinedCount = 0; + +ResultSet rs = null; +Statement statement = null; + +if (connection == null) { + if (dbAccessor == null) { +dbAccessor = injector.getInstance(DBAccessor.class); + } + connection = dbAccessor.getConnection(); +} + +try { + statement = connection.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); + + rs = statement.executeQuery(SELECT_REQUEST_COUNT_QUERY); + if (rs != null) { +while (rs.next()) { + topologyRequestCount = rs.getInt(1); +} + } + + rs = statement.executeQuery(SELECT_JOINED_COUNT_QUERY); + if (rs != null) { +while (rs.next()) { + topologyRequestTablesJoinedCount = rs.getInt(1); +} + } + + if (topologyRequestCount != topologyRequestTablesJoinedCount) { +LOG.error("Your topology request hierarchy is not complete for each row in topology_request should exist " + + "at least one raw in topology_logical_request, topology_host_request, topology_host_task, " + + "topology_logical_task."); +errorsFound = true; + } + + +} catch (SQLException e) { + LOG.error("Exception occurred during topology request tables check: ", e); +} finally { + if (rs != null) { +try { + rs.close(); +} catch (SQLException e) { + LOG.error("Exception occurred during result set closing procedure: ", e); +} + } + + if (statement != null) { +try { + statement.close(); +} catch (SQLException e) { + LOG.error("Exception occurred during statement closing procedure: ", e); +} + } +} + + } + + + /** * This method checks if count of host component states equals count * of desired host component states. According to ambari logic these http://git-wip-us.apache.org/repos/asf/ambari/blob/4ad3a2b3/ambari-server/src/test/java/org/apache/amb
ambari git commit: AMBARI-19749. Run ru_set_all script after installing packages on single host not belonging to any cluster (magyari_sandor)
Repository: ambari Updated Branches: refs/heads/branch-2.5 d6a654e19 -> c12fbcc2d AMBARI-19749. Run ru_set_all script after installing packages on single host not belonging to any cluster (magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/c12fbcc2 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/c12fbcc2 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/c12fbcc2 Branch: refs/heads/branch-2.5 Commit: c12fbcc2d72a120df9abee1d8fe947a7f1fbd72d Parents: d6a654e Author: Sandor Magyari Authored: Fri Jan 27 19:23:10 2017 +0100 Committer: Sandor Magyari Committed: Mon Jan 30 17:10:41 2017 +0100 -- .../HostStackVersionResourceProvider.java | 46 +++- .../HostStackVersionResourceProviderTest.java | 11 + 2 files changed, 56 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/c12fbcc2/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostStackVersionResourceProvider.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostStackVersionResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostStackVersionResourceProvider.java index 364a61e..8f2d4e6 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostStackVersionResourceProvider.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostStackVersionResourceProvider.java @@ -94,6 +94,7 @@ public class HostStackVersionResourceProvider extends AbstractControllerResource /** * Whether to force creating of install command on a host which is not member of any cluster yet. + * This will also run hdp-select for specified stack version. */ protected static final String HOST_STACK_VERSION_FORCE_INSTALL_ON_NON_MEMBER_HOST_PROPERTY_ID = PropertyHelper .getPropertyId("HostStackVersions", "force_non_member_install"); @@ -105,6 +106,7 @@ public class HostStackVersionResourceProvider extends AbstractControllerResource protected static final String COMPONENT_NAME_PROPERTY_ID = "name"; protected static final String INSTALL_PACKAGES_ACTION = "install_packages"; + protected static final String STACK_SELECT_ACTION = "ru_set_all"; protected static final String INSTALL_PACKAGES_FULL_NAME = "Install version"; @@ -303,7 +305,7 @@ public class HostStackVersionResourceProvider extends AbstractControllerResource private RequestStageContainer createInstallPackagesRequest(String hostName, final String desiredRepoVersion, String stackName, String stackVersion, String clName, - boolean forceInstallOnNonMemberHost, + final boolean forceInstallOnNonMemberHost, Set> componentNames) throws NoSuchParentResourceException, SystemException { @@ -523,6 +525,11 @@ public class HostStackVersionResourceProvider extends AbstractControllerResource throw new SystemException("Can not modify stage", e); } +if (forceInstallOnNonMemberHost) { + addSelectStackStage(desiredRepoVersion, forceInstallOnNonMemberHost, cluster, filter, caption, req, +hostLevelParams, clusterHostInfoJson); +} + try { if (!forceInstallOnNonMemberHost) { hostVersEntity.setState(RepositoryVersionState.INSTALLING); @@ -536,6 +543,43 @@ public class HostStackVersionResourceProvider extends AbstractControllerResource return req; } + private void addSelectStackStage(String desiredRepoVersion, boolean forceInstallOnNonMemberHost, Cluster cluster, + RequestResourceFilter filter, String caption, RequestStageContainer req, Map hostLevelParams, String clusterHostInfoJson) throws SystemException { +Stage stage; +long stageId; +ActionExecutionContext actionContext; +Map commandParams = new HashMap(); +commandParams.put("version", desiredRepoVersion); + +stage = stageFactory.createNew(req.getId(), + "/tmp/ambari", + cluster.getClusterName(), + cluster.getClusterId(), + caption, + clusterHostInfoJson, + StageUtils.getGson().toJson(commandParams), + StageUtils.getGson().toJson(hostLevelParams)); + +stageId = req.getLastStageId() + 1; +if (0L == stageId) { + stageId = 1L; +} +stage.setStageId(stageId); +req.addStages(Collections.singlet
ambari git commit: AMBARI-19749. Run ru_set_all script after installing packages on single host not belonging to any cluster (magyari_sandor)
Repository: ambari Updated Branches: refs/heads/trunk d6d247983 -> e4d0fa156 AMBARI-19749. Run ru_set_all script after installing packages on single host not belonging to any cluster (magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/e4d0fa15 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/e4d0fa15 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/e4d0fa15 Branch: refs/heads/trunk Commit: e4d0fa156e6ac41bae7b7020f781d0dae1274894 Parents: d6d2479 Author: Sandor Magyari Authored: Fri Jan 27 19:23:10 2017 +0100 Committer: Sandor Magyari Committed: Mon Jan 30 16:39:58 2017 +0100 -- .../HostStackVersionResourceProvider.java | 46 +++- .../HostStackVersionResourceProviderTest.java | 11 + 2 files changed, 56 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/e4d0fa15/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostStackVersionResourceProvider.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostStackVersionResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostStackVersionResourceProvider.java index 364a61e..8f2d4e6 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostStackVersionResourceProvider.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostStackVersionResourceProvider.java @@ -94,6 +94,7 @@ public class HostStackVersionResourceProvider extends AbstractControllerResource /** * Whether to force creating of install command on a host which is not member of any cluster yet. + * This will also run hdp-select for specified stack version. */ protected static final String HOST_STACK_VERSION_FORCE_INSTALL_ON_NON_MEMBER_HOST_PROPERTY_ID = PropertyHelper .getPropertyId("HostStackVersions", "force_non_member_install"); @@ -105,6 +106,7 @@ public class HostStackVersionResourceProvider extends AbstractControllerResource protected static final String COMPONENT_NAME_PROPERTY_ID = "name"; protected static final String INSTALL_PACKAGES_ACTION = "install_packages"; + protected static final String STACK_SELECT_ACTION = "ru_set_all"; protected static final String INSTALL_PACKAGES_FULL_NAME = "Install version"; @@ -303,7 +305,7 @@ public class HostStackVersionResourceProvider extends AbstractControllerResource private RequestStageContainer createInstallPackagesRequest(String hostName, final String desiredRepoVersion, String stackName, String stackVersion, String clName, - boolean forceInstallOnNonMemberHost, + final boolean forceInstallOnNonMemberHost, Set> componentNames) throws NoSuchParentResourceException, SystemException { @@ -523,6 +525,11 @@ public class HostStackVersionResourceProvider extends AbstractControllerResource throw new SystemException("Can not modify stage", e); } +if (forceInstallOnNonMemberHost) { + addSelectStackStage(desiredRepoVersion, forceInstallOnNonMemberHost, cluster, filter, caption, req, +hostLevelParams, clusterHostInfoJson); +} + try { if (!forceInstallOnNonMemberHost) { hostVersEntity.setState(RepositoryVersionState.INSTALLING); @@ -536,6 +543,43 @@ public class HostStackVersionResourceProvider extends AbstractControllerResource return req; } + private void addSelectStackStage(String desiredRepoVersion, boolean forceInstallOnNonMemberHost, Cluster cluster, + RequestResourceFilter filter, String caption, RequestStageContainer req, Map hostLevelParams, String clusterHostInfoJson) throws SystemException { +Stage stage; +long stageId; +ActionExecutionContext actionContext; +Map commandParams = new HashMap(); +commandParams.put("version", desiredRepoVersion); + +stage = stageFactory.createNew(req.getId(), + "/tmp/ambari", + cluster.getClusterName(), + cluster.getClusterId(), + caption, + clusterHostInfoJson, + StageUtils.getGson().toJson(commandParams), + StageUtils.getGson().toJson(hostLevelParams)); + +stageId = req.getLastStageId() + 1; +if (0L == stageId) { + stageId = 1L; +} +stage.setStageId(stageId); +req.addStages(Collections.singlet
ambari git commit: AMBARI-19662. Unknown attributes should not be allowed in quick link filter definitions (Balazs Bence Sari via magyari_sandor)
Repository: ambari Updated Branches: refs/heads/branch-2.5 4c64ffc44 -> 76a9658a0 AMBARI-19662. Unknown attributes should not be allowed in quick link filter definitions (Balazs Bence Sari via magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/76a9658a Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/76a9658a Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/76a9658a Branch: refs/heads/branch-2.5 Commit: 76a9658a08683645733637f64dff42f71352eb23 Parents: 4c64ffc Author: Balazs Bence Sari Authored: Mon Jan 23 11:54:37 2017 +0100 Committer: Sandor Magyari Committed: Mon Jan 23 12:56:33 2017 +0100 -- .../QuickLinksProfileBuilder.java | 26 +++- .../QuickLinksProfileParser.java| 21 +--- .../QuickLinksProfileBuilderTest.java | 13 -- .../QuickLinksProfileParserTest.java| 11 +++-- .../inconsistent_quicklinks_profile_3.json | 9 +++ 5 files changed, 67 insertions(+), 13 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/76a9658a/ambari-server/src/main/java/org/apache/ambari/server/state/quicklinksprofile/QuickLinksProfileBuilder.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/quicklinksprofile/QuickLinksProfileBuilder.java b/ambari-server/src/main/java/org/apache/ambari/server/state/quicklinksprofile/QuickLinksProfileBuilder.java index fca1155..627b1bc 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/state/quicklinksprofile/QuickLinksProfileBuilder.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/state/quicklinksprofile/QuickLinksProfileBuilder.java @@ -26,10 +26,14 @@ import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Map; +import java.util.Set; import javax.annotation.Nullable; +import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Sets; /** * Class to create a {@link QuickLinksProfile} based on data received in a request @@ -39,6 +43,8 @@ public class QuickLinksProfileBuilder { public static final String NAME = "name"; public static final String COMPONENTS = "components"; public static final String FILTERS = "filters"; + public static final Set ALLOWED_FILTER_ATTRIBUTES = + ImmutableSet.of(VISIBLE, LINK_NAME, LINK_ATTRIBUTE); /** * @@ -102,16 +108,24 @@ public class QuickLinksProfileBuilder { } List filters = new ArrayList<>(); for (Map filterAsMap: (Collection>)filtersRaw) { + Set invalidAttributes = Sets.difference(filterAsMap.keySet(), ALLOWED_FILTER_ATTRIBUTES); + + Preconditions.checkArgument(invalidAttributes.isEmpty(), + "%s%s", + QuickLinksFilterDeserializer.PARSE_ERROR_MESSAGE_INVALID_JSON_TAG, + invalidAttributes); + String linkName = filterAsMap.get(LINK_NAME); String attributeName = filterAsMap.get(LINK_ATTRIBUTE); boolean visible = Boolean.parseBoolean(filterAsMap.get(VISIBLE)); - if (null != linkName && null != attributeName) { -throw new IllegalArgumentException( -String.format("%s link_name: %s, link_attribute: %s", -QuickLinksFilterDeserializer.PARSE_ERROR_MESSAGE, linkName, attributeName)); - } - else if (null != linkName) { + Preconditions.checkArgument(null == linkName || null == attributeName, + "%s link_name: %s, link_attribute: %s", + QuickLinksFilterDeserializer.PARSE_ERROR_MESSAGE_AMBIGUOUS_FILTER, + linkName, + attributeName); + + if (null != linkName) { filters.add(Filter.linkNameFilter(linkName, visible)); } else if (null != attributeName) { http://git-wip-us.apache.org/repos/asf/ambari/blob/76a9658a/ambari-server/src/main/java/org/apache/ambari/server/state/quicklinksprofile/QuickLinksProfileParser.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/quicklinksprofile/QuickLinksProfileParser.java b/ambari-server/src/main/java/org/apache/ambari/server/state/quicklinksprofile/QuickLinksProfileParser.java index 150b7d4..1891061 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/state/quicklinksprofile/QuickLinksProfileParser.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/state/quicklinksprofile/QuickLinksProfileParser.java @@ -20,6 +20,8 @@ package org.apache.ambari.server.state
ambari git commit: AMBARI-19662. Unknown attributes should not be allowed in quick link filter definitions (Balazs Bence Sari via magyari_sandor)
Repository: ambari Updated Branches: refs/heads/trunk 8362dcefd -> 49ba63595 AMBARI-19662. Unknown attributes should not be allowed in quick link filter definitions (Balazs Bence Sari via magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/49ba6359 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/49ba6359 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/49ba6359 Branch: refs/heads/trunk Commit: 49ba635950d2632dcac406e242df94f8a131ce2f Parents: 8362dce Author: Balazs Bence Sari Authored: Mon Jan 23 11:54:37 2017 +0100 Committer: Sandor Magyari Committed: Mon Jan 23 12:55:15 2017 +0100 -- .../QuickLinksProfileBuilder.java | 26 +++- .../QuickLinksProfileParser.java| 21 +--- .../QuickLinksProfileBuilderTest.java | 13 -- .../QuickLinksProfileParserTest.java| 11 +++-- .../inconsistent_quicklinks_profile_3.json | 9 +++ 5 files changed, 67 insertions(+), 13 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/49ba6359/ambari-server/src/main/java/org/apache/ambari/server/state/quicklinksprofile/QuickLinksProfileBuilder.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/quicklinksprofile/QuickLinksProfileBuilder.java b/ambari-server/src/main/java/org/apache/ambari/server/state/quicklinksprofile/QuickLinksProfileBuilder.java index fca1155..627b1bc 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/state/quicklinksprofile/QuickLinksProfileBuilder.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/state/quicklinksprofile/QuickLinksProfileBuilder.java @@ -26,10 +26,14 @@ import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Map; +import java.util.Set; import javax.annotation.Nullable; +import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Sets; /** * Class to create a {@link QuickLinksProfile} based on data received in a request @@ -39,6 +43,8 @@ public class QuickLinksProfileBuilder { public static final String NAME = "name"; public static final String COMPONENTS = "components"; public static final String FILTERS = "filters"; + public static final Set ALLOWED_FILTER_ATTRIBUTES = + ImmutableSet.of(VISIBLE, LINK_NAME, LINK_ATTRIBUTE); /** * @@ -102,16 +108,24 @@ public class QuickLinksProfileBuilder { } List filters = new ArrayList<>(); for (Map filterAsMap: (Collection>)filtersRaw) { + Set invalidAttributes = Sets.difference(filterAsMap.keySet(), ALLOWED_FILTER_ATTRIBUTES); + + Preconditions.checkArgument(invalidAttributes.isEmpty(), + "%s%s", + QuickLinksFilterDeserializer.PARSE_ERROR_MESSAGE_INVALID_JSON_TAG, + invalidAttributes); + String linkName = filterAsMap.get(LINK_NAME); String attributeName = filterAsMap.get(LINK_ATTRIBUTE); boolean visible = Boolean.parseBoolean(filterAsMap.get(VISIBLE)); - if (null != linkName && null != attributeName) { -throw new IllegalArgumentException( -String.format("%s link_name: %s, link_attribute: %s", -QuickLinksFilterDeserializer.PARSE_ERROR_MESSAGE, linkName, attributeName)); - } - else if (null != linkName) { + Preconditions.checkArgument(null == linkName || null == attributeName, + "%s link_name: %s, link_attribute: %s", + QuickLinksFilterDeserializer.PARSE_ERROR_MESSAGE_AMBIGUOUS_FILTER, + linkName, + attributeName); + + if (null != linkName) { filters.add(Filter.linkNameFilter(linkName, visible)); } else if (null != attributeName) { http://git-wip-us.apache.org/repos/asf/ambari/blob/49ba6359/ambari-server/src/main/java/org/apache/ambari/server/state/quicklinksprofile/QuickLinksProfileParser.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/quicklinksprofile/QuickLinksProfileParser.java b/ambari-server/src/main/java/org/apache/ambari/server/state/quicklinksprofile/QuickLinksProfileParser.java index 150b7d4..1891061 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/state/quicklinksprofile/QuickLinksProfileParser.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/state/quicklinksprofile/QuickLinksProfileParser.java @@ -20,6 +20,8 @@ package org.apache.ambari.server.state
ambari git commit: AMBARI-19613. ZKFC Zookeper connection is not secure (Laszlo Puskas via magyari_sandor)
Repository: ambari Updated Branches: refs/heads/branch-2.5 5e6265857 -> 00b2c42cc AMBARI-19613. ZKFC Zookeper connection is not secure (Laszlo Puskas via magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/00b2c42c Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/00b2c42c Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/00b2c42c Branch: refs/heads/branch-2.5 Commit: 00b2c42ccf6fe68267483a645f6e57e9c921f01b Parents: 5e62658 Author: Laszlo Puskas Authored: Fri Jan 20 14:04:06 2017 +0100 Committer: Sandor Magyari Committed: Fri Jan 20 14:04:06 2017 +0100 -- .../HDFS/2.1.0.2.0/configuration/hadoop-env.xml | 5 .../HDFS/2.1.0.2.0/kerberos.json| 3 ++- .../HDFS/2.1.0.2.0/package/scripts/utils.py | 26 +-- .../2.1.0.2.0/package/scripts/zkfc_slave.py | 7 +++-- .../package/templates/hdfs_jaas.conf.j2 | 27 .../2.0.6/hooks/before-ANY/scripts/params.py| 12 ++--- .../services/HDFS/configuration/hadoop-env.xml | 5 .../services/HDFS/configuration/hadoop-env.xml | 5 .../services/HDFS/configuration/hadoop-env.xml | 5 .../stacks/HDP/2.5/services/HDFS/kerberos.json | 3 ++- .../test/python/stacks/2.0.6/HDFS/test_zkfc.py | 7 + 11 files changed, 96 insertions(+), 9 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/00b2c42c/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/configuration/hadoop-env.xml -- diff --git a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/configuration/hadoop-env.xml b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/configuration/hadoop-env.xml index c2f37c1..c2a7d9c 100644 --- a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/configuration/hadoop-env.xml +++ b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/configuration/hadoop-env.xml @@ -376,6 +376,11 @@ if [ "$command" == "datanode" ] && [ "$EUID" -eq 0 ] && [ -n "$H ulimit -l {{datanode_max_locked_memory}} fi {% endif %} + +# Enable ACLs on zookeper znodes if required +{% if hadoop_zkfc_opts is defined %} + export HADOOP_ZKFC_OPTS="{{hadoop_zkfc_opts}} $HADOOP_ZKFC_OPTS" +{% endif %} content http://git-wip-us.apache.org/repos/asf/ambari/blob/00b2c42c/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/kerberos.json -- diff --git a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/kerberos.json b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/kerberos.json index 3cb83ae..630c200 100644 --- a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/kerberos.json +++ b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/kerberos.json @@ -24,7 +24,8 @@ "core-site": { "hadoop.security.authentication": "kerberos", "hadoop.security.authorization": "true", -"hadoop.proxyuser.HTTP.groups": "${hadoop-env/proxyuser_group}" +"hadoop.proxyuser.HTTP.groups": "${hadoop-env/proxyuser_group}", +"ha.zookeeper.acl":"sasl:nn:rwcda" } } ], http://git-wip-us.apache.org/repos/asf/ambari/blob/00b2c42c/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/utils.py -- diff --git a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/utils.py b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/utils.py index 9ea4fe4..03aba7b 100644 --- a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/utils.py +++ b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/utils.py @@ -28,12 +28,12 @@ from resource_management.libraries.functions import StackFeature from resource_management.libraries.functions.stack_features import check_stack_feature from resource_management.core import shell from resource_management.core.shell import as_user, as_sudo +from resource_management.core.source import Template from resource_management.core.exceptions import ComponentIsNotRunning from resource_management.core.logger import Logger from resource_management.libraries.functions.curl_krb_request import curl_krb_request -from resource_management.core.exceptions import Fail -from resource_management.libraries.functions.nameno
ambari git commit: AMBARI-19585. Client config tags may not be saved by agent (Attila Doroszlai via magyari_sandor)
Repository: ambari Updated Branches: refs/heads/branch-2.5 4fb628cf4 -> 8635714c1 AMBARI-19585. Client config tags may not be saved by agent (Attila Doroszlai via magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/8635714c Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/8635714c Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/8635714c Branch: refs/heads/branch-2.5 Commit: 8635714c159803383ddc3559542b3445f4608212 Parents: 4fb628c Author: Attila Doroszlai Authored: Wed Jan 18 16:42:44 2017 +0100 Committer: Sandor Magyari Committed: Wed Jan 18 16:50:06 2017 +0100 -- .../src/main/python/ambari_agent/Controller.py | 20 +++-- .../test/python/ambari_agent/TestActionQueue.py | 43 .../test/python/ambari_agent/TestController.py | 20 + 3 files changed, 72 insertions(+), 11 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/8635714c/ambari-agent/src/main/python/ambari_agent/Controller.py -- diff --git a/ambari-agent/src/main/python/ambari_agent/Controller.py b/ambari-agent/src/main/python/ambari_agent/Controller.py index 09ab1e6..09f15de 100644 --- a/ambari-agent/src/main/python/ambari_agent/Controller.py +++ b/ambari-agent/src/main/python/ambari_agent/Controller.py @@ -246,6 +246,8 @@ class Controller(threading.Thread): else: """Only add to the queue if not empty list """ logger.info("Adding %s commands. Heartbeat id = %s", len(commands), self.responseId) + if 'clusterName' in commands[0].keys(): +self.updateComponents(commands[0]['clusterName']) self.actionQueue.put(commands) def addToStatusQueue(self, commands): @@ -253,7 +255,7 @@ class Controller(threading.Thread): logger.debug("No status commands received from %s", self.serverHostname) else: logger.info("Adding %s status commands. Heartbeat id = %s", len(commands), self.responseId) - if not LiveStatus.SERVICES: + if 'clusterName' in commands[0].keys(): self.updateComponents(commands[0]['clusterName']) self.recovery_manager.process_status_commands(commands) self.actionQueue.put_status(commands) @@ -568,19 +570,29 @@ class Controller(threading.Thread): def updateComponents(self, cluster_name): +if LiveStatus.SERVICES: + return + logger.debug("Updating components map of cluster " + cluster_name) # May throw IOError on server connection error response = self.sendRequest(self.componentsUrl + cluster_name, None) logger.debug("Response from %s was %s", self.serverHostname, str(response)) +services, client_components, server_components = [], [], [] for service, components in response['components'].items(): - LiveStatus.SERVICES.append(service) + services.append(service) for component, category in components.items(): +service_component = {"serviceName": service, "componentName": component} if category == 'CLIENT': - LiveStatus.CLIENT_COMPONENTS.append({"serviceName": service, "componentName": component}) + client_components.append(service_component) else: - LiveStatus.COMPONENTS.append({"serviceName": service, "componentName": component}) + server_components.append(service_component) + +LiveStatus.SERVICES = services +LiveStatus.CLIENT_COMPONENTS = client_components +LiveStatus.COMPONENTS = server_components + logger.debug("Components map updated") logger.debug("LiveStatus.SERVICES" + str(LiveStatus.SERVICES)) logger.debug("LiveStatus.CLIENT_COMPONENTS" + str(LiveStatus.CLIENT_COMPONENTS)) http://git-wip-us.apache.org/repos/asf/ambari/blob/8635714c/ambari-agent/src/test/python/ambari_agent/TestActionQueue.py -- diff --git a/ambari-agent/src/test/python/ambari_agent/TestActionQueue.py b/ambari-agent/src/test/python/ambari_agent/TestActionQueue.py index d4f5436..9fefefb 100644 --- a/ambari-agent/src/test/python/ambari_agent/TestActionQueue.py +++ b/ambari-agent/src/test/python/ambari_agent/TestActionQueue.py @@ -930,6 +930,49 @@ class TestActionQueue(TestCase): self.assertTrue(write_actual_component_mock.called) @patch.object(OSCheck, "os_distribution", new = MagicMock(return_value = os_distro_value)) + @patch.object(ActualConfigHandler, "write_actual_component") + @patch.object(CustomServiceOrc
ambari git commit: AMBARI-19585. Client config tags may not be saved by agent (Attila Doroszlai via magyari_sandor)
Repository: ambari Updated Branches: refs/heads/trunk d7f1e8c00 -> 753a5b036 AMBARI-19585. Client config tags may not be saved by agent (Attila Doroszlai via magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/753a5b03 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/753a5b03 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/753a5b03 Branch: refs/heads/trunk Commit: 753a5b0362c53b1d8677ff5cf0806ac1058baf4b Parents: d7f1e8c Author: Attila Doroszlai Authored: Wed Jan 18 16:42:44 2017 +0100 Committer: Sandor Magyari Committed: Wed Jan 18 16:42:44 2017 +0100 -- .../src/main/python/ambari_agent/Controller.py | 20 +++-- .../test/python/ambari_agent/TestActionQueue.py | 43 .../test/python/ambari_agent/TestController.py | 20 + 3 files changed, 72 insertions(+), 11 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/753a5b03/ambari-agent/src/main/python/ambari_agent/Controller.py -- diff --git a/ambari-agent/src/main/python/ambari_agent/Controller.py b/ambari-agent/src/main/python/ambari_agent/Controller.py index d00ffae..6370715 100644 --- a/ambari-agent/src/main/python/ambari_agent/Controller.py +++ b/ambari-agent/src/main/python/ambari_agent/Controller.py @@ -246,6 +246,8 @@ class Controller(threading.Thread): else: """Only add to the queue if not empty list """ logger.info("Adding %s commands. Heartbeat id = %s", len(commands), self.responseId) + if 'clusterName' in commands[0].keys(): +self.updateComponents(commands[0]['clusterName']) self.actionQueue.put(commands) def addToStatusQueue(self, commands): @@ -253,7 +255,7 @@ class Controller(threading.Thread): logger.debug("No status commands received from %s", self.serverHostname) else: logger.info("Adding %s status commands. Heartbeat id = %s", len(commands), self.responseId) - if not LiveStatus.SERVICES: + if 'clusterName' in commands[0].keys(): self.updateComponents(commands[0]['clusterName']) self.recovery_manager.process_status_commands(commands) self.actionQueue.put_status(commands) @@ -568,19 +570,29 @@ class Controller(threading.Thread): def updateComponents(self, cluster_name): +if LiveStatus.SERVICES: + return + logger.debug("Updating components map of cluster " + cluster_name) # May throw IOError on server connection error response = self.sendRequest(self.componentsUrl + cluster_name, None) logger.debug("Response from %s was %s", self.serverHostname, str(response)) +services, client_components, server_components = [], [], [] for service, components in response['components'].items(): - LiveStatus.SERVICES.append(service) + services.append(service) for component, category in components.items(): +service_component = {"serviceName": service, "componentName": component} if category == 'CLIENT': - LiveStatus.CLIENT_COMPONENTS.append({"serviceName": service, "componentName": component}) + client_components.append(service_component) else: - LiveStatus.COMPONENTS.append({"serviceName": service, "componentName": component}) + server_components.append(service_component) + +LiveStatus.SERVICES = services +LiveStatus.CLIENT_COMPONENTS = client_components +LiveStatus.COMPONENTS = server_components + logger.debug("Components map updated") logger.debug("LiveStatus.SERVICES" + str(LiveStatus.SERVICES)) logger.debug("LiveStatus.CLIENT_COMPONENTS" + str(LiveStatus.CLIENT_COMPONENTS)) http://git-wip-us.apache.org/repos/asf/ambari/blob/753a5b03/ambari-agent/src/test/python/ambari_agent/TestActionQueue.py -- diff --git a/ambari-agent/src/test/python/ambari_agent/TestActionQueue.py b/ambari-agent/src/test/python/ambari_agent/TestActionQueue.py index d4f5436..9fefefb 100644 --- a/ambari-agent/src/test/python/ambari_agent/TestActionQueue.py +++ b/ambari-agent/src/test/python/ambari_agent/TestActionQueue.py @@ -930,6 +930,49 @@ class TestActionQueue(TestCase): self.assertTrue(write_actual_component_mock.called) @patch.object(OSCheck, "os_distribution", new = MagicMock(return_value = os_distro_value)) + @patch.object(ActualConfigHandler, "write_actual_component") + @patch.object(CustomServiceOrchestrator, "runCommand&
ambari git commit: AMBARI-19423. Change HostStackVersionResourceProvider to be able to install packages on single host not belonging to any cluster (magyari_sandor)
Repository: ambari Updated Branches: refs/heads/branch-2.5 53a39695a -> 4a7ed3c29 AMBARI-19423. Change HostStackVersionResourceProvider to be able to install packages on single host not belonging to any cluster (magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/4a7ed3c2 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/4a7ed3c2 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/4a7ed3c2 Branch: refs/heads/branch-2.5 Commit: 4a7ed3c29e6f32d6bfb53da0ab990bc0a5de87d0 Parents: 53a3969 Author: Sandor Magyari Authored: Wed Jan 4 13:44:25 2017 +0100 Committer: Sandor Magyari Committed: Wed Jan 18 12:02:09 2017 +0100 -- .../controller/AmbariActionExecutionHelper.java | 33 -- .../HostStackVersionResourceProvider.java | 117 +++ .../HostStackVersionResourceProviderTest.java | 96 +++ 3 files changed, 211 insertions(+), 35 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/4a7ed3c2/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariActionExecutionHelper.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariActionExecutionHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariActionExecutionHelper.java index 4fa942f..ec0f7d0 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariActionExecutionHelper.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariActionExecutionHelper.java @@ -227,17 +227,28 @@ public class AmbariActionExecutionHelper { || targetHostType.equals(TargetHostType.MAJORITY); } - /** * Add tasks to the stage based on the requested action execution - * * @param actionContext the context associated with the action * @param stage stage into which tasks must be inserted * @param requestParams all request parameters (may be null) * @throws AmbariException if the task can not be added */ public void addExecutionCommandsToStage(final ActionExecutionContext actionContext, Stage stage, - Map requestParams) + Map requestParams) throws AmbariException { +addExecutionCommandsToStage(actionContext, stage, requestParams, true); + } + + /** + * Add tasks to the stage based on the requested action execution + * @param actionContext + * @param stage + * @param requestParams + * @param checkHostIsMemberOfCluster if true AmbariException will be thrown in case host is not member of cluster. + * @throws AmbariException + */ + public void addExecutionCommandsToStage(final ActionExecutionContext actionContext, Stage stage, + Map requestParams, boolean checkHostIsMemberOfCluster) throws AmbariException { String actionName = actionContext.getActionName(); @@ -331,13 +342,15 @@ public class AmbariActionExecutionHelper { + "actionName=" + actionContext.getActionName()); } -// Compare specified hosts to available hosts -if (!resourceFilter.getHostNames().isEmpty() && !candidateHosts.isEmpty()) { - for (String hostname : resourceFilter.getHostNames()) { -if (!candidateHosts.contains(hostname)) { - throw new AmbariException("Request specifies host " + hostname + -" but it is not a valid host based on the " + -"target service=" + serviceName + " and component=" + componentName); +if (checkHostIsMemberOfCluster) { + // Compare specified hosts to available hosts + if (!resourceFilter.getHostNames().isEmpty() && !candidateHosts.isEmpty()) { +for (String hostname : resourceFilter.getHostNames()) { + if (!candidateHosts.contains(hostname)) { +throw new AmbariException("Request specifies host " + hostname + + " but it is not a valid host based on the " + + "target service=" + serviceName + " and component=" + componentName); + } } } } http://git-wip-us.apache.org/repos/asf/ambari/blob/4a7ed3c2/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostStackVersionResourceProvider.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostStackVersionResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostStackVersionResourceProvider.java
ambari git commit: AMBARI-19423. Change HostStackVersionResourceProvider to be able to install packages on single host not belonging to any cluster (magyari_sandor)
Repository: ambari Updated Branches: refs/heads/trunk ed93a5628 -> f684c2b87 AMBARI-19423. Change HostStackVersionResourceProvider to be able to install packages on single host not belonging to any cluster (magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/f684c2b8 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/f684c2b8 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/f684c2b8 Branch: refs/heads/trunk Commit: f684c2b874c54108e8a313361a0ee8f856ff7dee Parents: ed93a56 Author: Sandor Magyari Authored: Wed Jan 4 13:44:25 2017 +0100 Committer: Sandor Magyari Committed: Wed Jan 18 11:56:40 2017 +0100 -- .../controller/AmbariActionExecutionHelper.java | 33 -- .../HostStackVersionResourceProvider.java | 117 +++ .../HostStackVersionResourceProviderTest.java | 96 +++ 3 files changed, 211 insertions(+), 35 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/f684c2b8/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariActionExecutionHelper.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariActionExecutionHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariActionExecutionHelper.java index 4fa942f..ec0f7d0 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariActionExecutionHelper.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariActionExecutionHelper.java @@ -227,17 +227,28 @@ public class AmbariActionExecutionHelper { || targetHostType.equals(TargetHostType.MAJORITY); } - /** * Add tasks to the stage based on the requested action execution - * * @param actionContext the context associated with the action * @param stage stage into which tasks must be inserted * @param requestParams all request parameters (may be null) * @throws AmbariException if the task can not be added */ public void addExecutionCommandsToStage(final ActionExecutionContext actionContext, Stage stage, - Map requestParams) + Map requestParams) throws AmbariException { +addExecutionCommandsToStage(actionContext, stage, requestParams, true); + } + + /** + * Add tasks to the stage based on the requested action execution + * @param actionContext + * @param stage + * @param requestParams + * @param checkHostIsMemberOfCluster if true AmbariException will be thrown in case host is not member of cluster. + * @throws AmbariException + */ + public void addExecutionCommandsToStage(final ActionExecutionContext actionContext, Stage stage, + Map requestParams, boolean checkHostIsMemberOfCluster) throws AmbariException { String actionName = actionContext.getActionName(); @@ -331,13 +342,15 @@ public class AmbariActionExecutionHelper { + "actionName=" + actionContext.getActionName()); } -// Compare specified hosts to available hosts -if (!resourceFilter.getHostNames().isEmpty() && !candidateHosts.isEmpty()) { - for (String hostname : resourceFilter.getHostNames()) { -if (!candidateHosts.contains(hostname)) { - throw new AmbariException("Request specifies host " + hostname + -" but it is not a valid host based on the " + -"target service=" + serviceName + " and component=" + componentName); +if (checkHostIsMemberOfCluster) { + // Compare specified hosts to available hosts + if (!resourceFilter.getHostNames().isEmpty() && !candidateHosts.isEmpty()) { +for (String hostname : resourceFilter.getHostNames()) { + if (!candidateHosts.contains(hostname)) { +throw new AmbariException("Request specifies host " + hostname + + " but it is not a valid host based on the " + + "target service=" + serviceName + " and component=" + componentName); + } } } } http://git-wip-us.apache.org/repos/asf/ambari/blob/f684c2b8/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostStackVersionResourceProvider.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostStackVersionResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostStackVersionResourceProvider.java
ambari git commit: AMBARI-19414. Cannot install Accumulo via blueprint with default settings (Attila Doroszlai via magyari_sandor)
Repository: ambari Updated Branches: refs/heads/trunk bd0237636 -> a4015da1b AMBARI-19414. Cannot install Accumulo via blueprint with default settings (Attila Doroszlai via magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/a4015da1 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/a4015da1 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/a4015da1 Branch: refs/heads/trunk Commit: a4015da1be687b7a1c0e296c893356403d876127 Parents: bd02376 Author: Attila Doroszlai Authored: Mon Jan 16 15:51:26 2017 +0100 Committer: Sandor Magyari Committed: Mon Jan 16 15:51:26 2017 +0100 -- .../1.6.1.2.2.0/package/scripts/accumulo_script.py| 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/a4015da1/ambari-server/src/main/resources/common-services/ACCUMULO/1.6.1.2.2.0/package/scripts/accumulo_script.py -- diff --git a/ambari-server/src/main/resources/common-services/ACCUMULO/1.6.1.2.2.0/package/scripts/accumulo_script.py b/ambari-server/src/main/resources/common-services/ACCUMULO/1.6.1.2.2.0/package/scripts/accumulo_script.py index f9d5fce..01fbce2 100644 --- a/ambari-server/src/main/resources/common-services/ACCUMULO/1.6.1.2.2.0/package/scripts/accumulo_script.py +++ b/ambari-server/src/main/resources/common-services/ACCUMULO/1.6.1.2.2.0/package/scripts/accumulo_script.py @@ -48,11 +48,7 @@ class AccumuloScript(Script): } def __init__(self, component): -import status_params -env.set_params(status_params) - self.component = component -self.pid_file = format("{pid_dir}/accumulo-{accumulo_user}-{component}.pid") def get_component_name(self): @@ -98,7 +94,8 @@ class AccumuloScript(Script): import status_params env.set_params(status_params) -check_process_status(self.pid_file) +pid_file = self.get_pid_files()[0] +check_process_status(pid_file) def pre_upgrade_restart(self, env, upgrade_type=None): @@ -179,9 +176,12 @@ class AccumuloScript(Script): def get_pid_files(self): import status_params -env.set_params(status_params) -return [self.pid_file] +pid_file = "{pid_dir}/accumulo-{accumulo_user}-{component}.pid".format( +pid_dir = status_params.pid_dir, +accumulo_user = status_params.accumulo_user, +component = self.component) +return [pid_file] def get_user(self): import params
ambari git commit: AMBARI-19293. Component install and after-install should not run in parallel (Attila Doroszlai via magyari_sandor)
Repository: ambari Updated Branches: refs/heads/branch-2.5 51408ab69 -> b117a56b1 AMBARI-19293. Component install and after-install should not run in parallel (Attila Doroszlai via magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/b117a56b Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/b117a56b Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/b117a56b Branch: refs/heads/branch-2.5 Commit: b117a56b1326eaa8db0929aacde21906543d7ec7 Parents: 51408ab Author: Attila Doroszlai Authored: Fri Jan 13 13:55:43 2017 +0100 Committer: Sandor Magyari Committed: Fri Jan 13 14:03:02 2017 +0100 -- .../libraries/script/script.py | 26 .../2.0.6/hooks/after-INSTALL/scripts/params.py | 3 ++- 2 files changed, 28 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/b117a56b/ambari-common/src/main/python/resource_management/libraries/script/script.py -- diff --git a/ambari-common/src/main/python/resource_management/libraries/script/script.py b/ambari-common/src/main/python/resource_management/libraries/script/script.py index 9f1bb11..6fb7b2e 100644 --- a/ambari-common/src/main/python/resource_management/libraries/script/script.py +++ b/ambari-common/src/main/python/resource_management/libraries/script/script.py @@ -55,6 +55,7 @@ from contextlib import closing from resource_management.libraries.functions.stack_features import check_stack_feature from resource_management.libraries.functions.constants import StackFeature from resource_management.libraries.functions.show_logs import show_logs +from resource_management.libraries.functions.fcntl_based_process_lock import FcntlBasedProcessLock import ambari_simplejson as json # simplejson is much faster comparing to Python 2.6 json module and has the same functions set. @@ -94,7 +95,32 @@ def get_path_from_configuration(name, configuration): return configuration +def get_config_lock_file(): + return os.path.join(Script.get_tmp_dir(), "link_configs_lock_file") + +class LockedConfigureMeta(type): + ''' + This metaclass ensures that Script.configure() is invoked with a fcntl-based process lock + if necessary (when Ambari Agent is configured to execute tasks concurrently) for all subclasses. + ''' + def __new__(meta, classname, supers, classdict): +if 'configure' in classdict: + original_configure = classdict['configure'] + + def locking_configure(obj, *args, **kw): +# local import to avoid circular dependency (default imports Script) +from resource_management.libraries.functions.default import default +parallel_execution_enabled = int(default("/agentConfigParams/agent/parallel_execution", 0)) == 1 +lock = FcntlBasedProcessLock(get_config_lock_file(), skip_fcntl_failures = True, enabled = parallel_execution_enabled) +with lock: + original_configure(obj, *args, **kw) + + classdict['configure'] = locking_configure + +return type.__new__(meta, classname, supers, classdict) + class Script(object): + __metaclass__ = LockedConfigureMeta instance = None http://git-wip-us.apache.org/repos/asf/ambari/blob/b117a56b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/after-INSTALL/scripts/params.py -- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/after-INSTALL/scripts/params.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/after-INSTALL/scripts/params.py index ed34217..1782298 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/after-INSTALL/scripts/params.py +++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/after-INSTALL/scripts/params.py @@ -21,6 +21,7 @@ import os from ambari_commons.constants import AMBARI_SUDO_BINARY from resource_management.libraries.script import Script +from resource_management.libraries.script.script import get_config_lock_file from resource_management.libraries.functions import default from resource_management.libraries.functions import conf_select from resource_management.libraries.functions import stack_select @@ -96,7 +97,7 @@ has_namenode = not len(namenode_host) == 0 if has_namenode or dfs_type == 'HCFS': hadoop_conf_dir = conf_select.get_hadoop_conf_dir(force_latest_on_upgrade=True) -link_configs_lock_file = os.path.join(tmp_dir, "link_configs_lock_file") +link_configs_lock_file = get_config_lock_file() stack_select_lock_file = os.path.join(tmp_dir, "stack_select_lock_file") upgrade_suspended = default("/roleParams/upgrade_suspended", False)
ambari git commit: AMBARI-19293. Component install and after-install should not run in parallel (Attila Doroszlai via magyari_sandor)
Repository: ambari Updated Branches: refs/heads/trunk f0e829973 -> e5d17bc75 AMBARI-19293. Component install and after-install should not run in parallel (Attila Doroszlai via magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/e5d17bc7 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/e5d17bc7 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/e5d17bc7 Branch: refs/heads/trunk Commit: e5d17bc75c3d47b9f2979e26b4a011dd9e494398 Parents: f0e8299 Author: Attila Doroszlai Authored: Fri Jan 13 13:46:06 2017 +0100 Committer: Sandor Magyari Committed: Fri Jan 13 13:46:06 2017 +0100 -- .../libraries/script/script.py | 26 .../2.0.6/hooks/after-INSTALL/scripts/params.py | 3 ++- .../3.0/hooks/after-INSTALL/scripts/params.py | 3 ++- 3 files changed, 30 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/e5d17bc7/ambari-common/src/main/python/resource_management/libraries/script/script.py -- diff --git a/ambari-common/src/main/python/resource_management/libraries/script/script.py b/ambari-common/src/main/python/resource_management/libraries/script/script.py index ccb09c7..6eec3cc 100644 --- a/ambari-common/src/main/python/resource_management/libraries/script/script.py +++ b/ambari-common/src/main/python/resource_management/libraries/script/script.py @@ -56,6 +56,7 @@ from contextlib import closing from resource_management.libraries.functions.stack_features import check_stack_feature from resource_management.libraries.functions.constants import StackFeature from resource_management.libraries.functions.show_logs import show_logs +from resource_management.libraries.functions.fcntl_based_process_lock import FcntlBasedProcessLock import ambari_simplejson as json # simplejson is much faster comparing to Python 2.6 json module and has the same functions set. @@ -95,7 +96,32 @@ def get_path_from_configuration(name, configuration): return configuration +def get_config_lock_file(): + return os.path.join(Script.get_tmp_dir(), "link_configs_lock_file") + +class LockedConfigureMeta(type): + ''' + This metaclass ensures that Script.configure() is invoked with a fcntl-based process lock + if necessary (when Ambari Agent is configured to execute tasks concurrently) for all subclasses. + ''' + def __new__(meta, classname, supers, classdict): +if 'configure' in classdict: + original_configure = classdict['configure'] + + def locking_configure(obj, *args, **kw): +# local import to avoid circular dependency (default imports Script) +from resource_management.libraries.functions.default import default +parallel_execution_enabled = int(default("/agentConfigParams/agent/parallel_execution", 0)) == 1 +lock = FcntlBasedProcessLock(get_config_lock_file(), skip_fcntl_failures = True, enabled = parallel_execution_enabled) +with lock: + original_configure(obj, *args, **kw) + + classdict['configure'] = locking_configure + +return type.__new__(meta, classname, supers, classdict) + class Script(object): + __metaclass__ = LockedConfigureMeta instance = None http://git-wip-us.apache.org/repos/asf/ambari/blob/e5d17bc7/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/after-INSTALL/scripts/params.py -- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/after-INSTALL/scripts/params.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/after-INSTALL/scripts/params.py index ed34217..1782298 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/after-INSTALL/scripts/params.py +++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/after-INSTALL/scripts/params.py @@ -21,6 +21,7 @@ import os from ambari_commons.constants import AMBARI_SUDO_BINARY from resource_management.libraries.script import Script +from resource_management.libraries.script.script import get_config_lock_file from resource_management.libraries.functions import default from resource_management.libraries.functions import conf_select from resource_management.libraries.functions import stack_select @@ -96,7 +97,7 @@ has_namenode = not len(namenode_host) == 0 if has_namenode or dfs_type == 'HCFS': hadoop_conf_dir = conf_select.get_hadoop_conf_dir(force_latest_on_upgrade=True) -link_configs_lock_file = os.path.join(tmp_dir, "link_configs_lock_file") +link_configs_lock_file = get_config_lock_file() stack_select_lock_file = os.path.join(tmp_dir, "sta
ambari git commit: AMBARI-19201. Log size of status command queue size on Ambari agent (magyari_sandor)
Repository: ambari Updated Branches: refs/heads/branch-2.5 ae3a53905 -> 5e9d42cd9 AMBARI-19201. Log size of status command queue size on Ambari agent (magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/5e9d42cd Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/5e9d42cd Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/5e9d42cd Branch: refs/heads/branch-2.5 Commit: 5e9d42cd9ffb92c884935ea4fa75476c40c84f43 Parents: ae3a539 Author: Sandor Magyari Authored: Thu Dec 15 14:25:29 2016 +0100 Committer: Sandor Magyari Committed: Fri Dec 16 21:48:12 2016 +0100 -- ambari-agent/src/main/python/ambari_agent/ActionQueue.py | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/5e9d42cd/ambari-agent/src/main/python/ambari_agent/ActionQueue.py -- diff --git a/ambari-agent/src/main/python/ambari_agent/ActionQueue.py b/ambari-agent/src/main/python/ambari_agent/ActionQueue.py index cc10728..5c79a86 100644 --- a/ambari-agent/src/main/python/ambari_agent/ActionQueue.py +++ b/ambari-agent/src/main/python/ambari_agent/ActionQueue.py @@ -95,8 +95,13 @@ class ActionQueue(threading.Thread): return self._stop.isSet() def put_status(self, commands): -#Was supposed that we got all set of statuses, we don't need to keep old ones -self.statusCommandQueue.queue.clear() +if not self.statusCommandQueue.empty(): + #Clear all status commands. Was supposed that we got all set of statuses, we don't need to keep old ones + statusCommandQueueSize = 0 + while not self.statusCommandQueue.empty(): +self.statusCommandQueue.get() +statusCommandQueueSize = statusCommandQueueSize + 1 + logger.info("Number of status commands removed from queue : " + str(statusCommandQueueSize)) for command in commands: logger.info("Adding " + command['commandType'] + " for component " + \
ambari git commit: AMBARI-19201. Log size of status command queue size on Ambari agent (magyari_sandor)
Repository: ambari Updated Branches: refs/heads/trunk 44e60728f -> fd1ff56af AMBARI-19201. Log size of status command queue size on Ambari agent (magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/fd1ff56a Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/fd1ff56a Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/fd1ff56a Branch: refs/heads/trunk Commit: fd1ff56afba1cb84367947c7440371464ff594a5 Parents: 44e6072 Author: Sandor Magyari Authored: Thu Dec 15 14:25:29 2016 +0100 Committer: Sandor Magyari Committed: Fri Dec 16 21:42:35 2016 +0100 -- ambari-agent/src/main/python/ambari_agent/ActionQueue.py | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/fd1ff56a/ambari-agent/src/main/python/ambari_agent/ActionQueue.py -- diff --git a/ambari-agent/src/main/python/ambari_agent/ActionQueue.py b/ambari-agent/src/main/python/ambari_agent/ActionQueue.py index cb4fcb9..cc1a048 100644 --- a/ambari-agent/src/main/python/ambari_agent/ActionQueue.py +++ b/ambari-agent/src/main/python/ambari_agent/ActionQueue.py @@ -97,9 +97,13 @@ class ActionQueue(threading.Thread): return self._stop.isSet() def put_status(self, commands): -#Clear all status commands. Was supposed that we got all set of statuses, we don't need to keep old ones -while not self.statusCommandQueue.empty(): - self.statusCommandQueue.get() +if not self.statusCommandQueue.empty(): + #Clear all status commands. Was supposed that we got all set of statuses, we don't need to keep old ones + statusCommandQueueSize = 0 + while not self.statusCommandQueue.empty(): +self.statusCommandQueue.get() +statusCommandQueueSize = statusCommandQueueSize + 1 + logger.info("Number of status commands removed from queue : " + str(statusCommandQueueSize)) for command in commands: logger.info("Adding " + command['commandType'] + " for component " + \
ambari git commit: AMBARI-19066. Add more logging around status command report processing on server side (magyari_sandor)
Repository: ambari Updated Branches: refs/heads/branch-2.5 4f3a67d98 -> 51c6ef9e1 AMBARI-19066. Add more logging around status command report processing on server side (magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/51c6ef9e Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/51c6ef9e Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/51c6ef9e Branch: refs/heads/branch-2.5 Commit: 51c6ef9e157991d96535ff6e0b86a6e9b8878883 Parents: 4f3a67d Author: Sandor Magyari Authored: Thu Dec 8 15:57:04 2016 +0100 Committer: Sandor Magyari Committed: Thu Dec 8 18:35:34 2016 +0100 -- .../main/java/org/apache/ambari/server/agent/AgentRequests.java| 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/51c6ef9e/ambari-server/src/main/java/org/apache/ambari/server/agent/AgentRequests.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/agent/AgentRequests.java b/ambari-server/src/main/java/org/apache/ambari/server/agent/AgentRequests.java index 2980f38..01195bf 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/agent/AgentRequests.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/agent/AgentRequests.java @@ -45,9 +45,9 @@ public class AgentRequests { public void setExecutionDetailsRequest(String host, String component, String requestExecutionCmd) { if (StringUtils.isNotBlank(requestExecutionCmd)) { - LOG.debug("Setting need for exec command to " + requestExecutionCmd + " for " + component); Map perHostRequiresExecCmdDetails = getPerHostRequiresExecCmdDetails(host); if (Boolean.TRUE.toString().toUpperCase().equals(requestExecutionCmd.toUpperCase())) { +LOG.info("Setting need for exec command to " + requestExecutionCmd + " for " + component); perHostRequiresExecCmdDetails.put(component, Boolean.TRUE); } else { perHostRequiresExecCmdDetails.put(component, Boolean.FALSE);
ambari git commit: AMBARI-19066. Add more logging around status command report processing on server side (magyari_sandor)
Repository: ambari Updated Branches: refs/heads/trunk bd4a02fb4 -> a27c0dd34 AMBARI-19066. Add more logging around status command report processing on server side (magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/a27c0dd3 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/a27c0dd3 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/a27c0dd3 Branch: refs/heads/trunk Commit: a27c0dd34608cd99fc47d4a6b2e2ab532f0e03eb Parents: bd4a02f Author: Sandor Magyari Authored: Thu Dec 8 15:57:04 2016 +0100 Committer: Sandor Magyari Committed: Thu Dec 8 18:34:06 2016 +0100 -- .../main/java/org/apache/ambari/server/agent/AgentRequests.java| 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/a27c0dd3/ambari-server/src/main/java/org/apache/ambari/server/agent/AgentRequests.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/agent/AgentRequests.java b/ambari-server/src/main/java/org/apache/ambari/server/agent/AgentRequests.java index 2980f38..01195bf 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/agent/AgentRequests.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/agent/AgentRequests.java @@ -45,9 +45,9 @@ public class AgentRequests { public void setExecutionDetailsRequest(String host, String component, String requestExecutionCmd) { if (StringUtils.isNotBlank(requestExecutionCmd)) { - LOG.debug("Setting need for exec command to " + requestExecutionCmd + " for " + component); Map perHostRequiresExecCmdDetails = getPerHostRequiresExecCmdDetails(host); if (Boolean.TRUE.toString().toUpperCase().equals(requestExecutionCmd.toUpperCase())) { +LOG.info("Setting need for exec command to " + requestExecutionCmd + " for " + component); perHostRequiresExecCmdDetails.put(component, Boolean.TRUE); } else { perHostRequiresExecCmdDetails.put(component, Boolean.FALSE);
ambari git commit: Revert "AMBARI-19066. Add more logging around status command report processing on server side (magyari_sandor)"
Repository: ambari Updated Branches: refs/heads/branch-2.5 59f520b85 -> 8bdb74546 Revert "AMBARI-19066. Add more logging around status command report processing on server side (magyari_sandor)" This reverts commit ebe954bb104cf3425cc66f31b9e43d51a6719414. Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/8bdb7454 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/8bdb7454 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/8bdb7454 Branch: refs/heads/branch-2.5 Commit: 8bdb7454690b1af51402a996f63958c004c6ec22 Parents: 59f520b Author: Sandor Magyari Authored: Thu Dec 8 15:42:18 2016 +0100 Committer: Sandor Magyari Committed: Thu Dec 8 15:42:18 2016 +0100 -- .../apache/ambari/server/agent/AgentRequests.java| 2 +- .../ambari/server/agent/HeartbeatProcessor.java | 15 +-- 2 files changed, 6 insertions(+), 11 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/8bdb7454/ambari-server/src/main/java/org/apache/ambari/server/agent/AgentRequests.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/agent/AgentRequests.java b/ambari-server/src/main/java/org/apache/ambari/server/agent/AgentRequests.java index 01195bf..2980f38 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/agent/AgentRequests.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/agent/AgentRequests.java @@ -45,9 +45,9 @@ public class AgentRequests { public void setExecutionDetailsRequest(String host, String component, String requestExecutionCmd) { if (StringUtils.isNotBlank(requestExecutionCmd)) { + LOG.debug("Setting need for exec command to " + requestExecutionCmd + " for " + component); Map perHostRequiresExecCmdDetails = getPerHostRequiresExecCmdDetails(host); if (Boolean.TRUE.toString().toUpperCase().equals(requestExecutionCmd.toUpperCase())) { -LOG.info("Setting need for exec command to " + requestExecutionCmd + " for " + component); perHostRequiresExecCmdDetails.put(component, Boolean.TRUE); } else { perHostRequiresExecCmdDetails.put(component, Boolean.FALSE); http://git-wip-us.apache.org/repos/asf/ambari/blob/8bdb7454/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatProcessor.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatProcessor.java b/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatProcessor.java index 404419c..8f4782e 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatProcessor.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatProcessor.java @@ -19,6 +19,8 @@ package org.apache.ambari.server.agent; import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; @@ -99,8 +101,6 @@ public class HeartbeatProcessor extends AbstractService{ //TODO rewrite to correlate with heartbeat frequency, hardcoded in agent as of now private long delay = 5000; private long period = 1000; - private long logIntervalSeconds = 30; - private long lastStatusMessage = 0; private int poolSize = 1; @@ -179,19 +179,12 @@ public class HeartbeatProcessor extends AbstractService{ @Override public void run() { - while (shouldRun) { try { - long now = System.currentTimeMillis(); - if ((now - lastStatusMessage) > (logIntervalSeconds * 1000)) { -LOG.info("Queue size: {}", heartBeatsQueue.size()); -lastStatusMessage = now; - } HeartBeat heartbeat = pollHeartbeat(); if (heartbeat == null) { break; } - processHeartbeat(heartbeat); } catch (Exception e) { LOG.error("Exception received while processing heartbeat", e); @@ -208,13 +201,13 @@ public class HeartbeatProcessor extends AbstractService{ /** * Incapsulates logic for processing data from agent heartbeat * @param heartbeat Agent heartbeat object - * @param now * @throws AmbariException */ public void processHeartbeat(HeartBeat heartbeat) throws AmbariException { long now = System.currentTimeMillis(); processAlerts(heartbeat); + //process status reports before command reports to prevent status override immediately after task finish processStatusReports(heartbeat); processCommandReports(heartbeat, now); @@ -222,6 +215,8 @@ public class
ambari git commit: Revert "AMBARI-19066. Add more logging around status command report processing on server side (magyari_sandor)"
Repository: ambari Updated Branches: refs/heads/trunk 18d1b0cd4 -> 3ffc95607 Revert "AMBARI-19066. Add more logging around status command report processing on server side (magyari_sandor)" This reverts commit 99afb8bf67c8278d78f960ab2017a6e451cb58ae. Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/3ffc9560 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/3ffc9560 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/3ffc9560 Branch: refs/heads/trunk Commit: 3ffc95607adb2ecd1b2a3ccc84db475351e9a8d3 Parents: 18d1b0c Author: Sandor Magyari Authored: Thu Dec 8 15:40:08 2016 +0100 Committer: Sandor Magyari Committed: Thu Dec 8 15:40:08 2016 +0100 -- .../apache/ambari/server/agent/AgentRequests.java| 2 +- .../ambari/server/agent/HeartbeatProcessor.java | 15 +-- 2 files changed, 6 insertions(+), 11 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/3ffc9560/ambari-server/src/main/java/org/apache/ambari/server/agent/AgentRequests.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/agent/AgentRequests.java b/ambari-server/src/main/java/org/apache/ambari/server/agent/AgentRequests.java index 01195bf..2980f38 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/agent/AgentRequests.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/agent/AgentRequests.java @@ -45,9 +45,9 @@ public class AgentRequests { public void setExecutionDetailsRequest(String host, String component, String requestExecutionCmd) { if (StringUtils.isNotBlank(requestExecutionCmd)) { + LOG.debug("Setting need for exec command to " + requestExecutionCmd + " for " + component); Map perHostRequiresExecCmdDetails = getPerHostRequiresExecCmdDetails(host); if (Boolean.TRUE.toString().toUpperCase().equals(requestExecutionCmd.toUpperCase())) { -LOG.info("Setting need for exec command to " + requestExecutionCmd + " for " + component); perHostRequiresExecCmdDetails.put(component, Boolean.TRUE); } else { perHostRequiresExecCmdDetails.put(component, Boolean.FALSE); http://git-wip-us.apache.org/repos/asf/ambari/blob/3ffc9560/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatProcessor.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatProcessor.java b/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatProcessor.java index 404419c..8f4782e 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatProcessor.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatProcessor.java @@ -19,6 +19,8 @@ package org.apache.ambari.server.agent; import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; @@ -99,8 +101,6 @@ public class HeartbeatProcessor extends AbstractService{ //TODO rewrite to correlate with heartbeat frequency, hardcoded in agent as of now private long delay = 5000; private long period = 1000; - private long logIntervalSeconds = 30; - private long lastStatusMessage = 0; private int poolSize = 1; @@ -179,19 +179,12 @@ public class HeartbeatProcessor extends AbstractService{ @Override public void run() { - while (shouldRun) { try { - long now = System.currentTimeMillis(); - if ((now - lastStatusMessage) > (logIntervalSeconds * 1000)) { -LOG.info("Queue size: {}", heartBeatsQueue.size()); -lastStatusMessage = now; - } HeartBeat heartbeat = pollHeartbeat(); if (heartbeat == null) { break; } - processHeartbeat(heartbeat); } catch (Exception e) { LOG.error("Exception received while processing heartbeat", e); @@ -208,13 +201,13 @@ public class HeartbeatProcessor extends AbstractService{ /** * Incapsulates logic for processing data from agent heartbeat * @param heartbeat Agent heartbeat object - * @param now * @throws AmbariException */ public void processHeartbeat(HeartBeat heartbeat) throws AmbariException { long now = System.currentTimeMillis(); processAlerts(heartbeat); + //process status reports before command reports to prevent status override immediately after task finish processStatusReports(heartbeat); processCommandReports(heartbeat, now); @@ -222,6 +215,8 @@ public class HeartbeatProcessor extends AbstractService
ambari git commit: AMBARI-19066. Add more logging around status command report processing on server side (magyari_sandor)
Repository: ambari Updated Branches: refs/heads/branch-2.5 74f0b5fc9 -> ebe954bb1 AMBARI-19066. Add more logging around status command report processing on server side (magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/ebe954bb Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/ebe954bb Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/ebe954bb Branch: refs/heads/branch-2.5 Commit: ebe954bb104cf3425cc66f31b9e43d51a6719414 Parents: 74f0b5f Author: Sandor Magyari Authored: Wed Dec 7 14:57:16 2016 +0100 Committer: Sandor Magyari Committed: Wed Dec 7 18:20:48 2016 +0100 -- .../apache/ambari/server/agent/AgentRequests.java| 2 +- .../ambari/server/agent/HeartbeatProcessor.java | 15 ++- 2 files changed, 11 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/ebe954bb/ambari-server/src/main/java/org/apache/ambari/server/agent/AgentRequests.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/agent/AgentRequests.java b/ambari-server/src/main/java/org/apache/ambari/server/agent/AgentRequests.java index 2980f38..01195bf 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/agent/AgentRequests.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/agent/AgentRequests.java @@ -45,9 +45,9 @@ public class AgentRequests { public void setExecutionDetailsRequest(String host, String component, String requestExecutionCmd) { if (StringUtils.isNotBlank(requestExecutionCmd)) { - LOG.debug("Setting need for exec command to " + requestExecutionCmd + " for " + component); Map perHostRequiresExecCmdDetails = getPerHostRequiresExecCmdDetails(host); if (Boolean.TRUE.toString().toUpperCase().equals(requestExecutionCmd.toUpperCase())) { +LOG.info("Setting need for exec command to " + requestExecutionCmd + " for " + component); perHostRequiresExecCmdDetails.put(component, Boolean.TRUE); } else { perHostRequiresExecCmdDetails.put(component, Boolean.FALSE); http://git-wip-us.apache.org/repos/asf/ambari/blob/ebe954bb/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatProcessor.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatProcessor.java b/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatProcessor.java index 8f4782e..404419c 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatProcessor.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatProcessor.java @@ -19,8 +19,6 @@ package org.apache.ambari.server.agent; import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; @@ -101,6 +99,8 @@ public class HeartbeatProcessor extends AbstractService{ //TODO rewrite to correlate with heartbeat frequency, hardcoded in agent as of now private long delay = 5000; private long period = 1000; + private long logIntervalSeconds = 30; + private long lastStatusMessage = 0; private int poolSize = 1; @@ -179,12 +179,19 @@ public class HeartbeatProcessor extends AbstractService{ @Override public void run() { + while (shouldRun) { try { + long now = System.currentTimeMillis(); + if ((now - lastStatusMessage) > (logIntervalSeconds * 1000)) { +LOG.info("Queue size: {}", heartBeatsQueue.size()); +lastStatusMessage = now; + } HeartBeat heartbeat = pollHeartbeat(); if (heartbeat == null) { break; } + processHeartbeat(heartbeat); } catch (Exception e) { LOG.error("Exception received while processing heartbeat", e); @@ -201,13 +208,13 @@ public class HeartbeatProcessor extends AbstractService{ /** * Incapsulates logic for processing data from agent heartbeat * @param heartbeat Agent heartbeat object + * @param now * @throws AmbariException */ public void processHeartbeat(HeartBeat heartbeat) throws AmbariException { long now = System.currentTimeMillis(); processAlerts(heartbeat); - //process status reports before command reports to prevent status override immediately after task finish processStatusReports(heartbeat); processCommandReports(heartbeat, now); @@ -215,8 +222,6 @@ public class HeartbeatProcessor extends AbstractService{ processHostStatus(heartbeat); } - - /** * Extracts a
ambari git commit: AMBARI-19066. Add more logging around status command report processing on server side (magyari_sandor)
Repository: ambari Updated Branches: refs/heads/trunk 9fc7f0ae1 -> 99afb8bf6 AMBARI-19066. Add more logging around status command report processing on server side (magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/99afb8bf Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/99afb8bf Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/99afb8bf Branch: refs/heads/trunk Commit: 99afb8bf67c8278d78f960ab2017a6e451cb58ae Parents: 9fc7f0a Author: Sandor Magyari Authored: Wed Dec 7 14:57:16 2016 +0100 Committer: Sandor Magyari Committed: Wed Dec 7 18:19:43 2016 +0100 -- .../apache/ambari/server/agent/AgentRequests.java| 2 +- .../ambari/server/agent/HeartbeatProcessor.java | 15 ++- 2 files changed, 11 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/99afb8bf/ambari-server/src/main/java/org/apache/ambari/server/agent/AgentRequests.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/agent/AgentRequests.java b/ambari-server/src/main/java/org/apache/ambari/server/agent/AgentRequests.java index 2980f38..01195bf 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/agent/AgentRequests.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/agent/AgentRequests.java @@ -45,9 +45,9 @@ public class AgentRequests { public void setExecutionDetailsRequest(String host, String component, String requestExecutionCmd) { if (StringUtils.isNotBlank(requestExecutionCmd)) { - LOG.debug("Setting need for exec command to " + requestExecutionCmd + " for " + component); Map perHostRequiresExecCmdDetails = getPerHostRequiresExecCmdDetails(host); if (Boolean.TRUE.toString().toUpperCase().equals(requestExecutionCmd.toUpperCase())) { +LOG.info("Setting need for exec command to " + requestExecutionCmd + " for " + component); perHostRequiresExecCmdDetails.put(component, Boolean.TRUE); } else { perHostRequiresExecCmdDetails.put(component, Boolean.FALSE); http://git-wip-us.apache.org/repos/asf/ambari/blob/99afb8bf/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatProcessor.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatProcessor.java b/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatProcessor.java index 8f4782e..404419c 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatProcessor.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatProcessor.java @@ -19,8 +19,6 @@ package org.apache.ambari.server.agent; import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; @@ -101,6 +99,8 @@ public class HeartbeatProcessor extends AbstractService{ //TODO rewrite to correlate with heartbeat frequency, hardcoded in agent as of now private long delay = 5000; private long period = 1000; + private long logIntervalSeconds = 30; + private long lastStatusMessage = 0; private int poolSize = 1; @@ -179,12 +179,19 @@ public class HeartbeatProcessor extends AbstractService{ @Override public void run() { + while (shouldRun) { try { + long now = System.currentTimeMillis(); + if ((now - lastStatusMessage) > (logIntervalSeconds * 1000)) { +LOG.info("Queue size: {}", heartBeatsQueue.size()); +lastStatusMessage = now; + } HeartBeat heartbeat = pollHeartbeat(); if (heartbeat == null) { break; } + processHeartbeat(heartbeat); } catch (Exception e) { LOG.error("Exception received while processing heartbeat", e); @@ -201,13 +208,13 @@ public class HeartbeatProcessor extends AbstractService{ /** * Incapsulates logic for processing data from agent heartbeat * @param heartbeat Agent heartbeat object + * @param now * @throws AmbariException */ public void processHeartbeat(HeartBeat heartbeat) throws AmbariException { long now = System.currentTimeMillis(); processAlerts(heartbeat); - //process status reports before command reports to prevent status override immediately after task finish processStatusReports(heartbeat); processCommandReports(heartbeat, now); @@ -215,8 +222,6 @@ public class HeartbeatProcessor extends AbstractService{ processHostStatus(heartbeat); } - - /** * Extracts all of the {@l
[1/3] ambari git commit: AMBARI-18065. Change Ranger Admin start script to setup db for ranger (magyari_sandor)
Repository: ambari Updated Branches: refs/heads/branch-2.5 a0b0a053f -> cae500898 http://git-wip-us.apache.org/repos/asf/ambari/blob/cae50089/ambari-server/src/test/python/stacks/2.6/configs/ranger-admin-secured.json -- diff --git a/ambari-server/src/test/python/stacks/2.6/configs/ranger-admin-secured.json b/ambari-server/src/test/python/stacks/2.6/configs/ranger-admin-secured.json new file mode 100644 index 000..030b717 --- /dev/null +++ b/ambari-server/src/test/python/stacks/2.6/configs/ranger-admin-secured.json @@ -0,0 +1,773 @@ +{ +"localComponents": [ +"SECONDARY_NAMENODE", +"HDFS_CLIENT", +"DATANODE", +"NAMENODE", +"RANGER_ADMIN", +"RANGER_TAGSYNC", +"RANGER_USERSYNC", +"ZOOKEEPER_SERVER", +"ZOOKEEPER_CLIENT", +"KERBEROS_CLIENT", +"LOGSEARCH_SOLR", +"LOGSEARCH_SOLR_CLIENT" +], +"configuration_attributes": { +"ranger-hdfs-audit": {}, +"ssl-client": {}, +"ranger-admin-site": {}, +"ranger-hdfs-policymgr-ssl": {}, +"tagsync-application-properties": {}, +"ranger-env": {}, +"usersync-log4j": {}, +"ranger-hdfs-plugin-properties": {}, +"kerberos-env": {}, +"admin-properties": {}, +"ranger-ugsync-site": {}, +"hdfs-site": { +"final": { +"dfs.datanode.data.dir": "true", +"dfs.namenode.http-address": "true", +"dfs.datanode.failed.volumes.tolerated": "true", +"dfs.support.append": "true", +"dfs.namenode.name.dir": "true", +"dfs.webhdfs.enabled": "true" +} +}, +"ranger-tagsync-site": {}, +"zoo.cfg": {}, +"hadoop-policy": {}, +"hdfs-log4j": {}, +"krb5-conf": {}, +"core-site": { +"final": { +"fs.defaultFS": "true" +} +}, +"hadoop-env": {}, +"zookeeper-log4j": {}, +"ssl-server": {}, +"ranger-site": {}, +"admin-log4j": {}, +"tagsync-log4j": {}, +"ranger-hdfs-security": {}, +"usersync-properties": {}, +"zookeeper-env": {}, +"infra-solr-env": {}, +"infra-solr-client-log4j": {}, +"cluster-env": {} +}, +"public_hostname": "c6401.ambari.apache.org", +"commandId": "41-2", +"hostname": "c6401.ambari.apache.org", +"kerberosCommandParams": [], +"serviceName": "RANGER", +"role": "RANGER_ADMIN", +"forceRefreshConfigTagsBeforeExecution": [], +"requestId": 41, +"agentConfigParams": { +"agent": { +"parallel_execution": 0 +} +}, +"clusterName": "test_Cluster01", +"commandType": "EXECUTION_COMMAND", +"taskId": 186, +"roleParams": {}, +"configurationTags": { +"ranger-hdfs-audit": { +"tag": "version1466705299922" +}, +"ssl-client": { +"tag": "version1" +}, +"ranger-admin-site": { +"tag": "version1467016680635" +}, +"ranger-hdfs-policymgr-ssl": { +"tag": "version1466705299922" +}, +"tagsync-application-properties": { +"tag": "version1467016680511" +}, +"ranger-env": { +"tag": "version1466705299949" +}, +"ranger-ugsync-site": { +"tag": "version1467016680537" +}, +"ranger-hdfs-plugin-properties": { +"tag": "version1466705299922" +}, +"kerberos-env": { +"tag": "version1467016537243" +}, +"admin-properties": { +"tag": "version1466705299949" +}, +"hdfs-site": { +"tag": "version1467016680401" +}, +"ranger-tagsync-site": { +"tag": "version1467016680586" +}, +"zoo.cfg": { +"tag": "version1" +}, +"hadoop-policy": { +"tag": "version1" +}, +"hdfs-log4j": { +"tag": "version1" +}, +"usersync-log4j": { +"tag": "version1466705299949" +}, +"krb5-conf": { +"tag": "version1467016537243" +}, +"core-site": { +"tag": "version1467016680612" +}, +"hadoop-env": { +"tag": "version1467016680446" +}, +"zookeeper-log4j": { +"tag": "version1" +}, +"ssl-server": { +"tag": "version1" +}, +"ranger-site": { +"tag": "version1466705299949" +}, +"admin-log4j": { +"tag": "version1466705299949" +}, +"tagsync-log4j": { +"tag": "version1466705299949" +}, +
[3/3] ambari git commit: AMBARI-18065. Change Ranger Admin start script to setup db for ranger (magyari_sandor)
AMBARI-18065. Change Ranger Admin start script to setup db for ranger (magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/cae50089 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/cae50089 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/cae50089 Branch: refs/heads/branch-2.5 Commit: cae5008984d6f45385d8962d35aff1a7f8ea059d Parents: a0b0a05 Author: Sandor Magyari Authored: Thu Dec 1 19:36:01 2016 +0100 Committer: Sandor Magyari Committed: Mon Dec 5 16:40:25 2016 +0100 -- .../libraries/functions/constants.py| 1 + .../RANGER/0.4.0/package/scripts/params.py | 1 + .../0.4.0/package/scripts/ranger_admin.py | 36 +- .../HDP/2.0.6/properties/stack_features.json| 5 + .../stacks/2.6/RANGER/test_ranger_admin.py | 504 .../2.6/configs/ranger-admin-default.json | 704 + .../2.6/configs/ranger-admin-secured.json | 773 +++ 7 files changed, 2010 insertions(+), 14 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/cae50089/ambari-common/src/main/python/resource_management/libraries/functions/constants.py -- diff --git a/ambari-common/src/main/python/resource_management/libraries/functions/constants.py b/ambari-common/src/main/python/resource_management/libraries/functions/constants.py index 3431495..46562e0 100644 --- a/ambari-common/src/main/python/resource_management/libraries/functions/constants.py +++ b/ambari-common/src/main/python/resource_management/libraries/functions/constants.py @@ -97,6 +97,7 @@ class StackFeature: RANGER_PID_SUPPORT = "ranger_pid_support" RANGER_KMS_PID_SUPPORT = "ranger_kms_pid_support" RANGER_ADMIN_PASSWD_CHANGE = "ranger_admin_password_change" + RANGER_SETUP_DB_ON_START = "ranger_setup_db_on_start" STORM_METRICS_APACHE_CLASSES = "storm_metrics_apache_classes" SPARK_JAVA_OPTS_SUPPORT = "spark_java_opts_support" ATLAS_HBASE_SETUP = "atlas_hbase_setup" http://git-wip-us.apache.org/repos/asf/ambari/blob/cae50089/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/params.py -- diff --git a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/params.py b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/params.py index e27b363..f2cc940 100644 --- a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/params.py +++ b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/params.py @@ -70,6 +70,7 @@ stack_supports_usersync_passwd = check_stack_feature(StackFeature.RANGER_USERSYN stack_supports_infra_client = check_stack_feature(StackFeature.RANGER_INSTALL_INFRA_CLIENT, version_for_stack_feature_checks) stack_supports_pid = check_stack_feature(StackFeature.RANGER_PID_SUPPORT, version_for_stack_feature_checks) stack_supports_ranger_admin_password_change = check_stack_feature(StackFeature.RANGER_ADMIN_PASSWD_CHANGE, version_for_stack_feature_checks) +stack_supports_ranger_setup_db_on_start = check_stack_feature(StackFeature.RANGER_SETUP_DB_ON_START, version_for_stack_feature_checks) downgrade_from_version = default("/commandParams/downgrade_from_version", None) upgrade_direction = default("/commandParams/upgrade_direction", None) http://git-wip-us.apache.org/repos/asf/ambari/blob/cae50089/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/ranger_admin.py -- diff --git a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/ranger_admin.py b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/ranger_admin.py index a9656c7..b849d58 100644 --- a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/ranger_admin.py +++ b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/ranger_admin.py @@ -45,18 +45,9 @@ class RangerAdmin(Script): self.install_packages(env) import params env.set_params(params) -if params.xml_configurations_supported: - from setup_ranger_xml import setup_ranger_db - setup_ranger_db() - -self.configure(env) - -if params.xml_configurations_supported: - from setup_ranger_xml import setup_java_patch - setup_java_patch() - -if params.stack_supports_ranger_admin_password_change: - setup_ranger_admin_passwd_change() +# call config and setup db only in case of HDP version < 2.6 +if
[2/3] ambari git commit: AMBARI-18065. Change Ranger Admin start script to setup db for ranger (magyari_sandor)
http://git-wip-us.apache.org/repos/asf/ambari/blob/cae50089/ambari-server/src/test/python/stacks/2.6/configs/ranger-admin-default.json -- diff --git a/ambari-server/src/test/python/stacks/2.6/configs/ranger-admin-default.json b/ambari-server/src/test/python/stacks/2.6/configs/ranger-admin-default.json new file mode 100644 index 000..1d5adff --- /dev/null +++ b/ambari-server/src/test/python/stacks/2.6/configs/ranger-admin-default.json @@ -0,0 +1,704 @@ +{ +"localComponents": [ +"NAMENODE", +"SECONDARY_NAMENODE", +"ZOOKEEPER_SERVER", +"DATANODE", +"HDFS_CLIENT", +"ZOOKEEPER_CLIENT", +"RANGER_USERSYNC", +"RANGER_ADMIN", +"RANGER_TAGSYNC", +"LOGSEARCH_SOLR", +"LOGSEARCH_SOLR_CLIENT" +], +"configuration_attributes": { +"ranger-hdfs-audit": {}, +"ssl-client": {}, +"ranger-admin-site": {}, +"ranger-hdfs-policymgr-ssl": {}, +"tagsync-application-properties": {}, +"ranger-env": {}, +"usersync-log4j": {}, +"admin-properties": {}, +"ranger-ugsync-site": {}, +"hdfs-site": { +"final": { +"dfs.datanode.data.dir": "true", +"dfs.namenode.http-address": "true", +"dfs.datanode.failed.volumes.tolerated": "true", +"dfs.support.append": "true", +"dfs.namenode.name.dir": "true", +"dfs.webhdfs.enabled": "true" +} +}, +"ranger-tagsync-site": {}, +"zoo.cfg": {}, +"hadoop-policy": {}, +"hdfs-log4j": {}, +"ranger-hdfs-plugin-properties": {}, +"core-site": { +"final": { +"fs.defaultFS": "true" +} +}, +"hadoop-env": {}, +"zookeeper-log4j": {}, +"ssl-server": {}, +"ranger-site": {}, +"admin-log4j": {}, +"tagsync-log4j": {}, +"ranger-hdfs-security": {}, +"usersync-properties": {}, +"zookeeper-env": {}, +"infra-solr-env": {}, +"infra-solr-client-log4j": {}, +"cluster-env": {} +}, +"public_hostname": "c6401.ambari.apache.org", +"commandId": "11-0", +"hostname": "c6401.ambari.apache.org", +"kerberosCommandParams": [], +"serviceName": "RANGER", +"role": "RANGER_ADMIN", +"forceRefreshConfigTagsBeforeExecution": [], +"requestId": 11, +"agentConfigParams": { +"agent": { +"parallel_execution": 0 +} +}, +"clusterName": "c1", +"commandType": "EXECUTION_COMMAND", +"taskId": 31, +"roleParams": {}, +"configurationTags": { +"ranger-hdfs-audit": { +"tag": "version1466705299922" +}, +"ssl-client": { +"tag": "version1" +}, +"ranger-admin-site": { +"tag": "version1466705299949" +}, +"ranger-hdfs-policymgr-ssl": { +"tag": "version1466705299922" +}, +"tagsync-application-properties": { +"tag": "version1466705299949" +}, +"ranger-env": { +"tag": "version1466705299949" +}, +"usersync-log4j": { +"tag": "version1466705299949" +}, +"admin-properties": { +"tag": "version1466705299949" +}, +"ranger-ugsync-site": { +"tag": "version1466705299949" +}, +"hdfs-site": { +"tag": "version1" +}, +"ranger-tagsync-site": { +"tag": "version1466705299949" +}, +"zoo.cfg": { +"tag": "version1" +}, +"hadoop-policy": { +"tag": "version1" +}, +"hdfs-log4j": { +"tag": "version1" +}, +"ranger-hdfs-plugin-properties": { +"tag": "version1466705299922" +}, +"core-site": { +"tag": "version1" +}, +"hadoop-env": { +"tag": "version1" +}, +"zookeeper-log4j": { +"tag": "version1" +}, +"ssl-server": { +"tag": "version1" +}, +"ranger-site": { +"tag": "version1466705299949" +}, +"admin-log4j": { +"tag": "version1466705299949" +}, +"tagsync-log4j": { +"tag": "version1466705299949" +}, +"ranger-hdfs-security": { +"tag": "version1466705299922" +}, +"usersync-properties": { +"tag": "version1466705299949" +}, +"zookeeper-env": { +"tag": "version1" +}, +"infra-solr-env": { +"tag": "version1467098537360" +}, +"infra-solr-client-log4j": { +"
[3/3] ambari git commit: AMBARI-18065. Change Ranger Admin start script to setup db for ranger (magyari_sandor)
AMBARI-18065. Change Ranger Admin start script to setup db for ranger (magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/f5051dcb Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/f5051dcb Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/f5051dcb Branch: refs/heads/trunk Commit: f5051dcb7f17f0e26fed9e70eef35a3758a35e60 Parents: 431d265 Author: Sandor Magyari Authored: Thu Dec 1 19:36:01 2016 +0100 Committer: Sandor Magyari Committed: Mon Dec 5 16:39:13 2016 +0100 -- .../libraries/functions/constants.py| 1 + .../RANGER/0.4.0/package/scripts/params.py | 1 + .../0.4.0/package/scripts/ranger_admin.py | 36 +- .../HDP/2.0.6/properties/stack_features.json| 5 + .../stacks/2.6/RANGER/test_ranger_admin.py | 504 .../2.6/configs/ranger-admin-default.json | 704 + .../2.6/configs/ranger-admin-secured.json | 773 +++ 7 files changed, 2010 insertions(+), 14 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/f5051dcb/ambari-common/src/main/python/resource_management/libraries/functions/constants.py -- diff --git a/ambari-common/src/main/python/resource_management/libraries/functions/constants.py b/ambari-common/src/main/python/resource_management/libraries/functions/constants.py index 3431495..46562e0 100644 --- a/ambari-common/src/main/python/resource_management/libraries/functions/constants.py +++ b/ambari-common/src/main/python/resource_management/libraries/functions/constants.py @@ -97,6 +97,7 @@ class StackFeature: RANGER_PID_SUPPORT = "ranger_pid_support" RANGER_KMS_PID_SUPPORT = "ranger_kms_pid_support" RANGER_ADMIN_PASSWD_CHANGE = "ranger_admin_password_change" + RANGER_SETUP_DB_ON_START = "ranger_setup_db_on_start" STORM_METRICS_APACHE_CLASSES = "storm_metrics_apache_classes" SPARK_JAVA_OPTS_SUPPORT = "spark_java_opts_support" ATLAS_HBASE_SETUP = "atlas_hbase_setup" http://git-wip-us.apache.org/repos/asf/ambari/blob/f5051dcb/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/params.py -- diff --git a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/params.py b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/params.py index e27b363..f2cc940 100644 --- a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/params.py +++ b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/params.py @@ -70,6 +70,7 @@ stack_supports_usersync_passwd = check_stack_feature(StackFeature.RANGER_USERSYN stack_supports_infra_client = check_stack_feature(StackFeature.RANGER_INSTALL_INFRA_CLIENT, version_for_stack_feature_checks) stack_supports_pid = check_stack_feature(StackFeature.RANGER_PID_SUPPORT, version_for_stack_feature_checks) stack_supports_ranger_admin_password_change = check_stack_feature(StackFeature.RANGER_ADMIN_PASSWD_CHANGE, version_for_stack_feature_checks) +stack_supports_ranger_setup_db_on_start = check_stack_feature(StackFeature.RANGER_SETUP_DB_ON_START, version_for_stack_feature_checks) downgrade_from_version = default("/commandParams/downgrade_from_version", None) upgrade_direction = default("/commandParams/upgrade_direction", None) http://git-wip-us.apache.org/repos/asf/ambari/blob/f5051dcb/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/ranger_admin.py -- diff --git a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/ranger_admin.py b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/ranger_admin.py index a9656c7..b849d58 100644 --- a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/ranger_admin.py +++ b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/ranger_admin.py @@ -45,18 +45,9 @@ class RangerAdmin(Script): self.install_packages(env) import params env.set_params(params) -if params.xml_configurations_supported: - from setup_ranger_xml import setup_ranger_db - setup_ranger_db() - -self.configure(env) - -if params.xml_configurations_supported: - from setup_ranger_xml import setup_java_patch - setup_java_patch() - -if params.stack_supports_ranger_admin_password_change: - setup_ranger_admin_passwd_change() +# call config and setup db only in case of HDP version < 2.6 +if
[2/3] ambari git commit: AMBARI-18065. Change Ranger Admin start script to setup db for ranger (magyari_sandor)
http://git-wip-us.apache.org/repos/asf/ambari/blob/f5051dcb/ambari-server/src/test/python/stacks/2.6/configs/ranger-admin-default.json -- diff --git a/ambari-server/src/test/python/stacks/2.6/configs/ranger-admin-default.json b/ambari-server/src/test/python/stacks/2.6/configs/ranger-admin-default.json new file mode 100644 index 000..1d5adff --- /dev/null +++ b/ambari-server/src/test/python/stacks/2.6/configs/ranger-admin-default.json @@ -0,0 +1,704 @@ +{ +"localComponents": [ +"NAMENODE", +"SECONDARY_NAMENODE", +"ZOOKEEPER_SERVER", +"DATANODE", +"HDFS_CLIENT", +"ZOOKEEPER_CLIENT", +"RANGER_USERSYNC", +"RANGER_ADMIN", +"RANGER_TAGSYNC", +"LOGSEARCH_SOLR", +"LOGSEARCH_SOLR_CLIENT" +], +"configuration_attributes": { +"ranger-hdfs-audit": {}, +"ssl-client": {}, +"ranger-admin-site": {}, +"ranger-hdfs-policymgr-ssl": {}, +"tagsync-application-properties": {}, +"ranger-env": {}, +"usersync-log4j": {}, +"admin-properties": {}, +"ranger-ugsync-site": {}, +"hdfs-site": { +"final": { +"dfs.datanode.data.dir": "true", +"dfs.namenode.http-address": "true", +"dfs.datanode.failed.volumes.tolerated": "true", +"dfs.support.append": "true", +"dfs.namenode.name.dir": "true", +"dfs.webhdfs.enabled": "true" +} +}, +"ranger-tagsync-site": {}, +"zoo.cfg": {}, +"hadoop-policy": {}, +"hdfs-log4j": {}, +"ranger-hdfs-plugin-properties": {}, +"core-site": { +"final": { +"fs.defaultFS": "true" +} +}, +"hadoop-env": {}, +"zookeeper-log4j": {}, +"ssl-server": {}, +"ranger-site": {}, +"admin-log4j": {}, +"tagsync-log4j": {}, +"ranger-hdfs-security": {}, +"usersync-properties": {}, +"zookeeper-env": {}, +"infra-solr-env": {}, +"infra-solr-client-log4j": {}, +"cluster-env": {} +}, +"public_hostname": "c6401.ambari.apache.org", +"commandId": "11-0", +"hostname": "c6401.ambari.apache.org", +"kerberosCommandParams": [], +"serviceName": "RANGER", +"role": "RANGER_ADMIN", +"forceRefreshConfigTagsBeforeExecution": [], +"requestId": 11, +"agentConfigParams": { +"agent": { +"parallel_execution": 0 +} +}, +"clusterName": "c1", +"commandType": "EXECUTION_COMMAND", +"taskId": 31, +"roleParams": {}, +"configurationTags": { +"ranger-hdfs-audit": { +"tag": "version1466705299922" +}, +"ssl-client": { +"tag": "version1" +}, +"ranger-admin-site": { +"tag": "version1466705299949" +}, +"ranger-hdfs-policymgr-ssl": { +"tag": "version1466705299922" +}, +"tagsync-application-properties": { +"tag": "version1466705299949" +}, +"ranger-env": { +"tag": "version1466705299949" +}, +"usersync-log4j": { +"tag": "version1466705299949" +}, +"admin-properties": { +"tag": "version1466705299949" +}, +"ranger-ugsync-site": { +"tag": "version1466705299949" +}, +"hdfs-site": { +"tag": "version1" +}, +"ranger-tagsync-site": { +"tag": "version1466705299949" +}, +"zoo.cfg": { +"tag": "version1" +}, +"hadoop-policy": { +"tag": "version1" +}, +"hdfs-log4j": { +"tag": "version1" +}, +"ranger-hdfs-plugin-properties": { +"tag": "version1466705299922" +}, +"core-site": { +"tag": "version1" +}, +"hadoop-env": { +"tag": "version1" +}, +"zookeeper-log4j": { +"tag": "version1" +}, +"ssl-server": { +"tag": "version1" +}, +"ranger-site": { +"tag": "version1466705299949" +}, +"admin-log4j": { +"tag": "version1466705299949" +}, +"tagsync-log4j": { +"tag": "version1466705299949" +}, +"ranger-hdfs-security": { +"tag": "version1466705299922" +}, +"usersync-properties": { +"tag": "version1466705299949" +}, +"zookeeper-env": { +"tag": "version1" +}, +"infra-solr-env": { +"tag": "version1467098537360" +}, +"infra-solr-client-log4j": { +"
[1/3] ambari git commit: AMBARI-18065. Change Ranger Admin start script to setup db for ranger (magyari_sandor)
Repository: ambari Updated Branches: refs/heads/trunk 431d2659c -> f5051dcb7 http://git-wip-us.apache.org/repos/asf/ambari/blob/f5051dcb/ambari-server/src/test/python/stacks/2.6/configs/ranger-admin-secured.json -- diff --git a/ambari-server/src/test/python/stacks/2.6/configs/ranger-admin-secured.json b/ambari-server/src/test/python/stacks/2.6/configs/ranger-admin-secured.json new file mode 100644 index 000..030b717 --- /dev/null +++ b/ambari-server/src/test/python/stacks/2.6/configs/ranger-admin-secured.json @@ -0,0 +1,773 @@ +{ +"localComponents": [ +"SECONDARY_NAMENODE", +"HDFS_CLIENT", +"DATANODE", +"NAMENODE", +"RANGER_ADMIN", +"RANGER_TAGSYNC", +"RANGER_USERSYNC", +"ZOOKEEPER_SERVER", +"ZOOKEEPER_CLIENT", +"KERBEROS_CLIENT", +"LOGSEARCH_SOLR", +"LOGSEARCH_SOLR_CLIENT" +], +"configuration_attributes": { +"ranger-hdfs-audit": {}, +"ssl-client": {}, +"ranger-admin-site": {}, +"ranger-hdfs-policymgr-ssl": {}, +"tagsync-application-properties": {}, +"ranger-env": {}, +"usersync-log4j": {}, +"ranger-hdfs-plugin-properties": {}, +"kerberos-env": {}, +"admin-properties": {}, +"ranger-ugsync-site": {}, +"hdfs-site": { +"final": { +"dfs.datanode.data.dir": "true", +"dfs.namenode.http-address": "true", +"dfs.datanode.failed.volumes.tolerated": "true", +"dfs.support.append": "true", +"dfs.namenode.name.dir": "true", +"dfs.webhdfs.enabled": "true" +} +}, +"ranger-tagsync-site": {}, +"zoo.cfg": {}, +"hadoop-policy": {}, +"hdfs-log4j": {}, +"krb5-conf": {}, +"core-site": { +"final": { +"fs.defaultFS": "true" +} +}, +"hadoop-env": {}, +"zookeeper-log4j": {}, +"ssl-server": {}, +"ranger-site": {}, +"admin-log4j": {}, +"tagsync-log4j": {}, +"ranger-hdfs-security": {}, +"usersync-properties": {}, +"zookeeper-env": {}, +"infra-solr-env": {}, +"infra-solr-client-log4j": {}, +"cluster-env": {} +}, +"public_hostname": "c6401.ambari.apache.org", +"commandId": "41-2", +"hostname": "c6401.ambari.apache.org", +"kerberosCommandParams": [], +"serviceName": "RANGER", +"role": "RANGER_ADMIN", +"forceRefreshConfigTagsBeforeExecution": [], +"requestId": 41, +"agentConfigParams": { +"agent": { +"parallel_execution": 0 +} +}, +"clusterName": "test_Cluster01", +"commandType": "EXECUTION_COMMAND", +"taskId": 186, +"roleParams": {}, +"configurationTags": { +"ranger-hdfs-audit": { +"tag": "version1466705299922" +}, +"ssl-client": { +"tag": "version1" +}, +"ranger-admin-site": { +"tag": "version1467016680635" +}, +"ranger-hdfs-policymgr-ssl": { +"tag": "version1466705299922" +}, +"tagsync-application-properties": { +"tag": "version1467016680511" +}, +"ranger-env": { +"tag": "version1466705299949" +}, +"ranger-ugsync-site": { +"tag": "version1467016680537" +}, +"ranger-hdfs-plugin-properties": { +"tag": "version1466705299922" +}, +"kerberos-env": { +"tag": "version1467016537243" +}, +"admin-properties": { +"tag": "version1466705299949" +}, +"hdfs-site": { +"tag": "version1467016680401" +}, +"ranger-tagsync-site": { +"tag": "version1467016680586" +}, +"zoo.cfg": { +"tag": "version1" +}, +"hadoop-policy": { +"tag": "version1" +}, +"hdfs-log4j": { +"tag": "version1" +}, +"usersync-log4j": { +"tag": "version1466705299949" +}, +"krb5-conf": { +"tag": "version1467016537243" +}, +"core-site": { +"tag": "version1467016680612" +}, +"hadoop-env": { +"tag": "version1467016680446" +}, +"zookeeper-log4j": { +"tag": "version1" +}, +"ssl-server": { +"tag": "version1" +}, +"ranger-site": { +"tag": "version1466705299949" +}, +"admin-log4j": { +"tag": "version1466705299949" +}, +"tagsync-log4j": { +"tag": "version1466705299949" +}, +
ambari git commit: AMBARI-19067. Special characters break creating user homes (Laszlo Puskas via magyari_sandor)
Repository: ambari Updated Branches: refs/heads/branch-2.5 8f26728cc -> 3e0d02145 AMBARI-19067. Special characters break creating user homes (Laszlo Puskas via magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/3e0d0214 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/3e0d0214 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/3e0d0214 Branch: refs/heads/branch-2.5 Commit: 3e0d02145e836621a375613767672a5ccb908203 Parents: 8f26728 Author: Laszlo Puskas Authored: Mon Dec 5 14:07:33 2016 +0100 Committer: Sandor Magyari Committed: Mon Dec 5 14:12:44 2016 +0100 -- .../src/main/resources/scripts/post-user-creation-hook.sh | 7 +++ 1 file changed, 7 insertions(+) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/3e0d0214/ambari-server/src/main/resources/scripts/post-user-creation-hook.sh -- diff --git a/ambari-server/src/main/resources/scripts/post-user-creation-hook.sh b/ambari-server/src/main/resources/scripts/post-user-creation-hook.sh index 34169c1..ee8d2d1 100755 --- a/ambari-server/src/main/resources/scripts/post-user-creation-hook.sh +++ b/ambari-server/src/main/resources/scripts/post-user-creation-hook.sh @@ -84,6 +84,10 @@ echo "[" | cat > "$JSON_INPUT" while read -r LINE do USR_NAME=$(echo "$LINE" | awk -F, '{print $1}') + echo "Processing user name: $USR_NAME" + + # encoding the username + USR_NAME=$(printf "%q" "$USR_NAME") cat <> "$JSON_INPUT" { @@ -97,7 +101,10 @@ do EOF done <"$CSV_FILE" +# deleting the last line sed -i '$ d' "$JSON_INPUT" + +# appending json closing elements to the end of the file echo $'}\n]' | cat >> "$JSON_INPUT" echo "Generating file $JSON_INPUT ... DONE." echo "Processing post user creation hook payload ... DONE."
ambari git commit: AMBARI-19067. Special characters break creating user homes (Laszlo Puskas via magyari_sandor)
Repository: ambari Updated Branches: refs/heads/trunk 7f6ca9d07 -> cac20e090 AMBARI-19067. Special characters break creating user homes (Laszlo Puskas via magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/cac20e09 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/cac20e09 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/cac20e09 Branch: refs/heads/trunk Commit: cac20e090151785edf2b8176d9ac0bddb1adc86f Parents: 7f6ca9d Author: Laszlo Puskas Authored: Mon Dec 5 14:07:33 2016 +0100 Committer: Sandor Magyari Committed: Mon Dec 5 14:07:33 2016 +0100 -- .../src/main/resources/scripts/post-user-creation-hook.sh | 7 +++ 1 file changed, 7 insertions(+) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/cac20e09/ambari-server/src/main/resources/scripts/post-user-creation-hook.sh -- diff --git a/ambari-server/src/main/resources/scripts/post-user-creation-hook.sh b/ambari-server/src/main/resources/scripts/post-user-creation-hook.sh index 34169c1..ee8d2d1 100755 --- a/ambari-server/src/main/resources/scripts/post-user-creation-hook.sh +++ b/ambari-server/src/main/resources/scripts/post-user-creation-hook.sh @@ -84,6 +84,10 @@ echo "[" | cat > "$JSON_INPUT" while read -r LINE do USR_NAME=$(echo "$LINE" | awk -F, '{print $1}') + echo "Processing user name: $USR_NAME" + + # encoding the username + USR_NAME=$(printf "%q" "$USR_NAME") cat <> "$JSON_INPUT" { @@ -97,7 +101,10 @@ do EOF done <"$CSV_FILE" +# deleting the last line sed -i '$ d' "$JSON_INPUT" + +# appending json closing elements to the end of the file echo $'}\n]' | cat >> "$JSON_INPUT" echo "Generating file $JSON_INPUT ... DONE." echo "Processing post user creation hook payload ... DONE."
ambari git commit: AMBARI-18956. Ambari attempts to commit transactions marked as rollback-only (magyari_sandor)
Repository: ambari Updated Branches: refs/heads/trunk d24beb17e -> 73d372b8d AMBARI-18956. Ambari attempts to commit transactions marked as rollback-only (magyari_sandor) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/73d372b8 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/73d372b8 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/73d372b8 Branch: refs/heads/trunk Commit: 73d372b8db6b4809fac98338aef1c04ae4c95c92 Parents: d24beb1 Author: Sandor Magyari Authored: Fri Dec 2 09:43:24 2016 +0100 Committer: Sandor Magyari Committed: Fri Dec 2 09:43:24 2016 +0100 -- .../orm/AmbariJpaLocalTxnInterceptor.java | 9 +- .../orm/AmbariJpaLocalTxnInterceptorTest.java | 155 +++ 2 files changed, 162 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/73d372b8/ambari-server/src/main/java/org/apache/ambari/server/orm/AmbariJpaLocalTxnInterceptor.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/AmbariJpaLocalTxnInterceptor.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/AmbariJpaLocalTxnInterceptor.java index d7ba463..e19192a 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/orm/AmbariJpaLocalTxnInterceptor.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/AmbariJpaLocalTxnInterceptor.java @@ -218,12 +218,17 @@ public class AmbariJpaLocalTxnInterceptor implements MethodInterceptor { /** * Returns True if rollback DID NOT HAPPEN (i.e. if commit should continue). * - * @param transactional The metadata annotaiton of the method + * @param transactional The metadata annotation of the method * @param e The exception to test for rollback * @param txn A JPA Transaction to issue rollbacks on */ - private boolean rollbackIfNecessary(Transactional transactional, Exception e, + static boolean rollbackIfNecessary(Transactional transactional, Exception e, EntityTransaction txn) { +if (txn.getRollbackOnly()) { + txn.rollback(); + return false; +} + boolean commit = true; //check rollback clauses http://git-wip-us.apache.org/repos/asf/ambari/blob/73d372b8/ambari-server/src/test/java/org/apache/ambari/server/orm/AmbariJpaLocalTxnInterceptorTest.java -- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/orm/AmbariJpaLocalTxnInterceptorTest.java b/ambari-server/src/test/java/org/apache/ambari/server/orm/AmbariJpaLocalTxnInterceptorTest.java new file mode 100644 index 000..ea7ea53 --- /dev/null +++ b/ambari-server/src/test/java/org/apache/ambari/server/orm/AmbariJpaLocalTxnInterceptorTest.java @@ -0,0 +1,155 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.ambari.server.orm; + +import com.google.inject.persist.Transactional; +import org.easymock.EasyMockSupport; +import org.junit.Assert; +import org.junit.Test; + +import javax.persistence.EntityTransaction; + +import java.io.FileNotFoundException; +import java.io.IOException; + +import static org.apache.ambari.server.orm.AmbariJpaLocalTxnInterceptor.rollbackIfNecessary; +import static org.easymock.EasyMock.expect; + +public class AmbariJpaLocalTxnInterceptorTest extends EasyMockSupport { + + @Test + public void canBeCommittedIfExceptionsToBeRolledBackOnIsEmpty() { +Transactional transactional = createNiceMock(Transactional.class); +EntityTransaction transaction = createStrictMock(EntityTransaction.class); + +expect(transaction.getRollbackOnly()).andReturn(false); +expect(transactional.rollbackOn()).andReturn(new Class[0]); + +replayAll(); + +boolean canCommit = rollbackIfNecessary(transactional, new RuntimeException(), transaction); +Assert.assertTrue("Should be allowed to commit, since rollbackOn