ambari git commit: Ambari-7767. Add an agent config to discover server hostname via a script
Repository: ambari Updated Branches: refs/heads/trunk 308a618f4 -> f3359f526 Ambari-7767. Add an agent config to discover server hostname via a script Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/f3359f52 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/f3359f52 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/f3359f52 Branch: refs/heads/trunk Commit: f3359f526edd55f1d6319fe147d156e7ff5cf56b Parents: 308a618 Author: Sumit Mohanty Authored: Wed Mar 25 17:37:18 2015 -0700 Committer: Sumit Mohanty Committed: Wed Mar 25 17:37:37 2015 -0700 -- ambari-agent/src/main/python/ambari_agent/hostname.py | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/f3359f52/ambari-agent/src/main/python/ambari_agent/hostname.py -- diff --git a/ambari-agent/src/main/python/ambari_agent/hostname.py b/ambari-agent/src/main/python/ambari_agent/hostname.py index e6140da..e33b739 100644 --- a/ambari-agent/src/main/python/ambari_agent/hostname.py +++ b/ambari-agent/src/main/python/ambari_agent/hostname.py @@ -67,7 +67,7 @@ def public_hostname(config): out, err = output.communicate() if (0 == output.returncode and 0 != len(out.strip())): cached_public_hostname = out.strip() -logger.info("Read public hostname " + cached_public_hostname + "using agent:public_hostname_script") +logger.info("Read public hostname '" + cached_public_hostname + "' using agent:public_hostname_script") return cached_public_hostname except: #ignore for now. @@ -87,6 +87,9 @@ def public_hostname(config): return cached_public_hostname def server_hostname(config): + """ + Reads the ambari server name from the config or using the supplied script + """ global cached_server_hostname if cached_server_hostname is not None: return cached_server_hostname @@ -98,7 +101,7 @@ def server_hostname(config): out, err = osStat.communicate() if (0 == osStat.returncode and 0 != len(out.strip())): cached_server_hostname = out.strip() -logger.info("Read server hostname " + cached_server_hostname + "using server:hostname_script") +logger.info("Read server hostname '" + cached_server_hostname + "' using server:hostname_script") except Exception, err: logger.info("Unable to execute hostname_script for server hostname. " + str(err))
ambari git commit: AMBARI-10212. Widgets: Add schema tables for PostgreSQL, MySQL and Oracle.
Repository: ambari Updated Branches: refs/heads/trunk 6e67329b8 -> 308a618f4 AMBARI-10212. Widgets: Add schema tables for PostgreSQL, MySQL and Oracle. Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/308a618f Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/308a618f Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/308a618f Branch: refs/heads/trunk Commit: 308a618f40f3c724dbbd33c178ebbab2c38b2ea4 Parents: 6e67329 Author: Siddharth Wagle Authored: Wed Mar 25 17:22:58 2015 -0700 Committer: Siddharth Wagle Committed: Wed Mar 25 17:22:58 2015 -0700 -- .../ambari/server/orm/dao/UserWidgetDAO.java| 99 + .../ambari/server/orm/dao/WidgetLayoutDAO.java | 99 + .../server/orm/entities/UserWidgetEntity.java | 222 +++ .../server/orm/entities/WidgetLayoutEntity.java | 130 +++ .../entities/WidgetLayoutUserWidgetEntity.java | 114 ++ .../WidgetLayoutUserWidgetEntityPK.java | 71 ++ .../server/upgrade/UpgradeCatalog210.java | 40 .../main/resources/Ambari-DDL-MySQL-CREATE.sql | 34 +++ .../main/resources/Ambari-DDL-Oracle-CREATE.sql | 34 +++ .../resources/Ambari-DDL-Postgres-CREATE.sql| 34 +++ .../Ambari-DDL-Postgres-EMBEDDED-CREATE.sql | 37 .../src/main/resources/META-INF/persistence.xml | 3 + .../server/orm/dao/UserWidgetDAOTest.java | 116 ++ .../server/orm/dao/WidgetLayoutDAOTest.java | 128 +++ .../server/upgrade/UpgradeCatalog210Test.java | 36 ++- 15 files changed, 1196 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/308a618f/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/UserWidgetDAO.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/UserWidgetDAO.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/UserWidgetDAO.java new file mode 100644 index 000..834da26 --- /dev/null +++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/UserWidgetDAO.java @@ -0,0 +1,99 @@ +/** + * 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.dao; + +import com.google.inject.Inject; +import com.google.inject.Provider; +import com.google.inject.Singleton; +import com.google.inject.persist.Transactional; +import org.apache.ambari.server.orm.RequiresSession; +import org.apache.ambari.server.orm.entities.UserWidgetEntity; +import org.apache.ambari.server.orm.entities.WidgetLayoutEntity; + +import javax.persistence.EntityManager; +import javax.persistence.NoResultException; +import javax.persistence.TypedQuery; +import java.util.List; + +@Singleton +public class UserWidgetDAO { + @Inject + Provider entityManagerProvider; + + /** + * DAO utilities for dealing mostly with {@link TypedQuery} results. + */ + @Inject + private DaoUtils daoUtils; + + @RequiresSession + public UserWidgetEntity findById(Long id) { +return entityManagerProvider.get().find(UserWidgetEntity.class, id); + } + + @RequiresSession + public List findByCluster(long clusterId) { +TypedQuery query = entityManagerProvider.get() +.createNamedQuery("UserWidgetEntity.findByCluster", UserWidgetEntity.class); +query.setParameter("clusterId", clusterId); + +return daoUtils.selectList(query); + } + + @RequiresSession + public List findBySectionName(String sectionName) { +TypedQuery query = entityManagerProvider.get() +.createNamedQuery("UserWidgetEntity.findBySectionName", UserWidgetEntity.class); +query.setParameter("sectionName", sectionName); + +return daoUtils.selectList(query); + } + + @RequiresSession + public List findAll() { +TypedQuery query = entityManagerProvider.get() +.createNamedQuery("UserWidgetEntity.findAll", UserWidgetEntity.class); + +return daoUtils.selectList(query); + } + + @Transactional + public void create(UserWidgetEntity userWi
ambari git commit: Ambari-7767. Add an agent config to discover server hostname via a script (Chuan Liu via smohanty)
Repository: ambari Updated Branches: refs/heads/trunk 7f8992ec8 -> 6e67329b8 Ambari-7767. Add an agent config to discover server hostname via a script (Chuan Liu via smohanty) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/6e67329b Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/6e67329b Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/6e67329b Branch: refs/heads/trunk Commit: 6e67329b81d429e26ac55f62c46818aa329aaa91 Parents: 7f8992e Author: Sumit Mohanty Authored: Wed Mar 25 16:54:07 2015 -0700 Committer: Sumit Mohanty Committed: Wed Mar 25 17:05:44 2015 -0700 -- .../main/python/ambari_agent/AmbariConfig.py| 3 +- .../src/main/python/ambari_agent/Controller.py | 2 +- .../src/main/python/ambari_agent/hostname.py| 24 ++ .../src/main/python/ambari_agent/main.py| 2 +- .../src/main/python/ambari_agent/security.py| 4 +-- .../test/python/ambari_agent/TestHostname.py| 34 +++- 6 files changed, 63 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/6e67329b/ambari-agent/src/main/python/ambari_agent/AmbariConfig.py -- diff --git a/ambari-agent/src/main/python/ambari_agent/AmbariConfig.py b/ambari-agent/src/main/python/ambari_agent/AmbariConfig.py index 05af243..ffaaac7 100644 --- a/ambari-agent/src/main/python/ambari_agent/AmbariConfig.py +++ b/ambari-agent/src/main/python/ambari_agent/AmbariConfig.py @@ -20,6 +20,7 @@ limitations under the License. import ConfigParser import StringIO +import hostname import json from NetUtil import NetUtil import os @@ -231,7 +232,7 @@ class AmbariConfig: def get_api_url(self): return "%s://%s:%s" % (self.CONNECTION_PROTOCOL, - self.get('server', 'hostname'), + hostname.server_hostname(self), self.get('server', 'url_port')) def isTwoWaySSLConnection(self): http://git-wip-us.apache.org/repos/asf/ambari/blob/6e67329b/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 bb85337..3f3e55d 100644 --- a/ambari-agent/src/main/python/ambari_agent/Controller.py +++ b/ambari-agent/src/main/python/ambari_agent/Controller.py @@ -63,7 +63,7 @@ class Controller(threading.Thread): self.credential = None self.config = config self.hostname = hostname.hostname(config) -self.serverHostname = config.get('server', 'hostname') +self.serverHostname = hostname.server_hostname(config) server_secured_url = 'https://' + self.serverHostname + \ ':' + config.get('server', 'secured_url_port') self.registerUrl = server_secured_url + '/agent/v1/register/' + self.hostname http://git-wip-us.apache.org/repos/asf/ambari/blob/6e67329b/ambari-agent/src/main/python/ambari_agent/hostname.py -- diff --git a/ambari-agent/src/main/python/ambari_agent/hostname.py b/ambari-agent/src/main/python/ambari_agent/hostname.py index 437eb84..e6140da 100644 --- a/ambari-agent/src/main/python/ambari_agent/hostname.py +++ b/ambari-agent/src/main/python/ambari_agent/hostname.py @@ -29,6 +29,7 @@ logger = logging.getLogger() cached_hostname = None cached_public_hostname = None +cached_server_hostname = None def hostname(config): @@ -66,6 +67,7 @@ def public_hostname(config): out, err = output.communicate() if (0 == output.returncode and 0 != len(out.strip())): cached_public_hostname = out.strip() +logger.info("Read public hostname " + cached_public_hostname + "using agent:public_hostname_script") return cached_public_hostname except: #ignore for now. @@ -84,9 +86,31 @@ def public_hostname(config): cached_public_hostname = socket.getfqdn().lower() return cached_public_hostname +def server_hostname(config): + global cached_server_hostname + if cached_server_hostname is not None: +return cached_server_hostname + + if config.has_option('server', 'hostname_script'): +scriptname = config.get('server', 'hostname_script') +try: + osStat = subprocess.Popen([scriptname], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + out, err = osStat.communicate() + if (0 == osStat.returncode and 0 != len(out.strip())): +cached_server_hostname = out.strip() +logger.info("Read server hostname " + cached_server_hostname + "using server:hostname_script") +except Exception, err: + logger.info("Unable to execute hos
ambari git commit: REVERT. Unintended commit c3ebed4c86370120e5172eeff54ed426eae97fb3
Repository: ambari Updated Branches: refs/heads/trunk 295f4f5bc -> 7f8992ec8 REVERT. Unintended commit c3ebed4c86370120e5172eeff54ed426eae97fb3 Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/7f8992ec Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/7f8992ec Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/7f8992ec Branch: refs/heads/trunk Commit: 7f8992ec8c0e2bd8a41b37d16e9483184caf2c4d Parents: 295f4f5 Author: Alejandro Fernandez Authored: Wed Mar 25 14:04:32 2015 -0700 Committer: Alejandro Fernandez Committed: Wed Mar 25 14:11:00 2015 -0700 -- .../server/orm/entities/HostStateEntity.java| 23 +++-- .../server/upgrade/UpgradeCatalog210.java | 34 +--- .../main/resources/Ambari-DDL-MySQL-CREATE.sql | 9 -- .../main/resources/Ambari-DDL-Oracle-CREATE.sql | 9 -- .../resources/Ambari-DDL-Postgres-CREATE.sql| 9 -- .../Ambari-DDL-Postgres-EMBEDDED-CREATE.sql | 9 -- .../resources/Ambari-DDL-SQLServer-CREATE.sql | 14 ++-- .../server/upgrade/UpgradeCatalog210Test.java | 27 8 files changed, 63 insertions(+), 71 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/7f8992ec/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostStateEntity.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostStateEntity.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostStateEntity.java index 0bbda53..5d5a1e8 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostStateEntity.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostStateEntity.java @@ -35,9 +35,9 @@ import org.apache.ambari.server.state.HostState; @Entity public class HostStateEntity { - @javax.persistence.Column(name = "host_id", nullable = false, insertable = false, updatable = false) + @javax.persistence.Column(name = "host_name", nullable = false, insertable = false, updatable = false) @Id - private Long hostId; + private String hostName; @Column(name = "available_mem", nullable = false, insertable = true, updatable = true) @Basic @@ -64,9 +64,17 @@ public class HostStateEntity { @OneToOne - @JoinColumn(name = "host_id", referencedColumnName = "id", nullable = false) + @JoinColumn(name = "host_name", referencedColumnName = "host_name", nullable = false) private HostEntity hostEntity; + public String getHostName() { +return hostName; + } + + public void setHostName(String hostName) { +this.hostName = hostName; + } + public Long getAvailableMem() { return availableMem; } @@ -122,27 +130,22 @@ public class HostStateEntity { HostStateEntity that = (HostStateEntity) o; -if (hostId != null ? hostId != that.hostId : that.hostId != null) return false; - -/* if (availableMem != null ? !availableMem.equals(that.availableMem) : that.availableMem != null) return false; if (timeInState != null ? !timeInState.equals(that.timeInState) : that.timeInState!= null) return false; if (agentVersion != null ? !agentVersion.equals(that.agentVersion) : that.agentVersion != null) return false; if (currentState != null ? !currentState.equals(that.currentState) : that.currentState != null) return false; -*/ +if (hostName != null ? !hostName.equals(that.hostName) : that.hostName != null) return false; return true; } @Override public int hashCode() { -int result = hostId != null ? hostId.intValue() : 0; -/* +int result = hostName != null ? hostName.hashCode() : 0; result = 31 * result + (availableMem != null ? availableMem.intValue() : 0); result = 31 * result + (timeInState != null ? timeInState.intValue() : 0); result = 31 * result + (agentVersion != null ? agentVersion.hashCode() : 0); result = 31 * result + (currentState != null ? currentState.hashCode() : 0); -*/ return result; } http://git-wip-us.apache.org/repos/asf/ambari/blob/7f8992ec/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog210.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog210.java b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog210.java index 00bb69e..92f1dac 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog210.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog210.java @@ -121,6 +121,7 @@ public class UpgradeCatalog210 extends AbstractUpgradeCatalog {
ambari git commit: Ambari-10210. TestMain.test_resolve_ambari_config fails on Mac
Repository: ambari Updated Branches: refs/heads/trunk ae9c18141 -> 295f4f5bc Ambari-10210. TestMain.test_resolve_ambari_config fails on Mac Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/295f4f5b Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/295f4f5b Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/295f4f5b Branch: refs/heads/trunk Commit: 295f4f5bc50cc56df6e5263b9cdf22a73946bb55 Parents: ae9c181 Author: Sumit Mohanty Authored: Wed Mar 25 12:15:42 2015 -0700 Committer: Sumit Mohanty Committed: Wed Mar 25 12:15:42 2015 -0700 -- ambari-agent/src/test/python/ambari_agent/TestMain.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/295f4f5b/ambari-agent/src/test/python/ambari_agent/TestMain.py -- diff --git a/ambari-agent/src/test/python/ambari_agent/TestMain.py b/ambari-agent/src/test/python/ambari_agent/TestMain.py index 3bca7de..3c20997 100644 --- a/ambari-agent/src/test/python/ambari_agent/TestMain.py +++ b/ambari-agent/src/test/python/ambari_agent/TestMain.py @@ -141,9 +141,11 @@ class TestMain(unittest.TestCase): signal_mock.assert_any_call(signal.SIGUSR1, HeartbeatHandlers.debug) + @patch("platform.linux_distribution") @patch("os.path.exists") @patch("ConfigParser.RawConfigParser.read") - def test_resolve_ambari_config(self, read_mock, exists_mock): + def test_resolve_ambari_config(self, read_mock, exists_mock, platform_mock): +platform_mock.return_value = "Linux" # Trying case if conf file exists exists_mock.return_value = True main.resolve_ambari_config()
[1/2] ambari git commit: AMBARI-10209. ClusterHostMapping table prevents cluster deployment, missing host_id column (alejandro)
Repository: ambari Updated Branches: refs/heads/trunk 907166990 -> ae9c18141 AMBARI-10209. ClusterHostMapping table prevents cluster deployment, missing host_id column (alejandro) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/ae9c1814 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/ae9c1814 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/ae9c1814 Branch: refs/heads/trunk Commit: ae9c18141f5d612942bd210e5d64e352e2f23846 Parents: d44a478 Author: Alejandro Fernandez Authored: Wed Mar 25 11:22:34 2015 -0700 Committer: Alejandro Fernandez Committed: Wed Mar 25 12:03:20 2015 -0700 -- ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql | 6 ++ ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql | 6 ++ .../src/main/resources/Ambari-DDL-Postgres-CREATE.sql | 6 ++ .../main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql| 6 ++ .../src/main/resources/Ambari-DDL-SQLServer-CREATE.sql| 7 ++- 5 files changed, 14 insertions(+), 17 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/ae9c1814/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql -- diff --git a/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql index f241544..214d980 100644 --- a/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql +++ b/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql @@ -320,10 +320,8 @@ CREATE TABLE metainfo ( CREATE TABLE ClusterHostMapping ( cluster_id BIGINT NOT NULL, - host_name VARCHAR(255) NOT NULL, - --host_id BIGINT NOT NULL, - PRIMARY KEY (cluster_id, host_name)); - --PRIMARY KEY (cluster_id, host_id)); + host_id BIGINT NOT NULL, + PRIMARY KEY (cluster_id, host_id)); CREATE TABLE ambari_sequences ( sequence_name VARCHAR(255), http://git-wip-us.apache.org/repos/asf/ambari/blob/ae9c1814/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql -- diff --git a/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql index ab55141..f0815ba 100644 --- a/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql +++ b/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql @@ -310,10 +310,8 @@ CREATE TABLE metainfo ( CREATE TABLE ClusterHostMapping ( cluster_id NUMBER(19) NOT NULL, - host_name VARCHAR2(255) NOT NULL, - --host_id NUMBER(19) NOT NULL, - PRIMARY KEY (cluster_id, host_name)); - --PRIMARY KEY (cluster_id, host_id)); + host_id NUMBER(19) NOT NULL, + PRIMARY KEY (cluster_id, host_id)); CREATE TABLE ambari_sequences ( sequence_name VARCHAR2(50) NOT NULL, http://git-wip-us.apache.org/repos/asf/ambari/blob/ae9c1814/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql -- diff --git a/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql index dcf6fba..fc5ad50 100644 --- a/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql +++ b/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql @@ -290,10 +290,8 @@ CREATE TABLE requestoperationlevel ( CREATE TABLE ClusterHostMapping ( cluster_id BIGINT NOT NULL, - host_name VARCHAR(255) NOT NULL, - --host_id BIGINT NOT NULL, - PRIMARY KEY (cluster_id, host_name)); - --PRIMARY KEY (cluster_id, host_id)); + host_id BIGINT NOT NULL, + PRIMARY KEY (cluster_id, host_id)); CREATE TABLE key_value_store ( "key" VARCHAR(255), http://git-wip-us.apache.org/repos/asf/ambari/blob/ae9c1814/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql -- diff --git a/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql index a291bc4..369e8ac 100644 --- a/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql +++ b/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql @@ -327,10 +327,8 @@ GRANT ALL PRIVILEGES ON TABLE ambari.requestoperationlevel TO :username; CREATE TABLE ambari.ClusterHostMapping ( cluster_id BIGINT NOT NULL, - host_name VARCHAR(255) NOT NULL, - --host_id BIGINT NOT NULL, - PRIMARY KEY (cluster_id, host_name)); - --PRIMARY KEY (cluster_id, host_id)); + host_id BIGINT NOT NULL, + PRIMARY KEY (cluster_id, host_id)); GRANT ALL PRIVILEGES ON TABLE ambari.ClusterHostMapping TO :username; CREATE TABLE ambari
[2/2] ambari git commit: other tables for clean delete of hosts
other tables for clean delete of hosts Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/d44a478c Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/d44a478c Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/d44a478c Branch: refs/heads/trunk Commit: d44a478cd2de22b4e93fb8f768831523fa3887b1 Parents: 9071669 Author: Alejandro Fernandez Authored: Wed Mar 25 00:28:55 2015 -0700 Committer: Alejandro Fernandez Committed: Wed Mar 25 12:03:20 2015 -0700 -- .../server/orm/entities/HostStateEntity.java| 23 ++--- .../server/upgrade/UpgradeCatalog210.java | 34 +++- .../main/resources/Ambari-DDL-MySQL-CREATE.sql | 9 ++ .../main/resources/Ambari-DDL-Oracle-CREATE.sql | 9 ++ .../resources/Ambari-DDL-Postgres-CREATE.sql| 9 ++ .../Ambari-DDL-Postgres-EMBEDDED-CREATE.sql | 9 ++ .../resources/Ambari-DDL-SQLServer-CREATE.sql | 14 ++-- .../server/upgrade/UpgradeCatalog210Test.java | 27 8 files changed, 71 insertions(+), 63 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/d44a478c/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostStateEntity.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostStateEntity.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostStateEntity.java index 5d5a1e8..0bbda53 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostStateEntity.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostStateEntity.java @@ -35,9 +35,9 @@ import org.apache.ambari.server.state.HostState; @Entity public class HostStateEntity { - @javax.persistence.Column(name = "host_name", nullable = false, insertable = false, updatable = false) + @javax.persistence.Column(name = "host_id", nullable = false, insertable = false, updatable = false) @Id - private String hostName; + private Long hostId; @Column(name = "available_mem", nullable = false, insertable = true, updatable = true) @Basic @@ -64,17 +64,9 @@ public class HostStateEntity { @OneToOne - @JoinColumn(name = "host_name", referencedColumnName = "host_name", nullable = false) + @JoinColumn(name = "host_id", referencedColumnName = "id", nullable = false) private HostEntity hostEntity; - public String getHostName() { -return hostName; - } - - public void setHostName(String hostName) { -this.hostName = hostName; - } - public Long getAvailableMem() { return availableMem; } @@ -130,22 +122,27 @@ public class HostStateEntity { HostStateEntity that = (HostStateEntity) o; +if (hostId != null ? hostId != that.hostId : that.hostId != null) return false; + +/* if (availableMem != null ? !availableMem.equals(that.availableMem) : that.availableMem != null) return false; if (timeInState != null ? !timeInState.equals(that.timeInState) : that.timeInState!= null) return false; if (agentVersion != null ? !agentVersion.equals(that.agentVersion) : that.agentVersion != null) return false; if (currentState != null ? !currentState.equals(that.currentState) : that.currentState != null) return false; -if (hostName != null ? !hostName.equals(that.hostName) : that.hostName != null) return false; +*/ return true; } @Override public int hashCode() { -int result = hostName != null ? hostName.hashCode() : 0; +int result = hostId != null ? hostId.intValue() : 0; +/* result = 31 * result + (availableMem != null ? availableMem.intValue() : 0); result = 31 * result + (timeInState != null ? timeInState.intValue() : 0); result = 31 * result + (agentVersion != null ? agentVersion.hashCode() : 0); result = 31 * result + (currentState != null ? currentState.hashCode() : 0); +*/ return result; } http://git-wip-us.apache.org/repos/asf/ambari/blob/d44a478c/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog210.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog210.java b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog210.java index 92f1dac..00bb69e 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog210.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog210.java @@ -121,7 +121,6 @@ public class UpgradeCatalog210 extends AbstractUpgradeCatalog { // Insert host id number into ambari_sequences dbAccessor.executeQuery("INSERT INTO ambari_sequences (
ambari git commit: AMBARI-10208. Service Graphs resize upon changing time range (alexantonenko)
Repository: ambari Updated Branches: refs/heads/trunk 271660a6d -> 907166990 AMBARI-10208. Service Graphs resize upon changing time range (alexantonenko) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/90716699 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/90716699 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/90716699 Branch: refs/heads/trunk Commit: 907166990a87469f89fc9d3e0508dc2ad4b0ff9d Parents: 271660a Author: Alex Antonenko Authored: Wed Mar 25 19:37:53 2015 +0200 Committer: Alex Antonenko Committed: Wed Mar 25 20:38:35 2015 +0200 -- .../app/views/main/service/info/summary.js | 8 +- .../views/main/service/info/summary_test.js | 207 ++- 2 files changed, 212 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/90716699/ambari-web/app/views/main/service/info/summary.js -- diff --git a/ambari-web/app/views/main/service/info/summary.js b/ambari-web/app/views/main/service/info/summary.js index c545b2a..f3fe1f5 100644 --- a/ambari-web/app/views/main/service/info/summary.js +++ b/ambari-web/app/views/main/service/info/summary.js @@ -22,6 +22,10 @@ require('data/service_graph_config'); App.MainServiceInfoSummaryView = Em.View.extend(App.UserPref, { templateName: require('templates/main/service/info/summary'), + /** + * @property {Number} chunkSize - number of columns in Metrics section + */ + chunkSize: 5, attributes:null, /** @@ -301,7 +305,7 @@ App.MainServiceInfoSummaryView = Em.View.extend(App.UserPref, { * (will only display rows with 5 items) */ constructGraphObjects: function(graphNames) { -var result = [], graphObjects = [], chunkSize = 5; +var result = [], graphObjects = [], chunkSize = this.get('chunkSize'); var self = this; if (!graphNames) { @@ -391,7 +395,7 @@ App.MainServiceInfoSummaryView = Em.View.extend(App.UserPref, { self.set('currentTimeRangeIndex', event.context.index); var svcName = self.get('service.serviceName'); if (svcName) { -var result = [], graphObjects = [], chunkSize = 2; +var result = [], graphObjects = [], chunkSize = this.get('chunkSize'); App.service_graph_config[svcName.toLowerCase()].forEach(function(graphName) { graphObjects.push(App["ChartServiceMetrics" + graphName].extend({ currentTimeIndex : event.context.index http://git-wip-us.apache.org/repos/asf/ambari/blob/90716699/ambari-web/test/views/main/service/info/summary_test.js -- diff --git a/ambari-web/test/views/main/service/info/summary_test.js b/ambari-web/test/views/main/service/info/summary_test.js index 58f7fde..97ff3c9 100644 --- a/ambari-web/test/views/main/service/info/summary_test.js +++ b/ambari-web/test/views/main/service/info/summary_test.js @@ -36,7 +36,7 @@ describe('App.MainServiceInfoSummaryView', function() { }); describe('#servers', function () { -it('services shuldn\'t have servers except FLUME and ZOOKEEPER', function () { +it('services shouldn\'t have servers except FLUME and ZOOKEEPER', function () { expect(view.get('servers')).to.be.empty; }); @@ -180,4 +180,209 @@ describe('App.MainServiceInfoSummaryView', function() { }); }); + + describe('#setTimeRange', function () { + +var cases = [ + { +currentTimeRangeIndex: 0, +isServiceMetricLoaded: false, +graphIds: [], +title: 'no event passed' + }, + { +event: {}, +currentTimeRangeIndex: 0, +isServiceMetricLoaded: false, +graphIds: [], +title: 'no event context passed' + }, + { +event: { + context: { +index: 1 + } +}, +currentTimeRangeIndex: 1, +isServiceMetricLoaded: false, +graphIds: [], +title: 'no service name set' + }, + { +event: { + context: { +index: 2 + } +}, +serviceName: 'HDFS', +currentTimeRangeIndex: 2, +isServiceMetricLoaded: true, +graphIds: [ + [ +'service-metrics-hdfs-space-utilization', 'service-metrics-hdfs-file-operations', +'service-metrics-hdfs-block-status', 'service-metrics-hdfs-io', 'service-metrics-hdfs-rpc' + ], + [ +'service-metrics-hdfs-gc', 'service-metrics-hdfs-jvm-heap', 'service-metrics-hdfs-jvm-threads' + ] +] + }, + { +event: { + context: { +index: 3 + } +}, +serviceName: 'YARN', +currentTimeRangeIndex:
ambari git commit: AMBARI-9997. Add Service Check to Tez Service.(vbrodetskyi)
Repository: ambari Updated Branches: refs/heads/trunk ce6d7454f -> 271660a6d AMBARI-9997. Add Service Check to Tez Service.(vbrodetskyi) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/271660a6 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/271660a6 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/271660a6 Branch: refs/heads/trunk Commit: 271660a6d0520e836d6613a5972b659cbdebd13e Parents: ce6d745 Author: Vitaly Brodetskyi Authored: Wed Mar 25 19:51:44 2015 +0200 Committer: Vitaly Brodetskyi Committed: Wed Mar 25 19:51:44 2015 +0200 -- .../libraries/functions/__init__.py | 1 + .../libraries/functions/get_hdp_version.py | 53 + .../0.12.0.2.0/package/scripts/hive_server.py | 5 - .../0.12.0.2.0/package/scripts/install_jars.py | 107 --- .../1.0.0.2.3/package/scripts/service_check.py | 4 +- .../common-services/TEZ/0.4.0.2.1/metainfo.xml | 8 +- .../TEZ/0.4.0.2.1/package/scripts/params.py | 6 ++ .../0.4.0.2.1/package/scripts/service_check.py | 98 + .../2.1.0.2.0/package/scripts/install_jars.py | 107 +++ .../YARN/2.1.0.2.0/package/scripts/params.py| 11 ++ .../package/scripts/resourcemanager.py | 8 +- .../stacks/HDP/2.1/role_command_order.json | 3 +- .../stacks/2.0.6/HIVE/test_hive_server.py | 66 ++-- .../stacks/2.0.6/YARN/test_resourcemanager.py | 23 ++-- .../python/stacks/2.1/TEZ/test_service_check.py | 81 ++ .../python/stacks/2.1/TEZ/test_tez_client.py| 5 +- 16 files changed, 398 insertions(+), 188 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/271660a6/ambari-common/src/main/python/resource_management/libraries/functions/__init__.py -- diff --git a/ambari-common/src/main/python/resource_management/libraries/functions/__init__.py b/ambari-common/src/main/python/resource_management/libraries/functions/__init__.py index e5d50a9..73607e1 100644 --- a/ambari-common/src/main/python/resource_management/libraries/functions/__init__.py +++ b/ambari-common/src/main/python/resource_management/libraries/functions/__init__.py @@ -38,6 +38,7 @@ from resource_management.libraries.functions.hive_check import * from resource_management.libraries.functions.version import * from resource_management.libraries.functions.format_jvm_option import * from resource_management.libraries.functions.constants import * +from resource_management.libraries.functions.get_hdp_version import * IS_WINDOWS = platform.system() == "Windows" http://git-wip-us.apache.org/repos/asf/ambari/blob/271660a6/ambari-common/src/main/python/resource_management/libraries/functions/get_hdp_version.py -- diff --git a/ambari-common/src/main/python/resource_management/libraries/functions/get_hdp_version.py b/ambari-common/src/main/python/resource_management/libraries/functions/get_hdp_version.py new file mode 100644 index 000..ed34c02 --- /dev/null +++ b/ambari-common/src/main/python/resource_management/libraries/functions/get_hdp_version.py @@ -0,0 +1,53 @@ +#!/usr/bin/env python +""" +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. + +Ambari Agent + +""" + +__all__ = ["get_hdp_version"] +import os +import re +from resource_management.core.logger import Logger +from resource_management.core.exceptions import Fail +from resource_management.core import shell + + +def get_hdp_version(package_name): + """ + @param package_name, name of the package, from which, function will try to get hdp version + """ + try: +command = 'hdp-select status ' + package_name +return_code, hdp_output = shell.call(command, timeout=20) + except Exception, e: +Logger.error(str(e)) +raise Fail('Unable to execute hdp-select command to retrieve the version.') + + if return_code != 0: +raise Fail( + 'Unable to determine the current version because of a non-zero return code of {0
ambari git commit: AMBARI-10197 - Apache builds for trunk are getting aborted (jonathanhurley)
Repository: ambari Updated Branches: refs/heads/trunk 65b5b9c28 -> ce6d7454f AMBARI-10197 - Apache builds for trunk are getting aborted (jonathanhurley) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/ce6d7454 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/ce6d7454 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/ce6d7454 Branch: refs/heads/trunk Commit: ce6d7454fb3df31470091b751b4fea1d46354377 Parents: 65b5b9c Author: Jonathan Hurley Authored: Wed Mar 25 13:23:54 2015 -0400 Committer: Jonathan Hurley Committed: Wed Mar 25 13:24:03 2015 -0400 -- .../test/python/ambari_agent/TestController.py | 27 +--- .../test/python/ambari_agent/TestHardware.py| 20 + .../test/python/ambari_agent/TestHostInfo.py| 45 +--- .../python/ambari_agent/TestRegistration.py | 12 +++--- 4 files changed, 38 insertions(+), 66 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/ce6d7454/ambari-agent/src/test/python/ambari_agent/TestController.py -- diff --git a/ambari-agent/src/test/python/ambari_agent/TestController.py b/ambari-agent/src/test/python/ambari_agent/TestController.py index 0c9144e..76470b3 100644 --- a/ambari-agent/src/test/python/ambari_agent/TestController.py +++ b/ambari-agent/src/test/python/ambari_agent/TestController.py @@ -30,35 +30,30 @@ from threading import Event import json from ambari_commons import OSCheck from only_for_platform import not_for_platform, only_for_platform, get_platform, PLATFORM_LINUX, PLATFORM_WINDOWS +from ambari_agent import Controller, ActionQueue, Register +from ambari_agent import hostname +from ambari_agent.Controller import AGENT_AUTO_RESTART_EXIT_CODE +from ambari_commons import OSCheck +from ambari_agent.Hardware import Hardware +import ambari_commons -if get_platform() != PLATFORM_WINDOWS: - os_distro_value = ('Suse','11','Final') -else: - os_distro_value = ('win2012serverr2','6.3','WindowsServer') - -with patch.object(OSCheck, "os_distribution", new = MagicMock(return_value = os_distro_value)): - from ambari_agent import Controller, ActionQueue, Register - from ambari_agent import hostname - from ambari_agent.Controller import AGENT_AUTO_RESTART_EXIT_CODE - from ambari_commons import OSCheck - from ambari_agent.Hardware import Hardware - import ambari_commons +OPERATING_SYSTEM_DISTRO = ('Suse','11','Final') @not_for_platform(PLATFORM_WINDOWS) -@patch.object(OSCheck, "os_distribution", new = os_distro_value) +@patch.object(OSCheck, "os_distribution", new = OPERATING_SYSTEM_DISTRO) class TestController(unittest.TestCase): logger = logging.getLogger() + @patch.object(Controller, "NetUtil", MagicMock()) + @patch.object(Controller, "AlertSchedulerHandler", MagicMock()) @patch("threading.Thread") @patch("threading.Lock") - @patch.object(Controller, "NetUtil") @patch.object(hostname, "hostname") - def setUp(self, hostname_method, NetUtil_mock, lockMock, threadMock): + def setUp(self, hostname_method, lockMock, threadMock): Controller.logger = MagicMock() lockMock.return_value = MagicMock() -NetUtil_mock.return_value = MagicMock() hostname_method.return_value = "test_hostname" http://git-wip-us.apache.org/repos/asf/ambari/blob/ce6d7454/ambari-agent/src/test/python/ambari_agent/TestHardware.py -- diff --git a/ambari-agent/src/test/python/ambari_agent/TestHardware.py b/ambari-agent/src/test/python/ambari_agent/TestHardware.py index 9bffaf6..8a3d257 100644 --- a/ambari-agent/src/test/python/ambari_agent/TestHardware.py +++ b/ambari-agent/src/test/python/ambari_agent/TestHardware.py @@ -22,17 +22,19 @@ from unittest import TestCase from mock.mock import patch, MagicMock import unittest import platform -from only_for_platform import only_for_platform, PLATFORM_LINUX - -with patch("platform.linux_distribution", return_value = ('Suse','11','Final')): - from ambari_agent import hostname - from ambari_agent.Hardware import Hardware - from ambari_agent.Facter import Facter, FacterLinux - from ambari_commons import OSCheck - -@only_for_platform(PLATFORM_LINUX) +import socket +from only_for_platform import not_for_platform, PLATFORM_WINDOWS +from ambari_agent import hostname +from ambari_agent.Hardware import Hardware +from ambari_agent.Facter import Facter, FacterLinux +from ambari_commons import OSCheck + +@not_for_platform(PLATFORM_WINDOWS) @patch.object(platform,"linux_distribution", new = ('Suse','11','Final')) +@patch.object(socket, "getfqdn", new = MagicMock(return_value = "ambari.apache.org")) +@patch.object(socket, "gethostbyname", new = MagicMock(return_value = "192.168.1.1")) class
ambari git commit: AMBARI-10149 Agent Automatic Bootstrap: Install and setup Ambari Agent
Repository: ambari Updated Branches: refs/heads/trunk 7f191208e -> 65b5b9c28 AMBARI-10149 Agent Automatic Bootstrap: Install and setup Ambari Agent Implemented setupAgent.py on Windows. +Downloading the Agent msi from the URL received as parameter +Installing, configuring & starting the Agent as a Windows service Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/65b5b9c2 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/65b5b9c2 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/65b5b9c2 Branch: refs/heads/trunk Commit: 65b5b9c287483deb478f6fc2109703b624952dd5 Parents: 7f19120 Author: Florian Barca Authored: Wed Mar 25 10:22:58 2015 -0700 Committer: Florian Barca Committed: Wed Mar 25 10:22:58 2015 -0700 -- ambari-agent/conf/windows/service_wrapper.py| 17 +- .../main/python/ambari_agent/AmbariConfig.py| 25 ++ .../src/main/python/ambari_commons/os_linux.py | 3 +- .../src/main/python/ambari_commons/os_utils.py | 8 +- .../main/python/ambari_commons/os_windows.py| 160 +- .../libraries/functions/install_hdp_msi.py | 2 +- ambari-server/src/main/python/setupAgent.py | 291 ++- ambari-server/src/test/python/TestSetupAgent.py | 28 +- 8 files changed, 512 insertions(+), 22 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/65b5b9c2/ambari-agent/conf/windows/service_wrapper.py -- diff --git a/ambari-agent/conf/windows/service_wrapper.py b/ambari-agent/conf/windows/service_wrapper.py index 5eb06c4..5831e11 100644 --- a/ambari-agent/conf/windows/service_wrapper.py +++ b/ambari-agent/conf/windows/service_wrapper.py @@ -15,6 +15,7 @@ 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. ''' +import ConfigParser import os import optparse import sys @@ -29,7 +30,7 @@ from ambari_commons.exceptions import * from ambari_commons.logging_utils import * from ambari_commons.os_windows import WinServiceController from ambari_commons.os_utils import find_in_path -from ambari_agent.AmbariConfig import AmbariConfig +from ambari_agent.AmbariConfig import AmbariConfig, updateConfigServerHostname from ambari_agent.HeartbeatHandlers import HeartbeatStopHandlers AMBARI_VERSION_VAR = "AMBARI_VERSION_VAR" @@ -120,10 +121,17 @@ def ctrlHandler(ctrlType): return True -def svcsetup(): +# +# Configures the Ambari Agent settings and registers the Windows service. +# +def setup(options): + config = AmbariConfig() + configFile = config.getConfigFile() + + updateConfigServerHostname(configFile, options.host_name) + AmbariAgentService.set_ctrl_c_handler(ctrlHandler) AmbariAgentService.Install() - pass # @@ -210,8 +218,7 @@ def agent_main(): options.exit_message = "Ambari Agent '%s' completed successfully." % action try: if action == SETUP_ACTION: - #TODO Insert setup(options) here upon need - svcsetup() + setup(options) elif action == START_ACTION: svcstart(options) elif action == DEBUG_ACTION: http://git-wip-us.apache.org/repos/asf/ambari/blob/65b5b9c2/ambari-agent/src/main/python/ambari_agent/AmbariConfig.py -- diff --git a/ambari-agent/src/main/python/ambari_agent/AmbariConfig.py b/ambari-agent/src/main/python/ambari_agent/AmbariConfig.py index 8975729..05af243 100644 --- a/ambari-agent/src/main/python/ambari_agent/AmbariConfig.py +++ b/ambari-agent/src/main/python/ambari_agent/AmbariConfig.py @@ -23,6 +23,10 @@ import StringIO import json from NetUtil import NetUtil import os + +from ambari_commons import OSConst +from ambari_commons.os_family_impl import OsFamilyFuncImpl, OsFamilyImpl + content = """ [server] @@ -173,6 +177,15 @@ class AmbariConfig: return self.config @staticmethod + @OsFamilyFuncImpl(OSConst.WINSRV_FAMILY) + def getConfigFile(): +if 'AMBARI_AGENT_CONF_DIR' in os.environ: + return os.path.join(os.environ['AMBARI_AGENT_CONF_DIR'], "ambari-agent.ini") +else: + return "ambari-agent.ini" + + @staticmethod + @OsFamilyFuncImpl(OsFamilyImpl.DEFAULT) def getConfigFile(): if 'AMBARI_AGENT_CONF_DIR' in os.environ: return os.path.join(os.environ['AMBARI_AGENT_CONF_DIR'], "ambari-agent.ini") @@ -232,6 +245,18 @@ class AmbariConfig: return False +def updateConfigServerHostname(configFile, new_host): + # update agent config file + agent_config = ConfigParser.ConfigParser() + agent_config.read(configFile) + server_host = agent_config.get('server', 'hostname') + if new_host is not None and server_host != new_host: +print "Updating
ambari git commit: AMBARI-10203. Add host: Install Options step is active during registering and check host (alexantonenko)
Repository: ambari Updated Branches: refs/heads/trunk 087c555f8 -> 7f191208e AMBARI-10203. Add host: Install Options step is active during registering and check host (alexantonenko) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/7f191208 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/7f191208 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/7f191208 Branch: refs/heads/trunk Commit: 7f191208e7a1117026d30efbc570fa23eaff091e Parents: 087c555 Author: Alex Antonenko Authored: Wed Mar 25 18:16:57 2015 +0200 Committer: Alex Antonenko Committed: Wed Mar 25 18:27:25 2015 +0200 -- ambari-web/app/controllers/wizard/step3_controller.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/7f191208/ambari-web/app/controllers/wizard/step3_controller.js -- diff --git a/ambari-web/app/controllers/wizard/step3_controller.js b/ambari-web/app/controllers/wizard/step3_controller.js index 59837dc..61cf64f 100644 --- a/ambari-web/app/controllers/wizard/step3_controller.js +++ b/ambari-web/app/controllers/wizard/step3_controller.js @@ -466,9 +466,9 @@ App.WizardStep3Controller = Em.Controller.extend({ App.router.get('installerController.isStepDisabled').filter(function (step) { return step.step >= 0 && step.step <= 2; }).setEach('value', this.get('isBackDisabled')); -if (this.get('isBackDisabled')) { - this.set('isSubmitDisabled', true); -} +App.router.get('addHostController.isStepDisabled').filter(function (step) { + return step.step >= 0 && step.step <= 1; +}).setEach('value', this.get('isBackDisabled')); }.observes('isBackDisabled'), /**
ambari git commit: AMBARI-10202. Support config-groups functionality for enhanced-configs (onechiporenko)
Repository: ambari Updated Branches: refs/heads/trunk 008cc6bad -> 087c555f8 AMBARI-10202. Support config-groups functionality for enhanced-configs (onechiporenko) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/087c555f Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/087c555f Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/087c555f Branch: refs/heads/trunk Commit: 087c555f8c9f5e40e8db773c6e795668430b1cce Parents: 008cc6b Author: Oleg Nechiporenko Authored: Wed Mar 25 18:07:11 2015 +0200 Committer: Oleg Nechiporenko Committed: Wed Mar 25 18:07:11 2015 +0200 -- .../app/mappers/configs/config_versions_mapper.js| 2 ++ .../common/configs/service_config_layout_tab_view.js | 15 +++ .../configs/widgets/slider_config_widget_view.js | 6 +++--- .../widgets/slider_config_widget_view_test.js| 8 4 files changed, 20 insertions(+), 11 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/087c555f/ambari-web/app/mappers/configs/config_versions_mapper.js -- diff --git a/ambari-web/app/mappers/configs/config_versions_mapper.js b/ambari-web/app/mappers/configs/config_versions_mapper.js index b470320..aad5a3b 100644 --- a/ambari-web/app/mappers/configs/config_versions_mapper.js +++ b/ambari-web/app/mappers/configs/config_versions_mapper.js @@ -37,6 +37,7 @@ App.configVersionsMapper = App.QuickDataMapper.create({ }, map: function (json, isForCompare) { +console.time("App.configVersionsMapper execution time"); var configVersions = []; var itemIds = {}; var serviceToHostMap = {}; @@ -124,6 +125,7 @@ App.configVersionsMapper = App.QuickDataMapper.create({ this.deleteUnusedProperties(requestedProperties); } +console.timeEnd("App.configVersionsMapper execution time"); }, http://git-wip-us.apache.org/repos/asf/ambari/blob/087c555f/ambari-web/app/views/common/configs/service_config_layout_tab_view.js -- diff --git a/ambari-web/app/views/common/configs/service_config_layout_tab_view.js b/ambari-web/app/views/common/configs/service_config_layout_tab_view.js index e1db1ad..72e4139 100644 --- a/ambari-web/app/views/common/configs/service_config_layout_tab_view.js +++ b/ambari-web/app/views/common/configs/service_config_layout_tab_view.js @@ -44,18 +44,25 @@ App.ServiceConfigLayoutTabView = Em.View.extend({ prepareConfigProperties: function () { var widgetTypeMap = this.get('widgetTypeMap'); var self = this; +var serviceName = self.get('controller.content.serviceName'); this.get('content.sectionRows').forEach(function (row) { row.forEach(function (section) { section.get('subsectionRows').forEach(function (subRow) { subRow.forEach(function (subsection) { subsection.set('configs', []); subsection.get('configProperties').forEach(function (config) { - var c = App.ConfigProperty.find(config.get('id') + '_' + self.get('controller.selectedVersion')); - subsection.get('configs').pushObject(c); + + var service = self.get('controller.stepConfigs').findProperty('serviceName', serviceName); + if (!service) return; + var configProperty = service.get('configs').findProperty('name', config.get('name')); + if (!configProperty) return; + + subsection.get('configs').pushObject(configProperty); var configWidgetType = config.get('widget.type'); var widget = widgetTypeMap[configWidgetType]; - Em.assert('Unknown config widget view for config ' + c.get('id') + ' with type ' + configWidgetType, widget); - c.set('widget', widget); + Em.assert('Unknown config widget view for config ' + configProperty.get('id') + ' with type ' + configWidgetType, widget); + configProperty.set('widget', widget); + configProperty.set('stackConfigProperty', config); }); }); }); http://git-wip-us.apache.org/repos/asf/ambari/blob/087c555f/ambari-web/app/views/common/configs/widgets/slider_config_widget_view.js -- diff --git a/ambari-web/app/views/common/configs/widgets/slider_config_widget_view.js b/ambari-web/app/views/common/configs/widgets/slider_config_widget_view.js index f6c44c5..bfcc965 100644 --- a/ambari-web/app/views/common/configs/widgets/slider_config_widget_view.js +++ b/ambari-web/app/views/common/configs/widgets/slider_config_widget_view.js @@ -92,9 +92,9 @@ App.SliderConfigWidgetView = App.ConfigWidgetView.extend({ parse
ambari git commit: AMBARI-10200. Storm secure config not visible through Ambari storm config UI (aonishuk)
Repository: ambari Updated Branches: refs/heads/trunk 90a88c6aa -> 008cc6bad AMBARI-10200. Storm secure config not visible through Ambari storm config UI (aonishuk) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/008cc6ba Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/008cc6ba Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/008cc6ba Branch: refs/heads/trunk Commit: 008cc6bad32f054de1686af0921ca0a2d024fa5a Parents: 90a88c6 Author: Andrew Onishuk Authored: Wed Mar 25 17:46:08 2015 +0200 Committer: Andrew Onishuk Committed: Wed Mar 25 17:46:08 2015 +0200 -- .../0.1.0/configuration/storm-site.xml | 34 ++ .../AMBARI_METRICS/0.1.0/metainfo.xml | 4 ++ .../0.9.1.2.1/configuration/storm-site.xml | 5 ++ .../STORM/0.9.1.2.1/kerberos.json | 7 ++- .../STORM/0.9.1.2.1/package/scripts/params.py | 6 ++ .../STORM/0.9.1.2.1/package/scripts/storm.py| 10 ++- .../0.9.1.2.1/package/scripts/yaml_utils.py | 27 ++-- .../0.9.1.2.1/package/templates/storm.yaml.j2 | 65 .../services/STORM/configuration/storm-site.xml | 6 +- .../services/STORM/configuration/storm-site.xml | 6 +- .../python/stacks/2.1/STORM/test_storm_base.py | 29 + .../stacks/2.1/configs/default-storm-start.json | 1 + .../stacks/2.1/configs/secured-storm-start.json | 3 +- 13 files changed, 103 insertions(+), 100 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/008cc6ba/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/configuration/storm-site.xml -- diff --git a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/configuration/storm-site.xml b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/configuration/storm-site.xml new file mode 100644 index 000..35456d7 --- /dev/null +++ b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/configuration/storm-site.xml @@ -0,0 +1,34 @@ + + + + + + +topology.metrics.consumer.register +[{'class': 'org.apache.hadoop.metrics2.sink.storm.StormTimelineMetricsSink', 'parallelism.hint': 1}] +Topology metrics consumer register parameters. + + +metrics.reporter.register + org.apache.hadoop.metrics2.sink.storm.StormTimelineMetricsReporter +Topology metrics reporter. + + http://git-wip-us.apache.org/repos/asf/ambari/blob/008cc6ba/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/metainfo.xml -- diff --git a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/metainfo.xml b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/metainfo.xml index ac954e6..39b640c 100644 --- a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/metainfo.xml +++ b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/metainfo.xml @@ -129,6 +129,10 @@ ams-hbase-log4j + +storm-site + + http://git-wip-us.apache.org/repos/asf/ambari/blob/008cc6ba/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/configuration/storm-site.xml -- diff --git a/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/configuration/storm-site.xml b/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/configuration/storm-site.xml index b6a2cf2..5e96fb1 100644 --- a/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/configuration/storm-site.xml +++ b/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/configuration/storm-site.xml @@ -37,6 +37,11 @@ have permission to read/write from this location. +storm.log.dir +{{log_dir}} +Log directory for Storm. + + storm.zookeeper.servers ['localhost'] A list of hosts of ZooKeeper servers used to manage the cluster. http://git-wip-us.apache.org/repos/asf/ambari/blob/008cc6ba/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/kerberos.json -- diff --git a/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/kerberos.json b/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/kerberos.json index 50b92ff..94eaae1 100644 --- a/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/kerberos.json +++ b/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/kerberos.json @@ -37,7 +37,12 @@ "drpc.authorizer": "backtype.storm.security.auth.authorizer.DRPCSimpleACLAuthorizer",
ambari git commit: AMBARI-10201. Ambari-agent rpm install fails on Centos7 (aonishuk)
Repository: ambari Updated Branches: refs/heads/trunk 8d3da8ef2 -> 90a88c6aa AMBARI-10201. Ambari-agent rpm install fails on Centos7 (aonishuk) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/90a88c6a Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/90a88c6a Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/90a88c6a Branch: refs/heads/trunk Commit: 90a88c6aab93717c9c498e5a10e46327ed1c6d2c Parents: 8d3da8e Author: Andrew Onishuk Authored: Wed Mar 25 17:45:42 2015 +0200 Committer: Andrew Onishuk Committed: Wed Mar 25 17:45:42 2015 +0200 -- ambari-agent/conf/unix/install-helper.sh | 2 +- ambari-agent/pom.xml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/90a88c6a/ambari-agent/conf/unix/install-helper.sh -- diff --git a/ambari-agent/conf/unix/install-helper.sh b/ambari-agent/conf/unix/install-helper.sh index 75acab7..7c18b35 100644 --- a/ambari-agent/conf/unix/install-helper.sh +++ b/ambari-agent/conf/unix/install-helper.sh @@ -52,7 +52,7 @@ do_install(){ chmod 440 "$SUDOERS_FILE" - grep '^#includedir /etc/sudoers.d$' /etc/sudoers + grep '^#includedir /etc/sudoers.d$' /etc/sudoers > /dev/null if [ $? -ne 0 ] ; then echo '#includedir /etc/sudoers.d' >> /etc/sudoers fi http://git-wip-us.apache.org/repos/asf/ambari/blob/90a88c6a/ambari-agent/pom.xml -- diff --git a/ambari-agent/pom.xml b/ambari-agent/pom.xml index ab07b9c..110a8d5 100644 --- a/ambari-agent/pom.xml +++ b/ambari-agent/pom.xml @@ -385,6 +385,7 @@ ${sudoers.d.dir} root root + false etc/sudoers.d
ambari git commit: AMBARI-10176. Storm service check failed after disabling security (rlevas)
Repository: ambari Updated Branches: refs/heads/trunk f5594591e -> 8d3da8ef2 AMBARI-10176. Storm service check failed after disabling security (rlevas) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/8d3da8ef Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/8d3da8ef Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/8d3da8ef Branch: refs/heads/trunk Commit: 8d3da8ef2458cc49d9093bda605f2099e5683573 Parents: f559459 Author: Robert Levas Authored: Wed Mar 25 09:13:45 2015 -0400 Committer: Robert Levas Committed: Wed Mar 25 09:14:02 2015 -0400 -- .../server/controller/KerberosHelper.java | 49 ++-- .../kerberos/KerberosConfigDataFile.java| 4 ++ .../kerberos/KerberosConfigDataFileBuilder.java | 13 +++-- .../UpdateKerberosConfigsServerAction.java | 60 ++-- .../ambari/server/state/ConfigHelper.java | 11 +++- .../0.9.1.2.1/configuration/storm-site.xml | 5 -- .../kerberos/KerberosConfigDataFileTest.java| 26 +++-- .../UpdateKerberosConfigsServerActionTest.java | 3 +- 8 files changed, 130 insertions(+), 41 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/8d3da8ef/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelper.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelper.java index 01f7846..75062a1 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelper.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelper.java @@ -411,7 +411,7 @@ public class KerberosHelper { setAuthToLocalRules(kerberosDescriptor, cluster, kerberosDetails.getDefaultRealm(), configurations, kerberosConfigurations); for (Map.Entry> entry : kerberosConfigurations.entrySet()) { -configHelper.updateConfigType(cluster, ambariManagementController, entry.getKey(), entry.getValue(), +configHelper.updateConfigType(cluster, ambariManagementController, entry.getKey(), entry.getValue(), null, ambariManagementController.getAuthName(), String.format("Enabling Kerberos for %s", serviceName)); } } @@ -2253,7 +2253,8 @@ public class KerberosHelper { for (Map.Entry configTypeEntry : properties.entrySet()) { kerberosConfDataFileBuilder.addRecord(type, configTypeEntry.getKey(), -configTypeEntry.getValue()); +configTypeEntry.getValue(), +KerberosConfigDataFile.OPERATION_TYPE_SET); } } } @@ -2373,9 +2374,21 @@ public class KerberosHelper { // If there are configurations to set, create a (temporary) data file to store the configuration // updates and fill it will the relevant configurations. if (!kerberosConfigurations.isEmpty()) { +Map> configurationsToRemove = new HashMap>(); File configFile = new File(dataDirectory, KerberosConfigDataFile.DATA_FILE_NAME); KerberosConfigDataFileBuilder kerberosConfDataFileBuilder = null; +// Fill the configurationsToRemove map with all Kerberos-related configurations. Values +// needed to be kept will have new values from the stack definition and thus pruned from +// this map. +for (Map.Entry> entry : kerberosConfigurations.entrySet()) { + configurationsToRemove.put(entry.getKey(), new HashSet(entry.getValue().keySet())); +} + +// Remove cluster-env from the set of configurations to remove since it has no default set +// or properties and the logic below will remove all from this set - which is not desirable. +configurationsToRemove.remove("cluster-env"); + if (serviceComponentHosts != null) { Set visitedServices = new HashSet(); @@ -2395,10 +2408,18 @@ public class KerberosHelper { String filename = propertyInfo.getFilename(); if (filename != null) { - Map kerberosConfiguration = kerberosConfigurations.get(ConfigHelper.fileNameToConfigType(filename)); + String type = ConfigHelper.fileNameToConfigType(filename); + String propertyName = propertyInfo.getName(); - if ((kerberosConfiguration != null) && (kerberosConfiguration.containsKey(propertyInfo.getName( { -kerberosConfiguration.put(propertyInfo.getName(), propertyInfo.getValue()); + Map kerberosConfiguration = kerberosConfi
ambari git commit: AMBARI-10199. RU: Config History table: text filters not working after typing '?' character. (akovalenko)
Repository: ambari Updated Branches: refs/heads/trunk f73936a28 -> f5594591e AMBARI-10199. RU: Config History table: text filters not working after typing '?' character. (akovalenko) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/f5594591 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/f5594591 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/f5594591 Branch: refs/heads/trunk Commit: f5594591ebcd4f872002c004c787a75616ec19d4 Parents: f73936a Author: Aleksandr Kovalenko Authored: Wed Mar 25 14:10:26 2015 +0200 Committer: Aleksandr Kovalenko Committed: Wed Mar 25 14:10:26 2015 +0200 -- ambari-web/app/views/common/filter_view.js| 10 -- .../app/views/main/dashboard/config_history_view.js | 4 +++- ambari-web/test/mappers/stack_service_mapper_test.js | 3 --- ambari-web/test/views/common/filter_view_test.js | 5 + 4 files changed, 16 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/f5594591/ambari-web/app/views/common/filter_view.js -- diff --git a/ambari-web/app/views/common/filter_view.js b/ambari-web/app/views/common/filter_view.js index 2145254..f1f18d8 100644 --- a/ambari-web/app/views/common/filter_view.js +++ b/ambari-web/app/views/common/filter_view.js @@ -28,6 +28,8 @@ var App = require('app'); +var validator = require('utils/validator'); + var wrapperView = Ember.View.extend({ classNames: ['view-wrapper'], layout: Ember.Handlebars.compile(' {{yield}}'), @@ -639,8 +641,12 @@ module.exports = { case 'string': default: return function (origin, compareValue) { - var regex = new RegExp(compareValue, "i"); - return regex.test(origin); + if (validator.isValidMatchesRegexp(compareValue)) { +var regex = new RegExp(compareValue, "i"); +return regex.test(origin); + } else { +return false; + } } } } http://git-wip-us.apache.org/repos/asf/ambari/blob/f5594591/ambari-web/app/views/main/dashboard/config_history_view.js -- diff --git a/ambari-web/app/views/main/dashboard/config_history_view.js b/ambari-web/app/views/main/dashboard/config_history_view.js index 0e4d788..19c4233 100644 --- a/ambari-web/app/views/main/dashboard/config_history_view.js +++ b/ambari-web/app/views/main/dashboard/config_history_view.js @@ -205,5 +205,7 @@ App.MainConfigHistoryView = App.TableView.extend(App.TableServerViewMixin, { */ colPropAssoc: function () { return this.get('controller.colPropAssoc'); - }.property('controller.colPropAssoc') + }.property('controller.colPropAssoc'), + + filter: Em.K }); http://git-wip-us.apache.org/repos/asf/ambari/blob/f5594591/ambari-web/test/mappers/stack_service_mapper_test.js -- diff --git a/ambari-web/test/mappers/stack_service_mapper_test.js b/ambari-web/test/mappers/stack_service_mapper_test.js index 7a390d5..1b6ccfa 100644 --- a/ambari-web/test/mappers/stack_service_mapper_test.js +++ b/ambari-web/test/mappers/stack_service_mapper_test.js @@ -206,9 +206,6 @@ describe('App.stackServiceMapper', function () { App.stackServiceMapper.clearStackModels(); }); -afterEach(function () { -}); - it('should sort and map data about services with their components', function () { App.stackServiceMapper.map(data); var services = App.StackService.find(), http://git-wip-us.apache.org/repos/asf/ambari/blob/f5594591/ambari-web/test/views/common/filter_view_test.js -- diff --git a/ambari-web/test/views/common/filter_view_test.js b/ambari-web/test/views/common/filter_view_test.js index e5ca1ad..1afd844 100644 --- a/ambari-web/test/views/common/filter_view_test.js +++ b/ambari-web/test/views/common/filter_view_test.js @@ -379,6 +379,11 @@ describe('filters.getFilterByType', function () { condition: 'hello', value: '', result: false + }, + { +condition: '?', +value: 'hello', +result: false } ];
[1/2] ambari git commit: AMBARI-10190. Full Delete of Host : Add host_id column to clusterhostmapping, and create initial UpgradeCatalog210 (alejandro)
Repository: ambari Updated Branches: refs/heads/trunk d83c14c40 -> f73936a28 http://git-wip-us.apache.org/repos/asf/ambari/blob/f73936a2/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql -- diff --git a/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql index a06f1d2..26f4428 100644 --- a/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql +++ b/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql @@ -27,6 +27,10 @@ CREATE SCHEMA ambari AUTHORIZATION :username; ALTER SCHEMA ambari OWNER TO :username; ALTER ROLE :username SET search_path TO 'ambari'; +-- DEVELOPER COMMENT +-- Ambari is transitioning to make the host_id the FK instead of the host_name. +-- Please do not remove lines that are related to this change and are being staged. + --create tables and grant privileges to db user- CREATE TABLE ambari.clusters ( cluster_id BIGINT NOT NULL, @@ -117,12 +121,14 @@ CREATE TABLE ambari.hostcomponentdesiredstate ( desired_stack_version VARCHAR(255) NOT NULL, desired_state VARCHAR(255) NOT NULL, host_name VARCHAR(255) NOT NULL, + --host_id BIGINT NOT NULL, service_name VARCHAR(255) NOT NULL, admin_state VARCHAR(32), maintenance_state VARCHAR(32) NOT NULL, security_state VARCHAR(32) NOT NULL DEFAULT 'UNSECURED', restart_required SMALLINT NOT NULL DEFAULT 0, PRIMARY KEY (cluster_id, component_name, host_name, service_name)); + --PRIMARY KEY (cluster_id, component_name, host_id, service_name)); GRANT ALL PRIVILEGES ON TABLE ambari.hostcomponentdesiredstate TO :username; CREATE TABLE ambari.hostcomponentstate ( @@ -132,13 +138,16 @@ CREATE TABLE ambari.hostcomponentstate ( current_stack_version VARCHAR(255) NOT NULL, current_state VARCHAR(255) NOT NULL, host_name VARCHAR(255) NOT NULL, + --host_id BIGINT NOT NULL, service_name VARCHAR(255) NOT NULL, upgrade_state VARCHAR(32) NOT NULL DEFAULT 'NONE', security_state VARCHAR(32) NOT NULL DEFAULT 'UNSECURED', PRIMARY KEY (cluster_id, component_name, host_name, service_name)); + --PRIMARY KEY (cluster_id, component_name, host_id, service_name)); GRANT ALL PRIVILEGES ON TABLE ambari.hostcomponentstate TO :username; CREATE TABLE ambari.hosts ( + id BIGINT NOT NULL, host_name VARCHAR(255) NOT NULL, cpu_count INTEGER NOT NULL, ph_cpu_count INTEGER, @@ -154,7 +163,7 @@ CREATE TABLE ambari.hosts ( os_type VARCHAR(255) NOT NULL, rack_info VARCHAR(255) NOT NULL, total_mem BIGINT NOT NULL, - PRIMARY KEY (host_name)); + PRIMARY KEY (id)); GRANT ALL PRIVILEGES ON TABLE ambari.hosts TO :username; CREATE TABLE ambari.hoststate ( @@ -163,15 +172,18 @@ CREATE TABLE ambari.hoststate ( current_state VARCHAR(255) NOT NULL, health_status VARCHAR(255), host_name VARCHAR(255) NOT NULL, + --host_id BIGINT NOT NULL, time_in_state BIGINT NOT NULL, maintenance_state VARCHAR(512), PRIMARY KEY (host_name)); + --PRIMARY KEY (host_id)); GRANT ALL PRIVILEGES ON TABLE ambari.hoststate TO :username; CREATE TABLE ambari.host_version ( id BIGINT NOT NULL, - host_name VARCHAR(255) NOT NULL, repo_version_id BIGINT NOT NULL, + host_name VARCHAR(255) NOT NULL, + --host_id BIGINT NOT NULL, state VARCHAR(32) NOT NULL, PRIMARY KEY (id)); GRANT ALL PRIVILEGES ON TABLE ambari.host_version TO :username; @@ -238,6 +250,7 @@ CREATE TABLE ambari.host_role_command ( event VARCHAR(32000) NOT NULL, exitcode INTEGER NOT NULL, host_name VARCHAR(255) NOT NULL, + --host_id BIGINT NOT NULL, last_attempt_time BIGINT NOT NULL, request_id BIGINT NOT NULL, role VARCHAR(255), @@ -310,13 +323,16 @@ CREATE TABLE ambari.requestoperationlevel ( service_name VARCHAR(255), host_component_name VARCHAR(255), host_name VARCHAR(255), + --host_id BIGINT NOT NULL, PRIMARY KEY (operation_level_id)); GRANT ALL PRIVILEGES ON TABLE ambari.requestoperationlevel TO :username; CREATE TABLE ambari.ClusterHostMapping ( cluster_id BIGINT NOT NULL, host_name VARCHAR(255) NOT NULL, + --host_id BIGINT NOT NULL, PRIMARY KEY (cluster_id, host_name)); + --PRIMARY KEY (cluster_id, host_id)); GRANT ALL PRIVILEGES ON TABLE ambari.ClusterHostMapping TO :username; CREATE TABLE ambari.key_value_store ( @@ -328,6 +344,7 @@ GRANT ALL PRIVILEGES ON TABLE ambari.key_value_store TO :username; CREATE TABLE ambari.hostconfigmapping ( cluster_id BIGINT NOT NULL, host_name VARCHAR(255) NOT NULL, + --host_id BIGINT NOT NULL, type_name VARCHAR(255) NOT NULL, version_tag VARCHAR(255) NOT NULL, service_name VARCHAR(255), @@ -335,6 +352,7 @@ CREATE TABLE ambari.hostconfigmapping ( selected INTEGER NOT NULL DEFAULT 0, user_name VARCHAR(255) NOT NULL DEFAULT '_db', PRIMARY KEY (cluster_id, host_name, type_name, create_timestam
[2/2] ambari git commit: AMBARI-10190. Full Delete of Host : Add host_id column to clusterhostmapping, and create initial UpgradeCatalog210 (alejandro)
AMBARI-10190. Full Delete of Host : Add host_id column to clusterhostmapping, and create initial UpgradeCatalog210 (alejandro) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/f73936a2 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/f73936a2 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/f73936a2 Branch: refs/heads/trunk Commit: f73936a281896b82e89a64399f712d0e17142637 Parents: d83c14c Author: Alejandro Fernandez Authored: Thu Mar 19 10:36:36 2015 -0700 Committer: Alejandro Fernandez Committed: Wed Mar 25 00:26:07 2015 -0700 -- .../ambari/server/agent/HeartBeatHandler.java | 4 +- .../server/api/query/JpaPredicateVisitor.java | 20 +- .../listeners/alerts/AlertReceivedListener.java | 13 +- .../apache/ambari/server/orm/dao/AlertsDAO.java | 1 - .../apache/ambari/server/orm/dao/HostDAO.java | 19 +- .../ambari/server/orm/entities/HostEntity.java | 34 ++- .../org/apache/ambari/server/state/Alert.java | 16 +- .../server/upgrade/SchemaUpgradeHelper.java | 1 + .../server/upgrade/UpgradeCatalog210.java | 293 ++ .../main/resources/Ambari-DDL-MySQL-CREATE.sql | 44 ++- .../main/resources/Ambari-DDL-Oracle-CREATE.sql | 38 ++- .../resources/Ambari-DDL-Postgres-CREATE.sql| 294 +++ .../Ambari-DDL-Postgres-EMBEDDED-CREATE.sql | 55 +++- .../resources/Ambari-DDL-SQLServer-CREATE.sql | 52 +++- .../actionmanager/TestActionDBAccessorImpl.java | 2 +- .../state/alerts/AlertReceivedListenerTest.java | 2 +- .../server/upgrade/UpgradeCatalog210Test.java | 148 ++ 17 files changed, 848 insertions(+), 188 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/f73936a2/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatHandler.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatHandler.java b/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatHandler.java index 8833148..9f39049 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatHandler.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatHandler.java @@ -293,8 +293,8 @@ public class HeartBeatHandler { if (null != heartbeat.getAlerts()) { for (Alert alert : heartbeat.getAlerts()) { -if (null == alert.getHost()) { - alert.setHost(hostname); +if (null == alert.getHostName()) { + alert.setHostName(hostname); } try { http://git-wip-us.apache.org/repos/asf/ambari/blob/f73936a2/ambari-server/src/main/java/org/apache/ambari/server/api/query/JpaPredicateVisitor.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/query/JpaPredicateVisitor.java b/ambari-server/src/main/java/org/apache/ambari/server/api/query/JpaPredicateVisitor.java index afbb3e2..75ca2d2 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/api/query/JpaPredicateVisitor.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/api/query/JpaPredicateVisitor.java @@ -158,10 +158,12 @@ public abstract class JpaPredicateVisitor implements PredicateVisitor { for (SingularAttribute singularAttribute : singularAttributes) { lastSingularAttribute = singularAttribute; - if (null == path) { -path = m_root.get(singularAttribute.getName()); - } else { -path = path.get(singularAttribute.getName()); + if (singularAttribute != null) { +if (null == path) { + path = m_root.get(singularAttribute.getName()); +} else { + path = path.get(singularAttribute.getName()); +} } } @@ -173,10 +175,12 @@ public abstract class JpaPredicateVisitor implements PredicateVisitor { Comparable value = predicate.getValue(); // convert string to enum for proper JPA comparisons -Class clazz = lastSingularAttribute.getJavaType(); -if (clazz.isEnum()) { - Class enumClass = (Class) clazz; - value = Enum.valueOf(enumClass, value.toString()); +if (lastSingularAttribute != null) { + Class clazz = lastSingularAttribute.getJavaType(); + if (clazz.isEnum()) { +Class enumClass = (Class) clazz; +value = Enum.valueOf(enumClass, value.toString()); + } } javax.persistence.criteria.Predicate jpaPredicate = null; http://git-wip-us.apache.org/repos/asf/ambari/blob/f73936a2/ambari-server/src/main/java/org/apache/ambari/server/events/listeners/alerts/AlertReceivedListener.java -- diff --git a/ambari-server/src/main/j