You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by am...@apache.org on 2017/10/17 14:58:17 UTC

[01/50] ambari git commit: AMBARI-22199.Zeppelin start fails due to permission denied error during kinit(Venkata Sairam)

Repository: ambari
Updated Branches:
  refs/heads/branch-feature-AMBARI-22008 76493295e -> 560b437b2


AMBARI-22199.Zeppelin start fails due to permission denied error during kinit(Venkata Sairam)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/33d67f3e
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/33d67f3e
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/33d67f3e

Branch: refs/heads/branch-feature-AMBARI-22008
Commit: 33d67f3ead24fcda4fcdb7d5920ccc76d1743657
Parents: 7e885a3
Author: Venkata Sairam <ve...@gmail.com>
Authored: Wed Oct 11 14:46:39 2017 +0530
Committer: Venkata Sairam <ve...@gmail.com>
Committed: Wed Oct 11 14:46:39 2017 +0530

----------------------------------------------------------------------
 .../ZEPPELIN/0.7.0/package/scripts/master.py    |  48 ++++---
 .../stacks/2.6/ZEPPELIN/test_zeppelin_070.py    | 140 ++++++++++++++++---
 2 files changed, 147 insertions(+), 41 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/33d67f3e/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/master.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/master.py b/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/master.py
index d615d06..09944bd 100644
--- a/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/master.py
+++ b/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/master.py
@@ -192,8 +192,7 @@ class Master(Script):
       notebook_directory = "/user/" + format("{zeppelin_user}") + "/" + \
                            params.config['configurations']['zeppelin-config']['zeppelin.notebook.dir']
 
-
-    if self.is_path_exists_in_HDFS(notebook_directory, params.zeppelin_user):
+    if not self.is_path_exists_in_HDFS(notebook_directory, params.zeppelin_user):
       # hdfs dfs -mkdir {notebook_directory}
       params.HdfsResource(format("{notebook_directory}"),
                           type="directory",
@@ -231,14 +230,14 @@ class Master(Script):
     Execute(("chown", "-R", format("{zeppelin_user}") + ":" + format("{zeppelin_group}"),
              os.path.join(params.zeppelin_dir, "notebook")), sudo=True)
 
+    if params.security_enabled:
+      zeppelin_kinit_cmd = format("{kinit_path_local} -kt {zeppelin_kerberos_keytab} {zeppelin_kerberos_principal}; ")
+      Execute(zeppelin_kinit_cmd, user=params.zeppelin_user)
+
     if 'zeppelin.notebook.storage' in params.config['configurations']['zeppelin-config'] \
         and params.config['configurations']['zeppelin-config']['zeppelin.notebook.storage'] == 'org.apache.zeppelin.notebook.repo.FileSystemNotebookRepo':
       self.check_and_copy_notebook_in_hdfs(params)
 
-    if params.security_enabled:
-        zeppelin_kinit_cmd = format("{kinit_path_local} -kt {zeppelin_kerberos_keytab} {zeppelin_kerberos_principal}; ")
-        Execute(zeppelin_kinit_cmd, user=params.zeppelin_user)
-
     zeppelin_spark_dependencies = self.get_zeppelin_spark_dependencies()
     if zeppelin_spark_dependencies and os.path.exists(zeppelin_spark_dependencies[0]):
       self.create_zeppelin_dir(params)
@@ -292,14 +291,17 @@ class Master(Script):
     if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, format_stack_version(params.version)):
       stack_select.select_packages(params.version)
 
-  def getZeppelinConfFS(self, params):
-    hdfs_interpreter_config = params.config['configurations']['zeppelin-config']['zeppelin.config.fs.dir'] + "/interpreter.json"
+  def get_zeppelin_conf_FS_directory(self, params):
+    hdfs_interpreter_config = params.config['configurations']['zeppelin-config']['zeppelin.config.fs.dir']
 
     if not hdfs_interpreter_config.startswith("/"):
       hdfs_interpreter_config = "/user/" + format("{zeppelin_user}") + "/" + hdfs_interpreter_config
 
     return hdfs_interpreter_config
 
+  def get_zeppelin_conf_FS(self, params):
+    return self.get_zeppelin_conf_FS_directory(params) + "/interpreter.json"
+
   def is_path_exists_in_HDFS(self, path, as_user):
     kinit_path_local = get_kinit_path(default('/configurations/kerberos-env/executable_search_paths', None))
     kinit_if_needed = format("{kinit_path_local} -kt {zeppelin_kerberos_keytab} {zeppelin_kerberos_principal};")
@@ -325,17 +327,15 @@ class Master(Script):
       and params.config['configurations']['zeppelin-config']['zeppelin.notebook.storage'] == 'org.apache.zeppelin.notebook.repo.FileSystemNotebookRepo':
 
       if 'zeppelin.config.fs.dir' in params.config['configurations']['zeppelin-config']:
-        zeppelin_conf_fs = self.getZeppelinConfFS(params)
+        zeppelin_conf_fs = self.get_zeppelin_conf_FS(params)
 
         if self.is_path_exists_in_HDFS(zeppelin_conf_fs, params.zeppelin_user):
           # copy from hdfs to /etc/zeppelin/conf/interpreter.json
-          params.HdfsResource(interpreter_config,
-                              type="file",
-                              action="download_on_execute",
-                              source=zeppelin_conf_fs,
-                              user=params.zeppelin_user,
-                              group=params.zeppelin_group,
-                              owner=params.zeppelin_user)
+          kinit_path_local = get_kinit_path(default('/configurations/kerberos-env/executable_search_paths',None))
+          kinit_if_needed = format("{kinit_path_local} -kt {zeppelin_kerberos_keytab} {zeppelin_kerberos_principal};")
+          shell.call(format("rm {interpreter_config};"
+                            "{kinit_if_needed} hdfs --config {hadoop_conf_dir} dfs -get {zeppelin_conf_fs} {interpreter_config}"),
+                     user=params.zeppelin_user)
         else:
           Logger.info(format("{zeppelin_conf_fs} does not exist. Skipping upload of DFS."))
 
@@ -357,13 +357,23 @@ class Master(Script):
       and params.config['configurations']['zeppelin-config']['zeppelin.notebook.storage'] == 'org.apache.zeppelin.notebook.repo.FileSystemNotebookRepo':
 
       if 'zeppelin.config.fs.dir' in params.config['configurations']['zeppelin-config']:
-        params.HdfsResource(self.getZeppelinConfFS(params),
+        if not self.is_path_exists_in_HDFS(self.get_zeppelin_conf_FS_directory(params), params.zeppelin_user):
+          # hdfs dfs -mkdir {zeppelin's conf directory}
+          params.HdfsResource(self.get_zeppelin_conf_FS_directory(params),
+                              type="directory",
+                              action="create_on_execute",
+                              owner=params.zeppelin_user,
+                              recursive_chown=True,
+                              recursive_chmod=True
+                          )
+
+        params.HdfsResource(self.get_zeppelin_conf_FS(params),
                             type="file",
                             action="create_on_execute",
                             source=interpreter_config,
-                            user=params.zeppelin_user,
-                            group=params.zeppelin_group,
                             owner=params.zeppelin_user,
+                            recursive_chown=True,
+                            recursive_chmod=True,
                             replace_existing_files=True)
 
   def update_kerberos_properties(self):

http://git-wip-us.apache.org/repos/asf/ambari/blob/33d67f3e/ambari-server/src/test/python/stacks/2.6/ZEPPELIN/test_zeppelin_070.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.6/ZEPPELIN/test_zeppelin_070.py b/ambari-server/src/test/python/stacks/2.6/ZEPPELIN/test_zeppelin_070.py
index 3064880..3adb94c 100644
--- a/ambari-server/src/test/python/stacks/2.6/ZEPPELIN/test_zeppelin_070.py
+++ b/ambari-server/src/test/python/stacks/2.6/ZEPPELIN/test_zeppelin_070.py
@@ -221,6 +221,42 @@ class TestZeppelin070(RMFTestCase):
                                           '/usr/hdp/current/zeppelin-server/notebook'),
                               sudo=True,
                               )
+    self.assertResourceCalled('HdfsResource', '/user/zeppelin/notebook',
+                              hadoop_bin_dir='/usr/hdp/2.5.0.0-1235/hadoop/bin',
+                              default_fs=u'hdfs://c6401.ambari.apache.org:8020',
+                              hdfs_resource_ignore_file='/var/lib/ambari-agent/data/.hdfs_resource_ignore',
+                              hdfs_site={u'a': u'b'},
+                              keytab=UnknownConfigurationMock(),
+                              kinit_path_local='/usr/bin/kinit',
+                              user='hdfs',
+                              owner='zeppelin',
+                              principal_name=UnknownConfigurationMock(),
+                              recursive_chown=True,
+                              security_enabled=False,
+                              hadoop_conf_dir='/usr/hdp/2.5.0.0-1235/hadoop/conf',
+                              type='directory',
+                              action=['create_on_execute'],
+                              recursive_chmod=True
+                              )
+    self.assertResourceCalled('HdfsResource', '/user/zeppelin/notebook',
+                              hadoop_bin_dir='/usr/hdp/2.5.0.0-1235/hadoop/bin',
+                              default_fs=u'hdfs://c6401.ambari.apache.org:8020',
+                              hdfs_resource_ignore_file='/var/lib/ambari-agent/data/.hdfs_resource_ignore',
+                              hdfs_site={u'a': u'b'},
+                              keytab=UnknownConfigurationMock(),
+                              kinit_path_local='/usr/bin/kinit',
+                              user='hdfs',
+                              owner='zeppelin',
+                              principal_name=UnknownConfigurationMock(),
+                              recursive_chown=True,
+                              security_enabled=False,
+                              source='/usr/hdp/current/zeppelin-server/notebook',
+                              hadoop_conf_dir='/usr/hdp/2.5.0.0-1235/hadoop/conf',
+                              type='directory',
+                              action=['create_on_execute'],
+                              recursive_chmod=True
+                              )
+
     self.assertResourceCalled('HdfsResource', '/user/zeppelin',
                               hadoop_bin_dir='/usr/hdp/2.5.0.0-1235/hadoop/bin',
                               default_fs=u'hdfs://c6401.ambari.apache.org:8020',
@@ -312,6 +348,25 @@ class TestZeppelin070(RMFTestCase):
                           )
 
     self.assertResourceCalled('HdfsResource',
+                              '/user/zeppelin/hdfs:///user/zeppelin/conf',
+                              security_enabled=False,
+                              hadoop_bin_dir='/usr/hdp/2.5.0.0-1235/hadoop/bin',
+                              keytab=UnknownConfigurationMock(),
+                              default_fs='hdfs://c6401.ambari.apache.org:8020',
+                              hdfs_resource_ignore_file='/var/lib/ambari-agent/data/.hdfs_resource_ignore',
+                              hdfs_site={u'a': u'b'},
+                              kinit_path_local='/usr/bin/kinit',
+                              principal_name=UnknownConfigurationMock(),
+                              recursive_chown=True,
+                              recursive_chmod=True,
+                              owner='zeppelin',
+                              user='hdfs',
+                              hadoop_conf_dir='/usr/hdp/2.5.0.0-1235/hadoop/conf',
+                              type='directory',
+                              action=['create_on_execute'],
+                              )
+
+    self.assertResourceCalled('HdfsResource',
                               '/user/zeppelin/hdfs:///user/zeppelin/conf/interpreter.json',
                               security_enabled=False,
                               hadoop_bin_dir='/usr/hdp/2.5.0.0-1235/hadoop/bin',
@@ -322,9 +377,10 @@ class TestZeppelin070(RMFTestCase):
                               hdfs_site={u'a': u'b'},
                               kinit_path_local='/usr/bin/kinit',
                               principal_name=UnknownConfigurationMock(),
-                              user='zeppelin',
+                              recursive_chown=True,
+                              recursive_chmod=True,
+                              user='hdfs',
                               owner='zeppelin',
-                              group='zeppelin',
                               replace_existing_files=True,
                               hadoop_conf_dir='/usr/hdp/2.5.0.0-1235/hadoop/conf',
                               type='file',
@@ -337,24 +393,45 @@ class TestZeppelin070(RMFTestCase):
                               group='zeppelin',
                               )
 
-    self.assertResourceCalled('HdfsResource', '/user/zeppelin/hdfs:///user/zeppelin/conf/interpreter.json',
-        security_enabled = False,
-        hadoop_bin_dir = '/usr/hdp/2.5.0.0-1235/hadoop/bin',
-        keytab = UnknownConfigurationMock(),
-        source = '/etc/zeppelin/conf/interpreter.json',
-        default_fs = 'hdfs://c6401.ambari.apache.org:8020',
-        replace_existing_files = True,
-        hdfs_resource_ignore_file = '/var/lib/ambari-agent/data/.hdfs_resource_ignore',
-        hdfs_site = {u'a': u'b'},
-        kinit_path_local = '/usr/bin/kinit',
-        principal_name = UnknownConfigurationMock(),
-        user = 'zeppelin',
-        owner = 'zeppelin',
-        group = 'zeppelin',
-        hadoop_conf_dir = '/usr/hdp/2.5.0.0-1235/hadoop/conf',
-        type = 'file',
-        action = ['create_on_execute'],
-    )
+    self.assertResourceCalled('HdfsResource',
+                              '/user/zeppelin/hdfs:///user/zeppelin/conf',
+                              security_enabled=False,
+                              hadoop_bin_dir='/usr/hdp/2.5.0.0-1235/hadoop/bin',
+                              keytab=UnknownConfigurationMock(),
+                              default_fs='hdfs://c6401.ambari.apache.org:8020',
+                              recursive_chown=True,
+                              recursive_chmod=True,
+                              hdfs_resource_ignore_file='/var/lib/ambari-agent/data/.hdfs_resource_ignore',
+                              hdfs_site={u'a': u'b'},
+                              kinit_path_local='/usr/bin/kinit',
+                              principal_name=UnknownConfigurationMock(),
+                              user='hdfs',
+                              owner='zeppelin',
+                              hadoop_conf_dir='/usr/hdp/2.5.0.0-1235/hadoop/conf',
+                              type='directory',
+                              action=['create_on_execute'],
+                              )
+
+    self.assertResourceCalled('HdfsResource',
+                              '/user/zeppelin/hdfs:///user/zeppelin/conf/interpreter.json',
+                              security_enabled=False,
+                              hadoop_bin_dir='/usr/hdp/2.5.0.0-1235/hadoop/bin',
+                              keytab=UnknownConfigurationMock(),
+                              source='/etc/zeppelin/conf/interpreter.json',
+                              default_fs='hdfs://c6401.ambari.apache.org:8020',
+                              replace_existing_files=True,
+                              hdfs_resource_ignore_file='/var/lib/ambari-agent/data/.hdfs_resource_ignore',
+                              hdfs_site={u'a': u'b'},
+                              kinit_path_local='/usr/bin/kinit',
+                              principal_name=UnknownConfigurationMock(),
+                              recursive_chmod=True,
+                              recursive_chown=True,
+                              user='hdfs',
+                              owner='zeppelin',
+                              hadoop_conf_dir='/usr/hdp/2.5.0.0-1235/hadoop/conf',
+                              type='file',
+                              action=['create_on_execute'],
+                              )
 
     self.assertResourceCalled('File', '/etc/zeppelin/conf/interpreter.json',
                               content=interpreter_json_generated.template_after_kerberos,
@@ -362,6 +439,24 @@ class TestZeppelin070(RMFTestCase):
                               group='zeppelin',
                               )
 
+    self.assertResourceCalled('HdfsResource', '/user/zeppelin/hdfs:///user/zeppelin/conf',
+                              security_enabled = False,
+                              hadoop_bin_dir = '/usr/hdp/2.5.0.0-1235/hadoop/bin',
+                              keytab = UnknownConfigurationMock(),
+                              default_fs = 'hdfs://c6401.ambari.apache.org:8020',
+                              hdfs_resource_ignore_file = '/var/lib/ambari-agent/data/.hdfs_resource_ignore',
+                              hdfs_site = {u'a': u'b'},
+                              kinit_path_local = '/usr/bin/kinit',
+                              principal_name = UnknownConfigurationMock(),
+                              recursive_chown=True,
+                              recursive_chmod=True,
+                              user = 'hdfs',
+                              owner = 'zeppelin',
+                              hadoop_conf_dir = '/usr/hdp/2.5.0.0-1235/hadoop/conf',
+                              type = 'directory',
+                              action = ['create_on_execute'],
+                              )
+
     self.assertResourceCalled('HdfsResource', '/user/zeppelin/hdfs:///user/zeppelin/conf/interpreter.json',
         security_enabled = False,
         hadoop_bin_dir = '/usr/hdp/2.5.0.0-1235/hadoop/bin',
@@ -373,9 +468,10 @@ class TestZeppelin070(RMFTestCase):
         kinit_path_local = '/usr/bin/kinit',
         principal_name = UnknownConfigurationMock(),
         replace_existing_files = True,
-        user = 'zeppelin',
+        recursive_chown=True,
+        recursive_chmod=True,
+        user = 'hdfs',
         owner = 'zeppelin',
-        group = 'zeppelin',
         hadoop_conf_dir = '/usr/hdp/2.5.0.0-1235/hadoop/conf',
         type = 'file',
         action = ['create_on_execute'],


[23/50] ambari git commit: AMBARI-22229.Handle upload of interpreter.json to remote storage in Ambari(Prabhjyot Singh via Venkata Sairam)

Posted by am...@apache.org.
AMBARI-22229.Handle upload of interpreter.json to remote storage in Ambari(Prabhjyot Singh via Venkata Sairam)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/a8ba5e61
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/a8ba5e61
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/a8ba5e61

Branch: refs/heads/branch-feature-AMBARI-22008
Commit: a8ba5e61c50ac92b787d3b2de4cec8d29da92d74
Parents: 0f76c7f
Author: Venkata Sairam <ve...@gmail.com>
Authored: Fri Oct 13 15:22:33 2017 +0530
Committer: Venkata Sairam <ve...@gmail.com>
Committed: Fri Oct 13 15:22:33 2017 +0530

----------------------------------------------------------------------
 .../common-services/ZEPPELIN/0.7.0/package/scripts/master.py | 3 ++-
 .../src/test/python/stacks/2.6/ZEPPELIN/test_zeppelin_070.py | 8 ++++----
 2 files changed, 6 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/a8ba5e61/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/master.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/master.py b/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/master.py
index a8b1b32..6a84d79 100644
--- a/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/master.py
+++ b/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/master.py
@@ -305,7 +305,8 @@ class Master(Script):
   def get_zeppelin_conf_FS_directory(self, params):
     hdfs_interpreter_config = params.config['configurations']['zeppelin-config']['zeppelin.config.fs.dir']
 
-    if not hdfs_interpreter_config.startswith("/"):
+    # if it doesn't start from "/" or doesn't contains "://" as in hdfs://, file://, etc then make it a absolute path
+    if not (hdfs_interpreter_config.startswith("/") or '://' in hdfs_interpreter_config):
       hdfs_interpreter_config = "/user/" + format("{zeppelin_user}") + "/" + hdfs_interpreter_config
 
     return hdfs_interpreter_config

http://git-wip-us.apache.org/repos/asf/ambari/blob/a8ba5e61/ambari-server/src/test/python/stacks/2.6/ZEPPELIN/test_zeppelin_070.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.6/ZEPPELIN/test_zeppelin_070.py b/ambari-server/src/test/python/stacks/2.6/ZEPPELIN/test_zeppelin_070.py
index e5d0240..400350c 100644
--- a/ambari-server/src/test/python/stacks/2.6/ZEPPELIN/test_zeppelin_070.py
+++ b/ambari-server/src/test/python/stacks/2.6/ZEPPELIN/test_zeppelin_070.py
@@ -342,7 +342,7 @@ class TestZeppelin070(RMFTestCase):
                               )
 
     self.assertResourceCalled('HdfsResource',
-                              '/user/zeppelin/hdfs:///user/zeppelin/conf',
+                              'hdfs:///user/zeppelin/conf',
                               security_enabled=False,
                               hadoop_bin_dir='/usr/hdp/2.5.0.0-1235/hadoop/bin',
                               keytab=UnknownConfigurationMock(),
@@ -368,7 +368,7 @@ class TestZeppelin070(RMFTestCase):
 
 
     self.assertResourceCalled('HdfsResource',
-                              '/user/zeppelin/hdfs:///user/zeppelin/conf/interpreter.json',
+                              'hdfs:///user/zeppelin/conf/interpreter.json',
                               security_enabled=False,
                               hadoop_bin_dir='/usr/hdp/2.5.0.0-1235/hadoop/bin',
                               keytab=UnknownConfigurationMock(),
@@ -395,7 +395,7 @@ class TestZeppelin070(RMFTestCase):
                               )
 
     self.assertResourceCalled('HdfsResource',
-                              '/user/zeppelin/hdfs:///user/zeppelin/conf/interpreter.json',
+                              'hdfs:///user/zeppelin/conf/interpreter.json',
                               security_enabled=False,
                               hadoop_bin_dir='/usr/hdp/2.5.0.0-1235/hadoop/bin',
                               keytab=UnknownConfigurationMock(),
@@ -421,7 +421,7 @@ class TestZeppelin070(RMFTestCase):
                               group='zeppelin',
                               )
 
-    self.assertResourceCalled('HdfsResource', '/user/zeppelin/hdfs:///user/zeppelin/conf/interpreter.json',
+    self.assertResourceCalled('HdfsResource', 'hdfs:///user/zeppelin/conf/interpreter.json',
         security_enabled = False,
         hadoop_bin_dir = '/usr/hdp/2.5.0.0-1235/hadoop/bin',
         keytab = UnknownConfigurationMock(),


[15/50] ambari git commit: AMBARI-22131 Move resources/stacks/HDP/3.0/widgets.json to resources/widgets.json (additional patch) (dsen)

Posted by am...@apache.org.
AMBARI-22131 Move resources/stacks/HDP/3.0/widgets.json to resources/widgets.json (additional patch) (dsen)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/a8caac37
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/a8caac37
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/a8caac37

Branch: refs/heads/branch-feature-AMBARI-22008
Commit: a8caac375a66911ffb13f38093731158238177ec
Parents: c3f6ba7
Author: Dmytro Sen <ds...@apache.org>
Authored: Thu Oct 12 13:54:07 2017 +0300
Committer: Dmytro Sen <ds...@apache.org>
Committed: Thu Oct 12 13:54:07 2017 +0300

----------------------------------------------------------------------
 ambari-server/src/main/assemblies/server.xml | 5 +++++
 1 file changed, 5 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/a8caac37/ambari-server/src/main/assemblies/server.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/assemblies/server.xml b/ambari-server/src/main/assemblies/server.xml
index 37283fa..cbf11c5 100644
--- a/ambari-server/src/main/assemblies/server.xml
+++ b/ambari-server/src/main/assemblies/server.xml
@@ -397,6 +397,11 @@
       <outputDirectory>/var/lib/ambari-server/resources</outputDirectory>
     </file>
     <file>
+      <fileMode>755</fileMode>
+      <source>src/main/resources/widgets.json</source>
+      <outputDirectory>/var/lib/ambari-server/resources</outputDirectory>
+    </file>
+    <file>
       <fileMode>644</fileMode>
       <source>src/main/resources/slider_resources/README.txt</source>
       <outputDirectory>/var/lib/ambari-server/resources/apps</outputDirectory>


[40/50] ambari git commit: AMBARI-22232 - Need to add a new property to support proxy users property for Atlas service (Vishal Suvagia via jonathanhurley)

Posted by am...@apache.org.
AMBARI-22232  - Need to add a new property to support proxy users property for Atlas service (Vishal Suvagia via jonathanhurley)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/523f505d
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/523f505d
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/523f505d

Branch: refs/heads/branch-feature-AMBARI-22008
Commit: 523f505dca99d1a8b9dd07ffabc1bad110910566
Parents: 5f86f15
Author: Jonathan Hurley <jh...@hortonworks.com>
Authored: Mon Oct 16 12:56:57 2017 -0400
Committer: Jonathan Hurley <jh...@hortonworks.com>
Committed: Mon Oct 16 12:58:02 2017 -0400

----------------------------------------------------------------------
 .../AtlasProxyUserConfigCalculation.java        | 11 ++++------
 .../AtlasProxyUserConfigCalculationTest.java    | 22 +++++++++++---------
 2 files changed, 16 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/523f505d/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/AtlasProxyUserConfigCalculation.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/AtlasProxyUserConfigCalculation.java b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/AtlasProxyUserConfigCalculation.java
index 40d64b5..1a99299 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/AtlasProxyUserConfigCalculation.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/AtlasProxyUserConfigCalculation.java
@@ -17,19 +17,16 @@
  */
 package org.apache.ambari.server.serveraction.upgrades;
 
+import java.text.MessageFormat;
+import java.util.Map;
+import java.util.concurrent.ConcurrentMap;
+
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.actionmanager.HostRoleStatus;
 import org.apache.ambari.server.agent.CommandReport;
-import org.apache.ambari.server.serveraction.AbstractServerAction;
 import org.apache.ambari.server.state.Cluster;
-import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.Config;
 
-import javax.inject.Inject;
-import java.text.MessageFormat;
-import java.util.Map;
-import java.util.concurrent.ConcurrentMap;
-
 public class AtlasProxyUserConfigCalculation extends AbstractUpgradeServerAction {
 
   private static final String ATLAS_APPLICATION_PROPERTIES_CONFIG_TYPE = "application-properties";

http://git-wip-us.apache.org/repos/asf/ambari/blob/523f505d/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/AtlasProxyUserConfigCalculationTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/AtlasProxyUserConfigCalculationTest.java b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/AtlasProxyUserConfigCalculationTest.java
index 33ec7f3..7cb6255 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/AtlasProxyUserConfigCalculationTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/AtlasProxyUserConfigCalculationTest.java
@@ -17,7 +17,16 @@
  */
 package org.apache.ambari.server.serveraction.upgrades;
 
-import com.google.inject.Injector;
+import static org.easymock.EasyMock.anyObject;
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.expectLastCall;
+import static org.easymock.EasyMock.replay;
+
+import java.lang.reflect.Field;
+import java.util.HashMap;
+import java.util.Map;
+
 import org.apache.ambari.server.actionmanager.ExecutionCommandWrapper;
 import org.apache.ambari.server.actionmanager.HostRoleCommand;
 import org.apache.ambari.server.agent.CommandReport;
@@ -25,20 +34,13 @@ import org.apache.ambari.server.agent.ExecutionCommand;
 import org.apache.ambari.server.state.Cluster;
 import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.Config;
-import org.easymock.EasyMock;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 
-import java.lang.reflect.Field;
-import java.util.HashMap;
-import java.util.Map;
 
-import static org.easymock.EasyMock.*;
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.expectLastCall;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+
+import com.google.inject.Injector;
 
 public class AtlasProxyUserConfigCalculationTest {
 


[31/50] ambari git commit: AMBARI-22203. ZKFC start failed due to hadoop-hdfs-zkfc is not supported (partial revert) (ncole)

Posted by am...@apache.org.
AMBARI-22203. ZKFC start failed due to hadoop-hdfs-zkfc is not supported (partial revert) (ncole)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/8c017c1f
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/8c017c1f
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/8c017c1f

Branch: refs/heads/branch-feature-AMBARI-22008
Commit: 8c017c1fdebdbd0261749df0434dc86744dcf986
Parents: 3290677
Author: Nate Cole <nc...@hortonworks.com>
Authored: Sat Oct 14 14:53:14 2017 -0400
Committer: Nate Cole <nc...@hortonworks.com>
Committed: Sat Oct 14 14:53:14 2017 -0400

----------------------------------------------------------------------
 .../main/resources/stacks/HDP/2.0.6/properties/stack_packages.json | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/8c017c1f/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_packages.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_packages.json b/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_packages.json
index c217ea8..b8655d7 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_packages.json
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_packages.json
@@ -368,7 +368,7 @@
             "hadoop-hdfs-zkfc"
           ],
           "STANDARD": [
-            "hadoop-client"
+            "hadoop-hdfs-zkfc"
           ]
         }
       },


[48/50] ambari git commit: AMBARI-22121. Create mpack for Isilon OneFS (amagyar)

Posted by am...@apache.org.
AMBARI-22121. Create mpack for Isilon OneFS (amagyar)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/7eb5cd4b
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/7eb5cd4b
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/7eb5cd4b

Branch: refs/heads/branch-feature-AMBARI-22008
Commit: 7eb5cd4b0ca460c73c09b7aaed0afd35241e0201
Parents: ce29f8c
Author: Attila Magyar <am...@hortonworks.com>
Authored: Fri Oct 6 09:13:09 2017 +0200
Committer: Attila Magyar <am...@hortonworks.com>
Committed: Tue Oct 17 16:52:56 2017 +0200

----------------------------------------------------------------------
 .../isilon-onefs-mpack/.gitignore               |   1 +
 .../management-packs/isilon-onefs-mpack/pom.xml | 110 ++++++
 .../src/main/assemblies/isilon-onefs-mpack.xml  |  40 ++
 .../addon-services/ONEFS/1.0.0/alerts.json      |  46 +++
 .../ONEFS/1.0.0/configuration/core-site.xml     | 102 +++++
 .../ONEFS/1.0.0/configuration/hadoop-env.xml    | 386 +++++++++++++++++++
 .../ONEFS/1.0.0/configuration/hdfs-site.xml     |  61 +++
 .../addon-services/ONEFS/1.0.0/metainfo.xml     |  90 +++++
 .../addon-services/ONEFS/1.0.0/metrics.json     |  59 +++
 .../ONEFS/1.0.0/package/scripts/__init__.py     |  20 +
 .../ONEFS/1.0.0/package/scripts/onefs_client.py |  56 +++
 .../ONEFS/1.0.0/package/scripts/params.py       |  29 ++
 .../ONEFS/1.0.0/package/scripts/params_linux.py |  74 ++++
 .../1.0.0/package/scripts/params_windows.py     |  83 ++++
 .../1.0.0/package/scripts/service_check.py      | 137 +++++++
 .../1.0.0/package/scripts/status_params.py      |  58 +++
 .../addon-services/ONEFS/1.0.0/widgets.json     |  38 ++
 .../src/main/resources/mpack.json               |  28 ++
 18 files changed, 1418 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/7eb5cd4b/contrib/management-packs/isilon-onefs-mpack/.gitignore
----------------------------------------------------------------------
diff --git a/contrib/management-packs/isilon-onefs-mpack/.gitignore b/contrib/management-packs/isilon-onefs-mpack/.gitignore
new file mode 100644
index 0000000..1377554
--- /dev/null
+++ b/contrib/management-packs/isilon-onefs-mpack/.gitignore
@@ -0,0 +1 @@
+*.swp

http://git-wip-us.apache.org/repos/asf/ambari/blob/7eb5cd4b/contrib/management-packs/isilon-onefs-mpack/pom.xml
----------------------------------------------------------------------
diff --git a/contrib/management-packs/isilon-onefs-mpack/pom.xml b/contrib/management-packs/isilon-onefs-mpack/pom.xml
new file mode 100644
index 0000000..5d8f215
--- /dev/null
+++ b/contrib/management-packs/isilon-onefs-mpack/pom.xml
@@ -0,0 +1,110 @@
+<!--
+   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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.ambari</groupId>
+  <artifactId>isilon-onefs-mpack</artifactId>
+  <packaging>pom</packaging>
+  <version>0.1.0.0-SNAPSHOT</version>
+  <name>Isilon OneFS Ambari Management Pack</name>
+  <url>http://ambari.apache.org/</url>
+  <properties>
+    <minAmbariVersion>3.0.0.0</minAmbariVersion>
+    <maxAmbariVersion></maxAmbariVersion>
+    <nifiversion>1.0.0</nifiversion>
+  </properties>
+  <parent>
+    <groupId>org.apache.ambari.contrib.mpacks</groupId>
+    <artifactId>ambari-contrib-mpacks</artifactId>
+    <version>2.0.0.0-SNAPSHOT</version>
+  </parent>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>build-helper-maven-plugin</artifactId>
+        <version>1.8</version>
+        <executions>
+          <execution>
+            <id>parse-version</id>
+            <phase>validate</phase>
+            <goals>
+              <goal>parse-version</goal>
+            </goals>
+          </execution>
+          <execution>
+            <id>regex-property</id>
+            <goals>
+              <goal>regex-property</goal>
+            </goals>
+            <configuration>
+              <name>mpackVersion</name>
+              <value>${project.version}</value>
+              <regex>^([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)(\.|-).*</regex>
+              <replacement>$1.$2.$3.$4</replacement>
+              <failIfNoMatch>false</failIfNoMatch>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <artifactId>maven-resources-plugin</artifactId>
+        <version>2.6</version>
+        <executions>
+          <execution>
+            <id>copy-resources</id>
+            <phase>compile</phase>
+            <goals>
+              <goal>copy-resources</goal>
+            </goals>
+            <configuration>
+              <outputDirectory>${basedir}/target/</outputDirectory>
+              <resources>
+                <resource>
+                  <directory>${basedir}/src/main/resources</directory>
+                  <includes>
+                    <include>mpack.json</include>
+                  </includes>
+                  <filtering>true</filtering>
+                </resource>
+              </resources>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <artifactId>maven-assembly-plugin</artifactId>
+        <configuration>
+          <tarLongFileMode>gnu</tarLongFileMode>
+          <descriptors>
+            <descriptor>src/main/assemblies/isilon-onefs-mpack.xml</descriptor>
+          </descriptors>
+        </configuration>
+        <executions>
+          <execution>
+            <id>build-tarball</id>
+            <phase>package</phase>
+            <goals>
+              <goal>single</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>

http://git-wip-us.apache.org/repos/asf/ambari/blob/7eb5cd4b/contrib/management-packs/isilon-onefs-mpack/src/main/assemblies/isilon-onefs-mpack.xml
----------------------------------------------------------------------
diff --git a/contrib/management-packs/isilon-onefs-mpack/src/main/assemblies/isilon-onefs-mpack.xml b/contrib/management-packs/isilon-onefs-mpack/src/main/assemblies/isilon-onefs-mpack.xml
new file mode 100644
index 0000000..232cf50
--- /dev/null
+++ b/contrib/management-packs/isilon-onefs-mpack/src/main/assemblies/isilon-onefs-mpack.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0"?>
+<!--
+  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.
+-->
+<assembly>
+  <id></id>
+  <formats>
+    <format>dir</format>
+    <format>tar.gz</format>
+  </formats>
+  <includeBaseDirectory>true</includeBaseDirectory>
+  <fileSets>
+     <fileSet>
+      <directory>src/main/resources/addon-services</directory>
+      <outputDirectory>addon-services</outputDirectory>
+    </fileSet>
+  </fileSets>
+  <files>
+    <file>
+      <source>target/mpack.json</source>
+    </file>
+  </files>    
+  <dependencySets>
+  </dependencySets>
+</assembly>
+

http://git-wip-us.apache.org/repos/asf/ambari/blob/7eb5cd4b/contrib/management-packs/isilon-onefs-mpack/src/main/resources/addon-services/ONEFS/1.0.0/alerts.json
----------------------------------------------------------------------
diff --git a/contrib/management-packs/isilon-onefs-mpack/src/main/resources/addon-services/ONEFS/1.0.0/alerts.json b/contrib/management-packs/isilon-onefs-mpack/src/main/resources/addon-services/ONEFS/1.0.0/alerts.json
new file mode 100644
index 0000000..5718721
--- /dev/null
+++ b/contrib/management-packs/isilon-onefs-mpack/src/main/resources/addon-services/ONEFS/1.0.0/alerts.json
@@ -0,0 +1,46 @@
+{
+  "ONEFS":{
+    "service": [
+      {
+        "name": "onefs_namenode_cpu",
+        "label": "OneFS NameNode Host CPU Utilization",
+        "description": "This host-level alert is triggered if CPU utilization of the NameNode exceeds certain warning and critical thresholds. It checks the NameNode JMX Servlet for the SystemCPULoad property. The threshold values are in percent.",
+        "interval": 1,
+        "scope": "HOST",
+        "enabled": true,
+        "source": {
+          "type": "SERVER",
+          "class": "org.apache.ambari.server.alerts.JmxServerSideAlert",
+          "uri": {
+            "http": "${hdfs-site/dfs.namenode.http-address}",
+            "https": "${hdfs-site/dfs.namenode.https-address}",
+            "https_property": "${hdfs-site/dfs.http.policy}",
+            "https_property_value": "HTTPS_ONLY",
+            "connection_timeout": 5.0
+          },
+          "reporting": {
+            "ok": {
+              "text": "{1} CPU, load {0,number,percent}"
+            },
+            "warning": {
+              "text": "{1} CPU, load {0,number,percent}",
+              "value": 5
+            },
+            "critical": {
+              "text": "{1} CPU, load {0,number,percent}",
+              "value": 20
+            },
+            "units" : "%",
+            "type": "PERCENT"
+           },
+           "jmx": {
+             "property_list": [
+              "java.lang:type=OperatingSystem/SystemCpuLoad",
+              "java.lang:type=OperatingSystem/AvailableProcessors"
+             ]
+           }
+          }
+      }
+    ]
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/7eb5cd4b/contrib/management-packs/isilon-onefs-mpack/src/main/resources/addon-services/ONEFS/1.0.0/configuration/core-site.xml
----------------------------------------------------------------------
diff --git a/contrib/management-packs/isilon-onefs-mpack/src/main/resources/addon-services/ONEFS/1.0.0/configuration/core-site.xml b/contrib/management-packs/isilon-onefs-mpack/src/main/resources/addon-services/ONEFS/1.0.0/configuration/core-site.xml
new file mode 100644
index 0000000..7d3acd7
--- /dev/null
+++ b/contrib/management-packs/isilon-onefs-mpack/src/main/resources/addon-services/ONEFS/1.0.0/configuration/core-site.xml
@@ -0,0 +1,102 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
+<!--
+    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.
+ -->
+<!-- Put site-specific property overrides in this file. -->
+<configuration xmlns:xi="http://www.w3.org/2001/XInclude" supports_final="true">
+  <!-- file system properties -->
+  <property>
+    <name>fs.defaultFS</name>
+    <!-- cluster variant -->
+    <value>hdfs://localhost:8020</value>
+    <description>The name of the default file system.  Either the
+  literal string "local" or a host:port for HDFS.</description>
+    <final>true</final>
+    <on-ambari-upgrade add="false"/>
+  </property>
+  <property>
+    <name>hadoop.security.authentication</name>
+    <value>simple</value>
+    <description>
+   Set the authentication for the cluster. Valid values are: simple or
+   kerberos.
+   </description>
+    <on-ambari-upgrade add="true"/>
+  </property>
+  <property>
+    <name>hadoop.security.authorization</name>
+    <value>false</value>
+    <description>
+     Enable authorization for different protocols.
+  </description>
+    <on-ambari-upgrade add="true"/>
+  </property>
+  <property>
+    <name>hadoop.security.auth_to_local</name>
+    <value>DEFAULT</value>
+    <description>The mapping from kerberos principal names to local OS mapreduce.job.user.names.
+  So the default rule is just "DEFAULT" which takes all principals in your default domain to their first component.
+  "omalley@APACHE.ORG" and "omalley/admin@APACHE.ORG" to "omalley", if your default domain is APACHE.ORG.
+The translations rules have 3 sections:
+      base     filter    substitution
+The base consists of a number that represents the number of components in the principal name excluding the realm and the pattern for building the name from the sections of the principal name. The base uses $0 to mean the realm, $1 to mean the first component and $2 to mean the second component.
+
+[1:$1@$0] translates "omalley@APACHE.ORG" to "omalley@APACHE.ORG"
+[2:$1] translates "omalley/admin@APACHE.ORG" to "omalley"
+[2:$1%$2] translates "omalley/admin@APACHE.ORG" to "omalley%admin"
+
+The filter is a regex in parens that must the generated string for the rule to apply.
+
+"(.*%admin)" will take any string that ends in "%admin"
+"(.*@ACME.COM)" will take any string that ends in "@ACME.COM"
+
+Finally, the substitution is a sed rule to translate a regex into a fixed string.
+
+"s/@ACME\.COM//" removes the first instance of "@ACME.COM".
+"s/@[A-Z]*\.COM//" removes the first instance of "@" followed by a name followed by ".COM".
+"s/X/Y/g" replaces all of the "X" in the name with "Y"
+
+So, if your default realm was APACHE.ORG, but you also wanted to take all principals from ACME.COM that had a single component "joe@ACME.COM", you'd do:
+
+RULE:[1:$1@$0](.@ACME.ORG)s/@.//
+DEFAULT
+
+To also translate the names with a second component, you'd make the rules:
+
+RULE:[1:$1@$0](.@ACME.ORG)s/@.//
+RULE:[2:$1@$0](.@ACME.ORG)s/@.//
+DEFAULT
+
+If you want to treat all principals from APACHE.ORG with /admin as "admin", your rules would look like:
+
+RULE[2:$1%$2@$0](.%admin@APACHE.ORG)s/./admin/
+DEFAULT
+    </description>
+    <value-attributes>
+      <type>multiLine</type>
+    </value-attributes>
+    <on-ambari-upgrade add="true"/>
+  </property>
+  <property>
+    <name>net.topology.script.file.name</name>
+    <value>/etc/hadoop/conf/topology_script.py</value>
+    <description>
+      Location of topology script used by Hadoop to determine the rack location of nodes.
+    </description>
+    <on-ambari-upgrade add="true"/>
+  </property>
+</configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/7eb5cd4b/contrib/management-packs/isilon-onefs-mpack/src/main/resources/addon-services/ONEFS/1.0.0/configuration/hadoop-env.xml
----------------------------------------------------------------------
diff --git a/contrib/management-packs/isilon-onefs-mpack/src/main/resources/addon-services/ONEFS/1.0.0/configuration/hadoop-env.xml b/contrib/management-packs/isilon-onefs-mpack/src/main/resources/addon-services/ONEFS/1.0.0/configuration/hadoop-env.xml
new file mode 100644
index 0000000..bb671cc
--- /dev/null
+++ b/contrib/management-packs/isilon-onefs-mpack/src/main/resources/addon-services/ONEFS/1.0.0/configuration/hadoop-env.xml
@@ -0,0 +1,386 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
+<!--
+/**
+ * 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.
+ */
+-->
+<configuration supports_adding_forbidden="true">
+  <property>
+    <name>hdfs_log_dir_prefix</name>
+    <value>/var/log/hadoop</value>
+    <description>Hadoop Log Dir Prefix</description>
+    <display-name>Hadoop Log Dir Prefix</display-name>
+    <value-attributes>
+      <type>directory</type>
+      <overridable>false</overridable>
+    </value-attributes>
+    <on-ambari-upgrade add="true"/>
+  </property>
+  <property>
+    <name>hadoop_pid_dir_prefix</name>
+    <value>/var/run/hadoop</value>
+    <display-name>Hadoop PID Dir Prefix</display-name>
+    <description>Hadoop PID Dir Prefix</description>
+    <value-attributes>
+      <type>directory</type>
+      <overridable>false</overridable>
+      <editable-only-at-install>true</editable-only-at-install>
+    </value-attributes>
+    <on-ambari-upgrade add="true"/>
+  </property>
+  <property>
+    <name>hadoop_root_logger</name>
+    <value>INFO,RFA</value>
+    <display-name>Hadoop Root Logger</display-name>
+    <description>Hadoop Root Logger</description>
+    <value-attributes>
+      <overridable>false</overridable>
+    </value-attributes>
+    <on-ambari-upgrade add="true"/>
+  </property>
+  <property>
+    <name>hadoop_heapsize</name>
+    <value>1024</value>
+    <description>Hadoop maximum Java heap size</description>
+    <display-name>Hadoop maximum Java heap size</display-name>
+    <value-attributes>
+      <type>int</type>
+      <unit>MB</unit>
+      <overridable>false</overridable>
+    </value-attributes>
+    <on-ambari-upgrade add="true"/>
+  </property>
+  <property>
+    <name>namenode_heapsize</name>
+    <value>1024</value>
+    <description>NameNode Java heap size</description>
+    <display-name>NameNode Java heap size</display-name>
+    <value-attributes>
+      <type>int</type>
+      <minimum>0</minimum>
+      <maximum>268435456</maximum>
+      <unit>MB</unit>
+      <increment-step>256</increment-step>
+      <overridable>false</overridable>
+    </value-attributes>
+    <depends-on>
+      <property>
+        <type>hdfs-site</type>
+        <name>dfs.datanode.data.dir</name>
+      </property>
+    </depends-on>
+    <on-ambari-upgrade add="true"/>
+  </property>
+  <property>
+    <name>namenode_opt_newsize</name>
+    <value>200</value>
+    <description>Default size of Java new generation for NameNode (Java option -XX:NewSize) Note: The value of NameNode new generation size (default size of Java new generation for NameNode (Java option -XX:NewSize)) should be 1/8 of maximum heap size (-Xmx). Ensure that the value of the namenode_opt_newsize property is 1/8 the value of maximum heap size (-Xmx).</description>
+    <display-name>NameNode new generation size</display-name>
+    <depends-on>
+      <property>
+        <type>hadoop-env</type>
+        <name>namenode_heapsize</name>
+      </property>
+    </depends-on>
+    <value-attributes>
+      <type>int</type>
+      <minimum>0</minimum>
+      <maximum>16384</maximum>
+      <unit>MB</unit>
+      <increment-step>256</increment-step>
+      <overridable>false</overridable>
+    </value-attributes>
+    <on-ambari-upgrade add="true"/>
+  </property>
+  <property>
+    <name>namenode_opt_maxnewsize</name>
+    <value>200</value>
+    <description>NameNode maximum new generation size</description>
+    <display-name>NameNode maximum new generation size</display-name>
+    <depends-on>
+      <property>
+        <type>hadoop-env</type>
+        <name>namenode_heapsize</name>
+      </property>
+    </depends-on>
+    <value-attributes>
+      <type>int</type>
+      <minimum>0</minimum>
+      <maximum>16384</maximum>
+      <unit>MB</unit>
+      <increment-step>256</increment-step>
+      <overridable>false</overridable>
+    </value-attributes>
+    <on-ambari-upgrade add="true"/>
+  </property>
+  <property>
+    <name>namenode_opt_permsize</name>
+    <value>128</value>
+    <description>NameNode permanent generation size</description>
+    <display-name>NameNode permanent generation size</display-name>
+    <value-attributes>
+      <type>int</type>
+      <minimum>0</minimum>
+      <maximum>2096</maximum>
+      <unit>MB</unit>
+      <increment-step>128</increment-step>
+      <overridable>false</overridable>
+    </value-attributes>
+    <on-ambari-upgrade add="true"/>
+  </property>
+  <property>
+    <name>namenode_opt_maxpermsize</name>
+    <value>256</value>
+    <description>NameNode maximum permanent generation size</description>
+    <display-name>NameNode maximum permanent generation size</display-name>
+    <value-attributes>
+      <type>int</type>
+      <minimum>0</minimum>
+      <maximum>2096</maximum>
+      <unit>MB</unit>
+      <increment-step>128</increment-step>
+      <overridable>false</overridable>
+    </value-attributes>
+    <on-ambari-upgrade add="true"/>
+  </property>
+  <property>
+    <name>dtnode_heapsize</name>
+    <value>1024</value>
+    <description>DataNode maximum Java heap size</description>
+    <display-name>DataNode maximum Java heap size</display-name>
+    <value-attributes>
+      <type>int</type>
+      <minimum>0</minimum>
+      <maximum>268435456</maximum>
+      <unit>MB</unit>
+      <increment-step>128</increment-step>
+    </value-attributes>
+    <on-ambari-upgrade add="true"/>
+  </property>
+  <property>
+    <name>proxyuser_group</name>
+    <display-name>Proxy User Group</display-name>
+    <value>users</value>
+    <property-type>GROUP</property-type>
+    <description>Proxy user group.</description>
+    <value-attributes>
+      <type>user</type>
+      <overridable>false</overridable>
+    </value-attributes>
+    <on-ambari-upgrade add="true"/>
+  </property>
+  <property>
+    <name>hdfs_user</name>
+    <display-name>HDFS User</display-name>
+    <value>hdfs</value>
+    <property-type>USER</property-type>
+    <description>User to run HDFS as</description>
+    <value-attributes>
+      <type>user</type>
+      <overridable>false</overridable>
+    </value-attributes>
+    <on-ambari-upgrade add="true"/>
+  </property>
+  <property>
+    <name>hdfs_tmp_dir</name>
+    <value>/tmp</value>
+    <description>HDFS tmp Dir</description>
+    <display-name>HDFS tmp Dir</display-name>
+    <property-type>NOT_MANAGED_HDFS_PATH</property-type>
+    <value-attributes>
+      <read-only>true</read-only>
+      <overridable>false</overridable>
+      <visible>false</visible>
+    </value-attributes>
+    <on-ambari-upgrade add="true"/>
+  </property>
+  <property>
+    <name>hdfs_user_nofile_limit</name>
+    <value>128000</value>
+    <description>Max open files limit setting for HDFS user.</description>
+    <on-ambari-upgrade add="true"/>
+  </property>
+  <property>
+    <name>hdfs_user_nproc_limit</name>
+    <value>65536</value>
+    <description>Max number of processes limit setting for HDFS user.</description>
+    <on-ambari-upgrade add="true"/>
+  </property>
+  <property>
+    <name>namenode_backup_dir</name>
+    <description>Local directory for storing backup copy of NameNode images during upgrade</description>
+    <value>/tmp/upgrades</value>
+    <on-ambari-upgrade add="false"/>
+  </property>
+  <property>
+    <name>hdfs_user_keytab</name>
+    <description>HDFS keytab path</description>
+    <on-ambari-upgrade add="true"/>
+  </property>
+  <property>
+    <name>hdfs_principal_name</name>
+    <description>HDFS principal name</description>
+    <property-type>KERBEROS_PRINCIPAL</property-type>
+    <on-ambari-upgrade add="true"/>
+  </property>
+  <!-- hadoop-env.sh -->
+  <property>
+    <name>content</name>
+    <display-name>hadoop-env template</display-name>
+    <description>This is the jinja template for hadoop-env.sh file</description>
+    <value>
+# Set Hadoop-specific environment variables here.
+
+# The only required environment variable is JAVA_HOME.  All others are
+# optional.  When running a distributed configuration it is best to
+# set JAVA_HOME in this file, so that it is correctly defined on
+# remote nodes.
+
+# The java implementation to use.  Required.
+export JAVA_HOME={{java_home}}
+export HADOOP_HOME_WARN_SUPPRESS=1
+
+# Hadoop home directory
+export HADOOP_HOME=${HADOOP_HOME:-/usr/lib/hadoop}
+
+# Hadoop Configuration Directory
+#TODO: if env var set that can cause problems
+export HADOOP_CONF_DIR=${HADOOP_CONF_DIR:-{{hadoop_conf_dir}}}
+
+
+# Path to jsvc required by secure datanode
+export JSVC_HOME={{jsvc_path}}
+
+
+# The maximum amount of heap to use, in MB. Default is 1000.
+if [[ ("$SERVICE" = "hiveserver2") || ("$SERVICE" = "metastore") || ( "$SERVICE" = "cli") ]]; then
+  if [ "$HADOOP_HEAPSIZE" = "" ]; then
+    export HADOOP_HEAPSIZE="{{hadoop_heapsize}}"
+  fi
+else
+  export HADOOP_HEAPSIZE="{{hadoop_heapsize}}"
+fi
+
+
+export HADOOP_NAMENODE_INIT_HEAPSIZE="-Xms{{namenode_heapsize}}"
+
+# Extra Java runtime options.  Empty by default.
+export HADOOP_OPTS="-Djava.net.preferIPv4Stack=true ${HADOOP_OPTS}"
+
+# Command specific options appended to HADOOP_OPTS when specified
+
+{% if java_version &lt; 8 %}
+export HADOOP_NAMENODE_OPTS="-server -XX:ParallelGCThreads=8 -XX:+UseConcMarkSweepGC -XX:ErrorFile={{hdfs_log_dir_prefix}}/$USER/hs_err_pid%p.log -XX:NewSize={{namenode_opt_newsize}} -XX:MaxNewSize={{namenode_opt_maxnewsize}} -XX:PermSize={{namenode_opt_permsize}} -XX:MaxPermSize={{namenode_opt_maxpermsize}} -Xloggc:{{hdfs_log_dir_prefix}}/$USER/gc.log-`date +'%Y%m%d%H%M'` -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -XX:CMSInitiatingOccupancyFraction=70 -XX:+UseCMSInitiatingOccupancyOnly -Xms{{namenode_heapsize}} -Xmx{{namenode_heapsize}} -Dhadoop.security.logger=INFO,DRFAS -Dhdfs.audit.logger=INFO,DRFAAUDIT -Dorg.mortbay.jetty.Request.maxFormContentSize=-1  ${HADOOP_NAMENODE_OPTS}"
+export HADOOP_SECONDARYNAMENODE_OPTS="-server -XX:ParallelGCThreads=8 -XX:+UseConcMarkSweepGC -XX:ErrorFile={{hdfs_log_dir_prefix}}/$USER/hs_err_pid%p.log -XX:NewSize={{namenode_opt_newsize}} -XX:MaxNewSize={{namenode_opt_maxnewsize}} -XX:PermSize={{namenode_opt_permsize}} -XX:MaxPermSize={{namenode_opt_maxpermsize}} -Xloggc:{{hdfs_log_dir_prefix}}/$USER/gc.log-`date +'%Y%m%d%H%M'` -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -XX:CMSInitiatingOccupancyFraction=70 -XX:+UseCMSInitiatingOccupancyOnly ${HADOOP_NAMENODE_INIT_HEAPSIZE} -Xmx{{namenode_heapsize}} -Dhadoop.security.logger=INFO,DRFAS -Dhdfs.audit.logger=INFO,DRFAAUDIT ${HADOOP_SECONDARYNAMENODE_OPTS}"
+
+# The following applies to multiple commands (fs, dfs, fsck, distcp etc)
+export HADOOP_CLIENT_OPTS="-Xmx${HADOOP_HEAPSIZE}m -XX:MaxPermSize=512m $HADOOP_CLIENT_OPTS"
+{% else %}
+export HADOOP_NAMENODE_OPTS="-server -XX:ParallelGCThreads=8 -XX:+UseConcMarkSweepGC -XX:ErrorFile={{hdfs_log_dir_prefix}}/$USER/hs_err_pid%p.log -XX:NewSize={{namenode_opt_newsize}} -XX:MaxNewSize={{namenode_opt_maxnewsize}} -Xloggc:{{hdfs_log_dir_prefix}}/$USER/gc.log-`date +'%Y%m%d%H%M'` -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -XX:CMSInitiatingOccupancyFraction=70 -XX:+UseCMSInitiatingOccupancyOnly -Xms{{namenode_heapsize}} -Xmx{{namenode_heapsize}} -Dhadoop.security.logger=INFO,DRFAS -Dhdfs.audit.logger=INFO,DRFAAUDIT -Dorg.mortbay.jetty.Request.maxFormContentSize=-1 ${HADOOP_NAMENODE_OPTS}"
+export HADOOP_SECONDARYNAMENODE_OPTS="-server -XX:ParallelGCThreads=8 -XX:+UseConcMarkSweepGC -XX:ErrorFile={{hdfs_log_dir_prefix}}/$USER/hs_err_pid%p.log -XX:NewSize={{namenode_opt_newsize}} -XX:MaxNewSize={{namenode_opt_maxnewsize}} -Xloggc:{{hdfs_log_dir_prefix}}/$USER/gc.log-`date +'%Y%m%d%H%M'` -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -XX:CMSInitiatingOccupancyFraction=70 -XX:+UseCMSInitiatingOccupancyOnly ${HADOOP_NAMENODE_INIT_HEAPSIZE} -Xmx{{namenode_heapsize}} -Dhadoop.security.logger=INFO,DRFAS -Dhdfs.audit.logger=INFO,DRFAAUDIT ${HADOOP_SECONDARYNAMENODE_OPTS}"
+
+# The following applies to multiple commands (fs, dfs, fsck, distcp etc)
+export HADOOP_CLIENT_OPTS="-Xmx${HADOOP_HEAPSIZE}m $HADOOP_CLIENT_OPTS"
+{% endif %}
+HADOOP_JOBTRACKER_OPTS="-server -XX:ParallelGCThreads=8 -XX:+UseConcMarkSweepGC -XX:ErrorFile={{hdfs_log_dir_prefix}}/$USER/hs_err_pid%p.log -XX:NewSize={{jtnode_opt_newsize}} -XX:MaxNewSize={{jtnode_opt_maxnewsize}} -Xloggc:{{hdfs_log_dir_prefix}}/$USER/gc.log-`date +'%Y%m%d%H%M'` -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -Xmx{{jtnode_heapsize}} -Dhadoop.security.logger=INFO,DRFAS -Dmapred.audit.logger=INFO,MRAUDIT -Dhadoop.mapreduce.jobsummary.logger=INFO,JSA ${HADOOP_JOBTRACKER_OPTS}"
+
+HADOOP_TASKTRACKER_OPTS="-server -Xmx{{ttnode_heapsize}} -Dhadoop.security.logger=ERROR,console -Dmapred.audit.logger=ERROR,console ${HADOOP_TASKTRACKER_OPTS}"
+HADOOP_DATANODE_OPTS="-XX:CMSInitiatingOccupancyFraction=70 -XX:+UseCMSInitiatingOccupancyOnly -XX:ConcGCThreads=4 -XX:+UseConcMarkSweepGC -Xmx{{dtnode_heapsize}} -Dhadoop.security.logger=ERROR,DRFAS ${HADOOP_DATANODE_OPTS}"
+HADOOP_BALANCER_OPTS="-server -Xmx{{hadoop_heapsize}}m ${HADOOP_BALANCER_OPTS}"
+
+# On secure datanodes, user to run the datanode as after dropping privileges
+export HADOOP_SECURE_DN_USER=${HADOOP_SECURE_DN_USER:-{{hadoop_secure_dn_user}}}
+
+# Extra ssh options.  Empty by default.
+export HADOOP_SSH_OPTS="-o ConnectTimeout=5 -o SendEnv=HADOOP_CONF_DIR"
+
+# Where log files are stored.  $HADOOP_HOME/logs by default.
+export HADOOP_LOG_DIR={{hdfs_log_dir_prefix}}/$USER
+
+# History server logs
+export HADOOP_MAPRED_LOG_DIR={{mapred_log_dir_prefix}}/$USER
+
+# Where log files are stored in the secure data environment.
+export HADOOP_SECURE_DN_LOG_DIR={{hdfs_log_dir_prefix}}/$HADOOP_SECURE_DN_USER
+
+# File naming remote slave hosts.  $HADOOP_HOME/conf/slaves by default.
+# export HADOOP_SLAVES=${HADOOP_HOME}/conf/slaves
+
+# host:path where hadoop code should be rsync'd from.  Unset by default.
+# export HADOOP_MASTER=master:/home/$USER/src/hadoop
+
+# Seconds to sleep between slave commands.  Unset by default.  This
+# can be useful in large clusters, where, e.g., slave rsyncs can
+# otherwise arrive faster than the master can service them.
+# export HADOOP_SLAVE_SLEEP=0.1
+
+# The directory where pid files are stored. /tmp by default.
+export HADOOP_PID_DIR={{hadoop_pid_dir_prefix}}/$USER
+export HADOOP_SECURE_DN_PID_DIR={{hadoop_pid_dir_prefix}}/$HADOOP_SECURE_DN_USER
+
+# History server pid
+export HADOOP_MAPRED_PID_DIR={{mapred_pid_dir_prefix}}/$USER
+
+YARN_RESOURCEMANAGER_OPTS="-Dyarn.server.resourcemanager.appsummary.logger=INFO,RMSUMMARY -Drm.audit.logger=INFO,RMAUDIT"
+
+# A string representing this instance of hadoop. $USER by default.
+export HADOOP_IDENT_STRING=$USER
+
+# The scheduling priority for daemon processes.  See 'man nice'.
+
+# export HADOOP_NICENESS=10
+
+# Add database libraries
+JAVA_JDBC_LIBS=""
+if [ -d "/usr/share/java" ]; then
+  for jarFile in `ls /usr/share/java | grep -E "(mysql|ojdbc|postgresql|sqljdbc)" 2&gt;/dev/null`
+  do
+    JAVA_JDBC_LIBS=${JAVA_JDBC_LIBS}:$jarFile
+  done
+fi
+
+# Add libraries required by nodemanager
+MAPREDUCE_LIBS={{mapreduce_libs_path}}
+
+# Add libraries to the hadoop classpath - some may not need a colon as they already include it
+export HADOOP_CLASSPATH=${HADOOP_CLASSPATH}${JAVA_JDBC_LIBS}:${MAPREDUCE_LIBS}
+
+if [ -d "/usr/lib/tez" ]; then
+  export HADOOP_CLASSPATH=$HADOOP_CLASSPATH:/usr/lib/tez/*:/usr/lib/tez/lib/*:/etc/tez/conf
+fi
+
+# Setting path to hdfs command line
+export HADOOP_LIBEXEC_DIR={{hadoop_libexec_dir}}
+
+#Mostly required for hadoop 2.0
+export JAVA_LIBRARY_PATH=${JAVA_LIBRARY_PATH}:{{hadoop_lib_home}}/native/Linux-{{architecture}}-64
+
+{% if is_datanode_max_locked_memory_set %}
+# Fix temporary bug, when ulimit from conf files is not picked up, without full relogin. 
+# Makes sense to fix only when runing DN as root 
+if [ "$command" == "datanode" ] &amp;&amp; [ "$EUID" -eq 0 ] &amp;&amp; [ -n "$HADOOP_SECURE_DN_USER" ]; then
+  ulimit -l {{datanode_max_locked_memory}}
+fi
+{% endif %}
+    </value>
+    <value-attributes>
+      <type>content</type>
+    </value-attributes>
+    <on-ambari-upgrade add="true"/>
+  </property>
+</configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/7eb5cd4b/contrib/management-packs/isilon-onefs-mpack/src/main/resources/addon-services/ONEFS/1.0.0/configuration/hdfs-site.xml
----------------------------------------------------------------------
diff --git a/contrib/management-packs/isilon-onefs-mpack/src/main/resources/addon-services/ONEFS/1.0.0/configuration/hdfs-site.xml b/contrib/management-packs/isilon-onefs-mpack/src/main/resources/addon-services/ONEFS/1.0.0/configuration/hdfs-site.xml
new file mode 100644
index 0000000..cb6544f
--- /dev/null
+++ b/contrib/management-packs/isilon-onefs-mpack/src/main/resources/addon-services/ONEFS/1.0.0/configuration/hdfs-site.xml
@@ -0,0 +1,61 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
+<!--
+   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.
+-->
+<!-- Put site-specific property overrides in this file. -->
+<configuration supports_final="true">
+  <property>
+    <name>dfs.webhdfs.enabled</name>
+    <value>false</value>
+    <display-name>WebHDFS enabled</display-name>
+    <description>Whether to enable WebHDFS feature</description>
+    <final>true</final>
+    <value-attributes>
+      <type>boolean</type>
+      <overridable>false</overridable>
+    </value-attributes>
+    <on-ambari-upgrade add="true"/>
+  </property>
+  <property>
+    <name>dfs.datanode.http.address</name>
+    <value>0.0.0.0:8082</value>
+    <description>
+      The datanode http server address and port.
+    </description>
+    <on-ambari-upgrade add="true"/>
+  </property>
+  <property>
+    <name>dfs.namenode.http-address</name>
+    <value>localhost:8082</value>
+    <description>The name of the default file system.  Either the
+      literal string "local" or a host:port for HDFS.</description>
+    <final>true</final>
+    <on-ambari-upgrade add="false"/>
+  </property>
+  <property>
+    <name>dfs.namenode.https-address</name>
+    <value>localhost:8080</value>
+    <description>The https address where namenode binds</description>
+    <on-ambari-upgrade add="false"/>
+  </property>
+  <property>
+    <name>dfs.client-write-packet-size</name>
+    <value>131072</value>
+    <description>Packet size for clients to write</description>
+    <on-ambari-upgrade add="false"/>
+  </property>
+</configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/7eb5cd4b/contrib/management-packs/isilon-onefs-mpack/src/main/resources/addon-services/ONEFS/1.0.0/metainfo.xml
----------------------------------------------------------------------
diff --git a/contrib/management-packs/isilon-onefs-mpack/src/main/resources/addon-services/ONEFS/1.0.0/metainfo.xml b/contrib/management-packs/isilon-onefs-mpack/src/main/resources/addon-services/ONEFS/1.0.0/metainfo.xml
new file mode 100644
index 0000000..f20bcf8
--- /dev/null
+++ b/contrib/management-packs/isilon-onefs-mpack/src/main/resources/addon-services/ONEFS/1.0.0/metainfo.xml
@@ -0,0 +1,90 @@
+<?xml version="1.0"?>
+<!--
+   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.
+-->
+<metainfo>
+  <schemaVersion>2.0</schemaVersion>
+  <services>
+    <service>
+      <name>ONEFS</name>
+      <displayName>OneFS</displayName>
+      <serviceType>HCFS</serviceType>
+      <comment>Isilon Systems OneFS</comment>
+      <version>1.0.0</version>
+      <components>
+       <component>
+          <name>ONEFS_CLIENT</name>
+          <displayName>OneFS Client</displayName>
+          <category>CLIENT</category>
+          <componentType>HCFS_CLIENT</componentType>
+          <cardinality>1+</cardinality>
+          <versionAdvertised>true</versionAdvertised>
+          <commandScript>
+            <script>scripts/onefs_client.py</script>
+            <scriptType>PYTHON</scriptType>
+            <timeout>1200</timeout>
+          </commandScript>
+          <configFiles>
+            <configFile>
+              <type>xml</type>
+              <fileName>hdfs-site.xml</fileName>
+              <dictionaryName>hdfs-site</dictionaryName>
+            </configFile>
+            <configFile>
+              <type>xml</type>
+              <fileName>core-site.xml</fileName>
+              <dictionaryName>core-site</dictionaryName>
+            </configFile>
+            <configFile>
+              <type>env</type>
+              <fileName>log4j.properties</fileName>
+              <dictionaryName>hdfs-log4j,yarn-log4j</dictionaryName>
+            </configFile>
+            <configFile>
+              <type>env</type>
+              <fileName>hadoop-env.sh</fileName>
+              <dictionaryName>hadoop-env</dictionaryName>
+            </configFile>
+          </configFiles>
+        </component>
+      </components>
+
+      <osSpecifics>
+        <osSpecific>
+          <osFamily>any</osFamily>
+          <packages>
+            <package>
+              <name>hadoop-client</name>
+            </package>
+          </packages>
+        </osSpecific>
+      </osSpecifics>
+
+      <commandScript>
+        <script>scripts/service_check.py</script>
+        <scriptType>PYTHON</scriptType>
+        <timeout>300</timeout>
+      </commandScript>
+
+      <configuration-dependencies>
+        <config-type>core-site</config-type>
+        <config-type>hdfs-site</config-type>
+        <config-type>hadoop-env</config-type>
+      </configuration-dependencies>
+      <restartRequiredAfterRackChange>true</restartRequiredAfterRackChange>
+    </service>
+  </services>
+</metainfo>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/7eb5cd4b/contrib/management-packs/isilon-onefs-mpack/src/main/resources/addon-services/ONEFS/1.0.0/metrics.json
----------------------------------------------------------------------
diff --git a/contrib/management-packs/isilon-onefs-mpack/src/main/resources/addon-services/ONEFS/1.0.0/metrics.json b/contrib/management-packs/isilon-onefs-mpack/src/main/resources/addon-services/ONEFS/1.0.0/metrics.json
new file mode 100644
index 0000000..cd705eb
--- /dev/null
+++ b/contrib/management-packs/isilon-onefs-mpack/src/main/resources/addon-services/ONEFS/1.0.0/metrics.json
@@ -0,0 +1,59 @@
+{
+  "ONEFS_CLIENT": {
+    "Component": [
+      {
+        "type": "ganglia",
+        "metrics": {
+          "default": {
+            "metrics/onefs/demo/counter": {
+              "metric": "onefs.demo.counter",
+              "pointInTime": true,
+              "temporal": true
+            }
+          }
+        }
+      },
+      {
+        "type": "jmx",
+        "properties": {
+          "url_config_type": "hdfs-site",
+          "url_property_name": "dfs.namenode.http-address"
+        },
+        "metrics": {
+          "default": {
+            "metrics/dfs/namenode/Used": {
+              "metric": "Hadoop:service=NameNode,name=NameNodeInfo.Used",
+              "pointInTime": true,
+              "temporal": false
+            },
+            "metrics/jvm/memHeapUsedM": {
+              "metric": "jvm.JvmMetrics.MemHeapUsedM",
+              "pointInTime": true,
+              "temporal": true
+            },
+            "metrics/jvm/HeapMemoryMax": {
+              "metric": "java.lang:type=Memory.HeapMemoryUsage[max]",
+              "pointInTime": true,
+              "temporal": false
+            },
+            "metrics/jvm/HeapMemoryUsed": {
+              "metric": "java.lang:type=Memory.HeapMemoryUsage[used]",
+              "pointInTime": true,
+              "temporal": false
+            },
+            "metrics/jvm/NonHeapMemoryMax": {
+              "metric": "java.lang:type=Memory.NonHeapMemoryUsage[max]",
+              "pointInTime": true,
+              "temporal": false
+            },
+            "metrics/jvm/NonHeapMemoryUsed": {
+              "metric": "java.lang:type=Memory.NonHeapMemoryUsage[used]",
+              "pointInTime": true,
+              "temporal": false
+            }
+          }
+        }
+      }
+    ]
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/7eb5cd4b/contrib/management-packs/isilon-onefs-mpack/src/main/resources/addon-services/ONEFS/1.0.0/package/scripts/__init__.py
----------------------------------------------------------------------
diff --git a/contrib/management-packs/isilon-onefs-mpack/src/main/resources/addon-services/ONEFS/1.0.0/package/scripts/__init__.py b/contrib/management-packs/isilon-onefs-mpack/src/main/resources/addon-services/ONEFS/1.0.0/package/scripts/__init__.py
new file mode 100644
index 0000000..35de4bb
--- /dev/null
+++ b/contrib/management-packs/isilon-onefs-mpack/src/main/resources/addon-services/ONEFS/1.0.0/package/scripts/__init__.py
@@ -0,0 +1,20 @@
+"""
+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
+
+"""

http://git-wip-us.apache.org/repos/asf/ambari/blob/7eb5cd4b/contrib/management-packs/isilon-onefs-mpack/src/main/resources/addon-services/ONEFS/1.0.0/package/scripts/onefs_client.py
----------------------------------------------------------------------
diff --git a/contrib/management-packs/isilon-onefs-mpack/src/main/resources/addon-services/ONEFS/1.0.0/package/scripts/onefs_client.py b/contrib/management-packs/isilon-onefs-mpack/src/main/resources/addon-services/ONEFS/1.0.0/package/scripts/onefs_client.py
new file mode 100644
index 0000000..dbf1331
--- /dev/null
+++ b/contrib/management-packs/isilon-onefs-mpack/src/main/resources/addon-services/ONEFS/1.0.0/package/scripts/onefs_client.py
@@ -0,0 +1,56 @@
+"""
+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.
+
+"""
+from resource_management.core.exceptions import ClientComponentHasNoStatus
+from resource_management.libraries.script import Script
+from resource_management.libraries.resources.xml_config import XmlConfig
+
+class OneFsClient(Script):
+
+  def install(self, env):
+    self.install_packages(env)
+    self.configure(env)
+
+  def configure(self, env):
+    self.setup_config(env)
+
+  def status(self, env):
+    raise ClientComponentHasNoStatus()
+
+  def setup_config(self, env):
+    import params
+    env.set_params(params)
+    XmlConfig("hdfs-site.xml",
+            conf_dir=params.hadoop_conf_dir,
+            configurations=params.config['configurations']['hdfs-site'],
+            configuration_attributes=params.config['configuration_attributes']['hdfs-site'],
+            owner=params.hdfs_user,
+            group=params.user_group
+    )
+    XmlConfig("core-site.xml",
+            conf_dir=params.hadoop_conf_dir,
+            configurations=params.config['configurations']['core-site'],
+            configuration_attributes=params.config['configuration_attributes']['core-site'],
+            owner=params.hdfs_user,
+            group=params.user_group,
+            mode=0644
+    )
+
+if __name__ == "__main__":
+  OneFsClient().execute()
+

http://git-wip-us.apache.org/repos/asf/ambari/blob/7eb5cd4b/contrib/management-packs/isilon-onefs-mpack/src/main/resources/addon-services/ONEFS/1.0.0/package/scripts/params.py
----------------------------------------------------------------------
diff --git a/contrib/management-packs/isilon-onefs-mpack/src/main/resources/addon-services/ONEFS/1.0.0/package/scripts/params.py b/contrib/management-packs/isilon-onefs-mpack/src/main/resources/addon-services/ONEFS/1.0.0/package/scripts/params.py
new file mode 100644
index 0000000..838510c
--- /dev/null
+++ b/contrib/management-packs/isilon-onefs-mpack/src/main/resources/addon-services/ONEFS/1.0.0/package/scripts/params.py
@@ -0,0 +1,29 @@
+"""
+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.
+
+"""
+from ambari_commons import OSCheck
+from resource_management.libraries.functions.default import default
+
+if OSCheck.is_windows_family():
+  from params_windows import *
+else:
+  from params_linux import *
+
+nfsgateway_heapsize = config['configurations']['hadoop-env']['nfsgateway_heapsize']
+retryAble = default("/commandParams/command_retry_enabled", False)
+script_https_protocol = Script.get_force_https_protocol_name()
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/7eb5cd4b/contrib/management-packs/isilon-onefs-mpack/src/main/resources/addon-services/ONEFS/1.0.0/package/scripts/params_linux.py
----------------------------------------------------------------------
diff --git a/contrib/management-packs/isilon-onefs-mpack/src/main/resources/addon-services/ONEFS/1.0.0/package/scripts/params_linux.py b/contrib/management-packs/isilon-onefs-mpack/src/main/resources/addon-services/ONEFS/1.0.0/package/scripts/params_linux.py
new file mode 100644
index 0000000..72e0ae9
--- /dev/null
+++ b/contrib/management-packs/isilon-onefs-mpack/src/main/resources/addon-services/ONEFS/1.0.0/package/scripts/params_linux.py
@@ -0,0 +1,74 @@
+"""
+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.
+
+"""
+
+from resource_management.libraries.functions.version import format_stack_version, compare_versions
+from resource_management import *
+import os
+import itertools
+import re
+from resource_management.libraries.functions import conf_select
+from resource_management.libraries.functions.get_not_managed_resources import get_not_managed_resources
+from resource_management.libraries.resources.hdfs_resource import HdfsResource
+from resource_management.libraries.functions import stack_select
+
+config = Script.get_config()
+
+hostname = config["hostname"]
+hadoop_conf_dir = conf_select.get_hadoop_conf_dir(force_latest_on_upgrade=True)
+hdfs_user = config['configurations']['hadoop-env']['hdfs_user']
+user_group = config['configurations']['cluster-env']['user_group']
+hdfs_tmp_dir = config['configurations']['hadoop-env']['hdfs_tmp_dir']
+security_enabled = config['configurations']['cluster-env']['security_enabled']
+
+namenode_host = default("/clusterHostInfo/namenode_host", [])
+journalnode_hosts = default("/clusterHostInfo/journalnode_hosts", [])
+zkfc_hosts = default("/clusterHostInfo/zkfc_hosts", [])
+
+has_journalnode_hosts = not len(journalnode_hosts)  == 0
+has_zkfc_hosts = not len(zkfc_hosts)  == 0
+is_namenode_master = hostname in namenode_host
+
+dfs_type = default("/commandParams/dfs_type", "")
+hdfs_user_keytab = config['configurations']['hadoop-env']['hdfs_user_keytab']
+kinit_path_local = get_kinit_path(default('/configurations/kerberos-env/executable_search_paths', None))
+hadoop_bin_dir = stack_select.get_hadoop_dir("bin")
+hadoop_conf_dir = conf_select.get_hadoop_conf_dir()
+hdfs_principal_name = default('/configurations/hadoop-env/hdfs_principal_name', None)
+hdfs_site = config['configurations']['hdfs-site']
+default_fs = config['configurations']['core-site']['fs.defaultFS']
+
+import functools
+#create partial functions with common arguments for every HdfsResource call
+#to create/delete/copyfromlocal hdfs directories/files we need to call params.HdfsResource in code
+HdfsResource = functools.partial(
+  HdfsResource,
+  user=hdfs_user,
+  hdfs_resource_ignore_file = "/var/lib/ambari-agent/data/.hdfs_resource_ignore",
+  security_enabled = security_enabled,
+  keytab = hdfs_user_keytab,
+  kinit_path_local = kinit_path_local,
+  hadoop_bin_dir = hadoop_bin_dir,
+  hadoop_conf_dir = hadoop_conf_dir,
+  principal_name = hdfs_principal_name,
+  hdfs_site = hdfs_site,
+  default_fs = default_fs,
+  immutable_paths = get_not_managed_resources(),
+  dfs_type = dfs_type
+)
+

http://git-wip-us.apache.org/repos/asf/ambari/blob/7eb5cd4b/contrib/management-packs/isilon-onefs-mpack/src/main/resources/addon-services/ONEFS/1.0.0/package/scripts/params_windows.py
----------------------------------------------------------------------
diff --git a/contrib/management-packs/isilon-onefs-mpack/src/main/resources/addon-services/ONEFS/1.0.0/package/scripts/params_windows.py b/contrib/management-packs/isilon-onefs-mpack/src/main/resources/addon-services/ONEFS/1.0.0/package/scripts/params_windows.py
new file mode 100644
index 0000000..3e712b3
--- /dev/null
+++ b/contrib/management-packs/isilon-onefs-mpack/src/main/resources/addon-services/ONEFS/1.0.0/package/scripts/params_windows.py
@@ -0,0 +1,83 @@
+"""
+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.
+
+"""
+
+import os
+
+#Used in subsequent imports from params
+from install_params import exclude_packages
+from status_params import *
+
+config = Script.get_config()
+hadoop_conf_dir = None
+hbase_conf_dir = None
+hadoop_home = None
+try:
+  hadoop_conf_dir = os.environ["HADOOP_CONF_DIR"]
+  hbase_conf_dir = os.environ["HBASE_CONF_DIR"]
+  hadoop_home = os.environ["HADOOP_HOME"]
+except:
+  pass
+#directories & files
+dfs_name_dir = config['configurations']['hdfs-site']['dfs.namenode.name.dir']
+fs_checkpoint_dir = config['configurations']['hdfs-site']['dfs.namenode.checkpoint.dir']
+dfs_data_dir = config['configurations']['hdfs-site']['dfs.datanode.data.dir']
+#decomission
+hdfs_exclude_file = default("/clusterHostInfo/decom_dn_hosts", [])
+exclude_file_path = config['configurations']['hdfs-site']['dfs.hosts.exclude']
+include_file_path = default("/configurations/hdfs-site/dfs.hosts", None)
+hdfs_include_file = None
+manage_include_files = default("/configurations/hdfs-site/manage.include.files", False)
+if include_file_path and manage_include_files:
+  slave_hosts = default("/clusterHostInfo/slave_hosts", [])
+  hdfs_include_file = list(set(slave_hosts) - set(hdfs_exclude_file))
+update_files_only = default("/commandParams/update_files_only",False)
+# HDFS High Availability properties
+dfs_ha_enabled = False
+dfs_ha_nameservices = default("/configurations/hdfs-site/dfs.internal.nameservices", None)
+dfs_ha_namenode_ids = default(format("/configurations/hdfs-site/dfs.ha.namenodes.{dfs_ha_nameservices}"), None)
+
+namenode_id = None
+namenode_rpc = None
+hostname = config["hostname"]
+if dfs_ha_namenode_ids:
+  dfs_ha_namemodes_ids_list = dfs_ha_namenode_ids.split(",")
+  dfs_ha_namenode_ids_array_len = len(dfs_ha_namemodes_ids_list)
+  if dfs_ha_namenode_ids_array_len > 1:
+    dfs_ha_enabled = True
+if dfs_ha_enabled:
+  for nn_id in dfs_ha_namemodes_ids_list:
+    nn_host = config['configurations']['hdfs-site'][format('dfs.namenode.rpc-address.{dfs_ha_nameservices}.{nn_id}')]
+    if hostname.lower() in nn_host.lower():
+      namenode_id = nn_id
+      namenode_rpc = nn_host
+
+hadoop_user = config["configurations"]["cluster-env"]["hadoop.user.name"]
+hdfs_user = hadoop_user
+
+grep_exe = "findstr"
+
+name_node_params = default("/commandParams/namenode", None)
+
+service_map = {
+  "datanode" : datanode_win_service_name,
+  "journalnode" : journalnode_win_service_name,
+  "namenode" : namenode_win_service_name,
+  "secondarynamenode" : snamenode_win_service_name,
+  "zkfc_slave": zkfc_win_service_name
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/7eb5cd4b/contrib/management-packs/isilon-onefs-mpack/src/main/resources/addon-services/ONEFS/1.0.0/package/scripts/service_check.py
----------------------------------------------------------------------
diff --git a/contrib/management-packs/isilon-onefs-mpack/src/main/resources/addon-services/ONEFS/1.0.0/package/scripts/service_check.py b/contrib/management-packs/isilon-onefs-mpack/src/main/resources/addon-services/ONEFS/1.0.0/package/scripts/service_check.py
new file mode 100644
index 0000000..3d798a3
--- /dev/null
+++ b/contrib/management-packs/isilon-onefs-mpack/src/main/resources/addon-services/ONEFS/1.0.0/package/scripts/service_check.py
@@ -0,0 +1,137 @@
+"""
+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.
+
+"""
+
+from resource_management import *
+from resource_management.core.shell import as_user
+from ambari_commons.os_family_impl import OsFamilyImpl
+from ambari_commons import OSConst
+from resource_management.libraries.functions.curl_krb_request import curl_krb_request
+from resource_management.core.logger import Logger
+
+class HdfsServiceCheck(Script):
+  pass
+
+@OsFamilyImpl(os_family=OsFamilyImpl.DEFAULT)
+class HdfsServiceCheckDefault(HdfsServiceCheck):
+  def service_check(self, env):
+    import params
+
+    env.set_params(params)
+    unique = functions.get_unique_id_and_date()
+    dir = params.hdfs_tmp_dir
+    tmp_file = format("{dir}/{unique}")
+
+    if params.security_enabled:
+      Execute(format("{kinit_path_local} -kt {hdfs_user_keytab} {hdfs_principal_name}"),
+        user=params.hdfs_user
+      )
+    params.HdfsResource(dir,
+                        type="directory",
+                        action="create_on_execute",
+                        mode=0777
+    )
+    params.HdfsResource(tmp_file,
+                        type="file",
+                        action="delete_on_execute",
+    )
+
+    params.HdfsResource(tmp_file,
+                        type="file",
+                        source="/etc/passwd",
+                        action="create_on_execute"
+    )
+    params.HdfsResource(None, action="execute")
+
+    if params.has_journalnode_hosts:
+      if params.security_enabled:
+        for host in params.journalnode_hosts:
+          if params.https_only:
+            uri = format("https://{host}:{journalnode_port}")
+          else:
+            uri = format("http://{host}:{journalnode_port}")
+          response, errmsg, time_millis = curl_krb_request(params.tmp_dir, params.smoke_user_keytab,
+                                                           params.smokeuser_principal, uri, "jn_service_check",
+                                                           params.kinit_path_local, False, None, params.smoke_user)
+          if not response:
+            Logger.error("Cannot access WEB UI on: {0}. Error : {1}", uri, errmsg)
+            return 1
+      else:
+        journalnode_port = params.journalnode_port
+        checkWebUIFileName = "checkWebUI.py"
+        checkWebUIFilePath = format("{tmp_dir}/{checkWebUIFileName}")
+        comma_sep_jn_hosts = ",".join(params.journalnode_hosts)
+
+        checkWebUICmd = format("ambari-python-wrap {checkWebUIFilePath} -m {comma_sep_jn_hosts} -p {journalnode_port} -s {https_only} -o {script_https_protocol}")
+        File(checkWebUIFilePath,
+             content=StaticFile(checkWebUIFileName),
+             mode=0775)
+
+        Execute(checkWebUICmd,
+                logoutput=True,
+                try_sleep=3,
+                tries=5,
+                user=params.smoke_user
+        )
+
+    if params.is_namenode_master:
+      if params.has_zkfc_hosts:
+        pid_dir = format("{hadoop_pid_dir_prefix}/{hdfs_user}")
+        pid_file = format("{pid_dir}/hadoop-{hdfs_user}-zkfc.pid")
+        check_zkfc_process_cmd = as_user(format(
+          "ls {pid_file} >/dev/null 2>&1 && ps -p `cat {pid_file}` >/dev/null 2>&1"), user=params.hdfs_user)
+        Execute(check_zkfc_process_cmd,
+                logoutput=True,
+                try_sleep=3,
+                tries=5
+        )
+
+@OsFamilyImpl(os_family=OSConst.WINSRV_FAMILY)
+class HdfsServiceCheckWindows(HdfsServiceCheck):
+  def service_check(self, env):
+    import params
+    env.set_params(params)
+
+    unique = functions.get_unique_id_and_date()
+
+    #Hadoop uses POSIX-style paths, separator is always /
+    dir = params.hdfs_tmp_dir
+    tmp_file = dir + '/' + unique
+
+    #commands for execution
+    hadoop_cmd = "cmd /C %s" % (os.path.join(params.hadoop_home, "bin", "hadoop.cmd"))
+    create_dir_cmd = "%s fs -mkdir %s" % (hadoop_cmd, dir)
+    own_dir = "%s fs -chmod 777 %s" % (hadoop_cmd, dir)
+    test_dir_exists = "%s fs -test -e %s" % (hadoop_cmd, dir)
+    cleanup_cmd = "%s fs -rm %s" % (hadoop_cmd, tmp_file)
+    create_file_cmd = "%s fs -put %s %s" % (hadoop_cmd, os.path.join(params.hadoop_conf_dir, "core-site.xml"), tmp_file)
+    test_cmd = "%s fs -test -e %s" % (hadoop_cmd, tmp_file)
+
+    hdfs_cmd = "cmd /C %s" % (os.path.join(params.hadoop_home, "bin", "hdfs.cmd"))
+    safemode_command = "%s dfsadmin -safemode get | %s OFF" % (hdfs_cmd, params.grep_exe)
+
+    Execute(safemode_command, logoutput=True, try_sleep=3, tries=20)
+    Execute(create_dir_cmd, user=params.hdfs_user,logoutput=True, ignore_failures=True)
+    Execute(own_dir, user=params.hdfs_user,logoutput=True)
+    Execute(test_dir_exists, user=params.hdfs_user,logoutput=True)
+    Execute(create_file_cmd, user=params.hdfs_user,logoutput=True)
+    Execute(test_cmd, user=params.hdfs_user,logoutput=True)
+    Execute(cleanup_cmd, user=params.hdfs_user,logoutput=True)
+
+if __name__ == "__main__":
+  HdfsServiceCheck().execute()

http://git-wip-us.apache.org/repos/asf/ambari/blob/7eb5cd4b/contrib/management-packs/isilon-onefs-mpack/src/main/resources/addon-services/ONEFS/1.0.0/package/scripts/status_params.py
----------------------------------------------------------------------
diff --git a/contrib/management-packs/isilon-onefs-mpack/src/main/resources/addon-services/ONEFS/1.0.0/package/scripts/status_params.py b/contrib/management-packs/isilon-onefs-mpack/src/main/resources/addon-services/ONEFS/1.0.0/package/scripts/status_params.py
new file mode 100644
index 0000000..153f9a6
--- /dev/null
+++ b/contrib/management-packs/isilon-onefs-mpack/src/main/resources/addon-services/ONEFS/1.0.0/package/scripts/status_params.py
@@ -0,0 +1,58 @@
+"""
+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.
+
+"""
+
+from ambari_commons import OSCheck
+
+from resource_management.libraries.functions import conf_select
+from resource_management.libraries.functions import format
+from resource_management.libraries.functions.default import default
+from resource_management.libraries.functions import get_kinit_path
+from resource_management.libraries.script.script import Script
+
+config = Script.get_config()
+
+if OSCheck.is_windows_family():
+  namenode_win_service_name = "namenode"
+  datanode_win_service_name = "datanode"
+  snamenode_win_service_name = "secondarynamenode"
+  journalnode_win_service_name = "journalnode"
+  zkfc_win_service_name = "zkfc"
+else:
+  hadoop_pid_dir_prefix = config['configurations']['hadoop-env']['hadoop_pid_dir_prefix']
+  hdfs_user = config['configurations']['hadoop-env']['hdfs_user']
+  hadoop_pid_dir = format("{hadoop_pid_dir_prefix}/{hdfs_user}")
+  datanode_pid_file = format("{hadoop_pid_dir}/hadoop-{hdfs_user}-datanode.pid")
+  namenode_pid_file = format("{hadoop_pid_dir}/hadoop-{hdfs_user}-namenode.pid")
+  snamenode_pid_file = format("{hadoop_pid_dir}/hadoop-{hdfs_user}-secondarynamenode.pid")
+  journalnode_pid_file = format("{hadoop_pid_dir}/hadoop-{hdfs_user}-journalnode.pid")
+  zkfc_pid_file = format("{hadoop_pid_dir}/hadoop-{hdfs_user}-zkfc.pid")
+  nfsgateway_pid_file = format("{hadoop_pid_dir_prefix}/root/hadoop_privileged_nfs3.pid")
+
+  # Security related/required params
+  hostname = config['hostname']
+  security_enabled = config['configurations']['cluster-env']['security_enabled']
+  hdfs_user_principal = config['configurations']['hadoop-env']['hdfs_principal_name']
+  hdfs_user_keytab = config['configurations']['hadoop-env']['hdfs_user_keytab']
+
+  hadoop_conf_dir = conf_select.get_hadoop_conf_dir()
+
+  kinit_path_local = get_kinit_path(default('/configurations/kerberos-env/executable_search_paths', None))
+  tmp_dir = Script.get_tmp_dir()
+
+stack_name = default("/hostLevelParams/stack_name", None)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/7eb5cd4b/contrib/management-packs/isilon-onefs-mpack/src/main/resources/addon-services/ONEFS/1.0.0/widgets.json
----------------------------------------------------------------------
diff --git a/contrib/management-packs/isilon-onefs-mpack/src/main/resources/addon-services/ONEFS/1.0.0/widgets.json b/contrib/management-packs/isilon-onefs-mpack/src/main/resources/addon-services/ONEFS/1.0.0/widgets.json
new file mode 100644
index 0000000..23da1d6
--- /dev/null
+++ b/contrib/management-packs/isilon-onefs-mpack/src/main/resources/addon-services/ONEFS/1.0.0/widgets.json
@@ -0,0 +1,38 @@
+{
+  "layouts": [
+    {
+      "layout_name": "default_onefs_layout",
+      "display_name": "Standard ONEFS Dashboard",
+      "section_name": "ONEFS_SUMMARY",
+      "widgetLayoutInfo": [
+        {
+          "widget_name": "OneFS metrics demo",
+          "description": "Test widget",
+          "default_section_name": "ONEFS_SUMMARY",
+          "widget_type": "GRAPH",
+          "is_visible": true,
+          "scope" : "SERVICE",
+          "metrics": [
+            {
+              "name": "counter",
+              "metric_path": "metrics/onefs/demo/counter",
+              "service_name": "ONEFS",
+              "component_name": "ONEFS_CLUSTER"
+            }
+          ],
+          "values": [
+            {
+              "name": "demo value",
+              "values" : "${counter}"
+            }
+          ],
+          "properties": {
+            "graph_type": "LINE",
+            "time_range": "1",
+            "display_unit": "%"
+          }
+        }
+      ]
+    }
+  ]
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/7eb5cd4b/contrib/management-packs/isilon-onefs-mpack/src/main/resources/mpack.json
----------------------------------------------------------------------
diff --git a/contrib/management-packs/isilon-onefs-mpack/src/main/resources/mpack.json b/contrib/management-packs/isilon-onefs-mpack/src/main/resources/mpack.json
new file mode 100644
index 0000000..f15fcb6
--- /dev/null
+++ b/contrib/management-packs/isilon-onefs-mpack/src/main/resources/mpack.json
@@ -0,0 +1,28 @@
+{
+  "type" : "full-release",
+  "name" : "onefs-ambari-mpack",
+  "version": "0.1",
+  "description" : "OneFS Ambari Management Pack",
+  "prerequisites": {
+    "min-ambari-version" : "3.0.0.0"
+  },
+  "artifacts": [
+    {
+      "name" : "ONEFS-addon-services",
+      "type" : "stack-addon-service-definitions",
+      "source_dir" : "addon-services",
+      "service_versions_map" : [
+          {
+             "service_name" : "ONEFS",
+             "service_version" : "1.0.0",
+             "applicable_stacks" : [
+                 {
+                      "stack_name" : "HDP", "stack_version" : "2.6"
+                  }
+              ]
+          }
+      ]
+    }
+  ]
+}
+


[49/50] ambari git commit: AMBARI-22236. Expression parser support for JMXServerSide alerts (amagyar)

Posted by am...@apache.org.
AMBARI-22236. Expression parser support for JMXServerSide alerts (amagyar)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/166e5006
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/166e5006
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/166e5006

Branch: refs/heads/branch-feature-AMBARI-22008
Commit: 166e500630b63ff016d099c7734bf0cb8c9920c0
Parents: b552da9
Author: Attila Magyar <am...@hortonworks.com>
Authored: Tue Oct 17 16:15:15 2017 +0200
Committer: Attila Magyar <am...@hortonworks.com>
Committed: Tue Oct 17 16:52:56 2017 +0200

----------------------------------------------------------------------
 .../server/alerts/JmxServerSideAlert.java       | 42 ++++++------
 .../server/state/alert/AlertDefinition.java     | 13 ++++
 .../ambari/server/state/alert/MetricSource.java | 59 ++++++++++++++++-
 .../ambari/server/state/alert/Reporting.java    | 16 ++---
 .../AlertDefinitionResourceProviderTest.java    |  4 +-
 .../ambari/server/state/alert/JmxInfoTest.java  | 68 ++++++++++++++++++++
 6 files changed, 162 insertions(+), 40 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/166e5006/ambari-server/src/main/java/org/apache/ambari/server/alerts/JmxServerSideAlert.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/alerts/JmxServerSideAlert.java b/ambari-server/src/main/java/org/apache/ambari/server/alerts/JmxServerSideAlert.java
index a4b86f8..09eb0a4 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/alerts/JmxServerSideAlert.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/alerts/JmxServerSideAlert.java
@@ -23,6 +23,7 @@ import static java.util.Collections.singletonList;
 import java.net.URI;
 import java.util.List;
 import java.util.Map;
+import java.util.Optional;
 
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.configuration.ComponentSSLConfiguration;
@@ -35,7 +36,6 @@ import org.apache.ambari.server.state.ConfigHelper;
 import org.apache.ambari.server.state.alert.AlertDefinition;
 import org.apache.ambari.server.state.alert.AlertDefinitionFactory;
 import org.apache.ambari.server.state.alert.MetricSource;
-import org.apache.ambari.server.state.alert.Reporting;
 import org.apache.ambari.server.state.alert.ServerSource;
 import org.apache.ambari.server.state.services.MetricsRetrievalService;
 import org.slf4j.Logger;
@@ -64,41 +64,35 @@ public class JmxServerSideAlert extends AlertRunnable {
   List<Alert> execute(Cluster cluster, AlertDefinitionEntity entity) throws AmbariException {
     AlertDefinition alertDef = definitionFactory.coerce(entity);
     ServerSource serverSource = (ServerSource) alertDef.getSource();
-    URI jmxUrl = jmxUrl(cluster, serverSource);
-    JMXMetricHolder metricHolder = jmxMetric(serverSource, jmxUrl);
-    return metricHolder == null
-      ? emptyList()
-      : alerts(alertDef, serverSource.getJmxInfo(), metricHolder, serverSource.getReporting());
+    return buildAlert(jmxMetric(serverSource, cluster), serverSource.getJmxInfo(), alertDef)
+      .map(alert -> singletonList(alert))
+      .orElse(emptyList());
   }
 
-  private URI jmxUrl(Cluster cluster, ServerSource serverSource) throws AmbariException {
-    return serverSource.getUri().resolve(config(cluster)).resolve(serverSource.getJmxInfo().getUrlSuffix());
+  public Optional<Alert> buildAlert(Optional<JMXMetricHolder> metricHolder, MetricSource.JmxInfo jmxInfo, AlertDefinition alertDef) {
+    return metricHolder.flatMap(metric -> buildAlert(metric, jmxInfo, alertDef));
   }
 
-  private Map<String, Map<String, String>> config(Cluster cluster) throws AmbariException {
-    return configHelper.getEffectiveConfigProperties(cluster, configHelper.getEffectiveDesiredTags(cluster, null));
+  private Optional<Alert> buildAlert(JMXMetricHolder metricHolder, MetricSource.JmxInfo jmxInfo, AlertDefinition alertDef) {
+    List<Object> allMetrics = metricHolder.findAll(jmxInfo.getPropertyList());
+    return jmxInfo.eval(metricHolder).map(val -> alertDef.buildAlert(val.doubleValue(), allMetrics));
   }
 
-  private JMXMetricHolder jmxMetric(ServerSource serverSource, URI jmxUri) {
+  private Optional<JMXMetricHolder> jmxMetric(ServerSource serverSource, Cluster cluster) throws AmbariException {
+    URI jmxUri = jmxUrl(cluster, serverSource);
     URLStreamProvider streamProvider = new URLStreamProvider(
       serverSource.getUri().getConnectionTimeoutMsec(),
       serverSource.getUri().getReadTimeoutMsec(),
       ComponentSSLConfiguration.instance());
     metricsRetrievalService.submitRequest(MetricsRetrievalService.MetricSourceType.JMX, streamProvider, jmxUri.toString());
-    return metricsRetrievalService.getCachedJMXMetric(jmxUri.toString());
+    return Optional.ofNullable(metricsRetrievalService.getCachedJMXMetric(jmxUri.toString()));
+  }
+
+  private URI jmxUrl(Cluster cluster, ServerSource serverSource) throws AmbariException {
+    return serverSource.getUri().resolve(config(cluster)).resolve(serverSource.getJmxInfo().getUrlSuffix());
   }
 
-  private List<Alert> alerts(AlertDefinition alertDef, MetricSource.JmxInfo jmxInfo, JMXMetricHolder jmxMetricHolder, Reporting reporting) throws AmbariException {
-    List<Object> metrics = jmxMetricHolder.findAll(jmxInfo.getPropertyList());
-    if (metrics.isEmpty()) {
-      return emptyList();
-    }
-    if (metrics.get(0) instanceof Number) {
-      Alert alert = reporting.alert(((Number) metrics.get(0)).doubleValue(), metrics, alertDef);
-      return singletonList(alert);
-    } else {
-      LOG.info("Unsupported metrics value: {} when running alert: {}", metrics.get(0), alertDef);
-      return emptyList();
-    }
+  private Map<String, Map<String, String>> config(Cluster cluster) throws AmbariException {
+    return configHelper.getEffectiveConfigProperties(cluster, configHelper.getEffectiveDesiredTags(cluster, null));
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/166e5006/ambari-server/src/main/java/org/apache/ambari/server/state/alert/AlertDefinition.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/alert/AlertDefinition.java b/ambari-server/src/main/java/org/apache/ambari/server/state/alert/AlertDefinition.java
index 665430d..f1f21a4 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/alert/AlertDefinition.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/alert/AlertDefinition.java
@@ -18,7 +18,10 @@
 package org.apache.ambari.server.state.alert;
 
 import java.util.HashSet;
+import java.util.List;
 
+import org.apache.ambari.server.state.Alert;
+import org.apache.ambari.server.state.AlertState;
 import org.apache.commons.lang.StringUtils;
 
 import com.google.gson.annotations.SerializedName;
@@ -354,6 +357,16 @@ public class AlertDefinition {
   }
 
   /**
+   * Map the incoming value to {@link AlertState} and generate an alert with that state.
+   */
+  public Alert buildAlert(double value, List<Object> args) {
+    Reporting reporting = source.getReporting();
+    Alert alert = new Alert(name, null, serviceName, componentName, null, reporting.state(value));
+    alert.setText(reporting.formatMessage(value, args));
+    return alert;
+  }
+
+  /**
    * Gets equality based on name only.
    *
    * @see #deeplyEquals(Object)

http://git-wip-us.apache.org/repos/asf/ambari/blob/166e5006/ambari-server/src/main/java/org/apache/ambari/server/state/alert/MetricSource.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/alert/MetricSource.java b/ambari-server/src/main/java/org/apache/ambari/server/state/alert/MetricSource.java
index d7283fe..019f3b1 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/alert/MetricSource.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/alert/MetricSource.java
@@ -17,8 +17,16 @@
  */
 package org.apache.ambari.server.state.alert;
 
+import static java.util.stream.Collectors.toMap;
+import static java.util.stream.IntStream.range;
+
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Optional;
+
+import org.apache.ambari.server.controller.jmx.JMXMetricHolder;
+import org.springframework.expression.spel.standard.SpelExpressionParser;
+import org.springframework.expression.spel.support.StandardEvaluationContext;
 
 import com.google.gson.annotations.SerializedName;
 
@@ -127,7 +135,7 @@ public class MetricSource extends Source {
     @SerializedName("property_list")
     private List<String> propertyList;
 
-    private String value;
+    private String value = "{0}";
 
     @SerializedName("url_suffix")
     private String urlSuffix = "/jmx";
@@ -136,8 +144,16 @@ public class MetricSource extends Source {
       return propertyList;
     }
 
-    public String getValue() {
-      return value;
+    public void setPropertyList(List<String> propertyList) {
+      this.propertyList = propertyList;
+    }
+
+    public void setValue(String value) {
+      this.value = value;
+    }
+
+    public Value getValue() {
+      return new Value(value);
     }
 
     @Override
@@ -159,5 +175,42 @@ public class MetricSource extends Source {
     public String getUrlSuffix() {
       return urlSuffix;
     }
+
+    public Optional<Number> eval(JMXMetricHolder jmxMetricHolder) {
+      List<Object> metrics = jmxMetricHolder.findAll(propertyList);
+      if (metrics.isEmpty()) {
+        return Optional.empty();
+      } else {
+        Object value = getValue().eval(metrics);
+        return value instanceof Number ? Optional.of((Number)value) : Optional.empty();
+      }
+    }
+  }
+
+  public static class Value {
+    private final String value;
+
+    public Value(String value) {
+      this.value = value;
+    }
+
+    /**
+     * Evaluate an expression like "{0}/({0} + {1}) * 100.0" where each positional argument represent a metrics value.
+     * The value is converted to SpEL syntax:
+     *  #var0/(#var0 + #var1) * 100.0
+     * then it is evaluated in the context of the metrics parameters.
+     */
+    public Object eval(List<Object> metrics) {
+      StandardEvaluationContext context = new StandardEvaluationContext();
+      context.setVariables(range(0, metrics.size()).boxed().collect(toMap(i -> "var" + i, metrics::get)));
+      return new SpelExpressionParser()
+        .parseExpression(value.replaceAll("(\\{(\\d+)\\})", "#var$2"))
+        .getValue(context);
+    }
+
+    @Override
+    public String toString() {
+      return value;
+    }
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/166e5006/ambari-server/src/main/java/org/apache/ambari/server/state/alert/Reporting.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/alert/Reporting.java b/ambari-server/src/main/java/org/apache/ambari/server/state/alert/Reporting.java
index 51d074e..a7e11e1 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/alert/Reporting.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/alert/Reporting.java
@@ -23,7 +23,6 @@ import java.text.MessageFormat;
 import java.util.List;
 
 import org.apache.ambari.server.alerts.Threshold;
-import org.apache.ambari.server.state.Alert;
 import org.apache.ambari.server.state.AlertState;
 
 import com.google.gson.annotations.SerializedName;
@@ -208,16 +207,7 @@ public class Reporting {
     return true;
   }
 
-  /**
-   * Map the incoming value to {@link AlertState} and generate an alert with that state.
-   */
-  public Alert alert(double value, List<Object> args, AlertDefinition alertDef) {
-    Alert alert = new Alert(alertDef.getName(), null, alertDef.getServiceName(), alertDef.getComponentName(), null, state(value));
-    alert.setText(MessageFormat.format(message(value), args.toArray()));
-    return alert;
-  }
-
-  private AlertState state(double value) {
+  public AlertState state(double value) {
     return getThreshold().state(PERCENT == getType() ? value * 100 : value);
   }
 
@@ -225,6 +215,10 @@ public class Reporting {
     return new Threshold(getOk().getValue(), getWarning().getValue(), getCritical().getValue());
   }
 
+  public String formatMessage(double value, List<Object> args) {
+    return MessageFormat.format(message(value), args.toArray());
+  }
+
   private String message(double value) {
     switch (state(value)) {
       case OK:

http://git-wip-us.apache.org/repos/asf/ambari/blob/166e5006/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AlertDefinitionResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AlertDefinitionResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AlertDefinitionResourceProviderTest.java
index 3ef2c48..e8ad651 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AlertDefinitionResourceProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AlertDefinitionResourceProviderTest.java
@@ -457,7 +457,7 @@ public class AlertDefinitionResourceProviderTest {
 
     // JMX
     requestProps.put("AlertDefinition/source/jmx/value",
-        source.getJmxInfo().getValue());
+        source.getJmxInfo().getValue().toString());
     requestProps.put("AlertDefinition/source/jmx/property_list",
         source.getJmxInfo().getPropertyList());
 
@@ -600,7 +600,7 @@ public class AlertDefinitionResourceProviderTest {
 
     // JMX
     requestProps.put("AlertDefinition/source/jmx/value",
-        source.getJmxInfo().getValue());
+        source.getJmxInfo().getValue().toString());
     requestProps.put("AlertDefinition/source/jmx/property_list",
         source.getJmxInfo().getPropertyList());
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/166e5006/ambari-server/src/test/java/org/apache/ambari/server/state/alert/JmxInfoTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/alert/JmxInfoTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/alert/JmxInfoTest.java
new file mode 100644
index 0000000..308ab4f
--- /dev/null
+++ b/ambari-server/src/test/java/org/apache/ambari/server/state/alert/JmxInfoTest.java
@@ -0,0 +1,68 @@
+package org.apache.ambari.server.state.alert;
+
+import static java.util.Arrays.asList;
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertThat;
+
+import java.util.HashMap;
+import java.util.Optional;
+
+import org.apache.ambari.server.controller.jmx.JMXMetricHolder;
+import org.junit.Test;
+
+public class JmxInfoTest {
+  private static final String JMX_PROP_NAME1 = "Hadoop:service=NameNode,name=FSNamesystem/CapacityUsed";
+  private static final String JMX_PROP_NAME2 = "Hadoop:service=NameNode,name=FSNamesystem/CapacityRemaining";
+
+  @Test
+  public void testFindJmxMetricsAndCalculateSimpleValue() throws Exception {
+    MetricSource.JmxInfo jmxInfo = jmxInfoWith("{1}");
+    JMXMetricHolder metrics = metrics(12.5, 3.5);
+    assertThat(jmxInfo.eval(metrics), is(Optional.of(3.5)));
+  }
+
+  @Test
+  public void testFindJmxMetricsAndCalculateComplexValue() throws Exception {
+    MetricSource.JmxInfo jmxInfo = jmxInfoWith("2 * ({0} + {1})");
+    JMXMetricHolder metrics = metrics(12.5, 2.5);
+    assertThat(jmxInfo.eval(metrics), is(Optional.of(30.0)));
+  }
+
+  @Test
+  public void testReturnsEmptyWhenJmxPropertyWasNotFound() throws Exception {
+    MetricSource.JmxInfo jmxInfo = new MetricSource.JmxInfo();
+    jmxInfo.setPropertyList(asList("notfound/notfound"));
+    JMXMetricHolder metrics = metrics(1, 2);
+    assertThat(jmxInfo.eval(metrics), is(Optional.empty()));
+  }
+
+  private MetricSource.JmxInfo jmxInfoWith(String value) {
+    MetricSource.JmxInfo jmxInfo = new MetricSource.JmxInfo();
+    jmxInfo.setValue(value);
+    jmxInfo.setPropertyList(asList(JMX_PROP_NAME1, JMX_PROP_NAME2));
+    return jmxInfo;
+  }
+
+  private JMXMetricHolder metrics(final double jmxValue1, final double jmxValue2) {
+    JMXMetricHolder metrics = new JMXMetricHolder();
+    metrics.setBeans(asList(
+      new HashMap<String,Object>() {{
+        put("name", name(JMX_PROP_NAME1));
+        put(key(JMX_PROP_NAME1), jmxValue1);
+      }},
+      new HashMap<String,Object>() {{
+        put("name", name(JMX_PROP_NAME2));
+        put(key(JMX_PROP_NAME2), jmxValue2);
+      }}
+    ));
+    return metrics;
+  }
+
+  private String name(String jmxProp) {
+    return jmxProp.split("/")[0];
+  }
+
+  private String key(String jmxProp) {
+    return jmxProp.split("/")[1];
+  }
+}
\ No newline at end of file


[34/50] ambari git commit: AMBARI-22232 : Need to add a new property to support proxy users for Atlas service. (Vishal Suvagia via mugdha)

Posted by am...@apache.org.
AMBARI-22232 : Need to add a new property to support proxy users for Atlas service. (Vishal Suvagia via mugdha)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/df108137
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/df108137
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/df108137

Branch: refs/heads/branch-feature-AMBARI-22008
Commit: df1081378e51c309589540673e140faaf9329ee4
Parents: 499fec3
Author: Vishal Suvagia <vi...@yahoo.com>
Authored: Sat Oct 14 16:22:31 2017 +0530
Committer: Mugdha Varadkar <mu...@apache.org>
Committed: Mon Oct 16 11:15:23 2017 +0530

----------------------------------------------------------------------
 .../AtlasProxyUserConfigCalculation.java        |  48 +++++++++
 .../HDP/2.5/upgrades/nonrolling-upgrade-2.6.xml |   4 +
 .../stacks/HDP/2.5/upgrades/upgrade-2.6.xml     |   3 +
 .../configuration/application-properties.xml    |  15 +++
 .../stacks/HDP/2.6/services/stack_advisor.py    |   7 ++
 .../HDP/2.6/upgrades/nonrolling-upgrade-2.6.xml |   4 +
 .../stacks/HDP/2.6/upgrades/upgrade-2.6.xml     |   3 +
 .../AtlasProxyUserConfigCalculationTest.java    | 108 +++++++++++++++++++
 .../stacks/2.6/common/test_stack_advisor.py     |   3 +-
 9 files changed, 194 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/df108137/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/AtlasProxyUserConfigCalculation.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/AtlasProxyUserConfigCalculation.java b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/AtlasProxyUserConfigCalculation.java
new file mode 100644
index 0000000..85fb200
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/AtlasProxyUserConfigCalculation.java
@@ -0,0 +1,48 @@
+package org.apache.ambari.server.serveraction.upgrades;
+
+import org.apache.ambari.server.AmbariException;
+import org.apache.ambari.server.actionmanager.HostRoleStatus;
+import org.apache.ambari.server.agent.CommandReport;
+import org.apache.ambari.server.serveraction.AbstractServerAction;
+import org.apache.ambari.server.state.Cluster;
+import org.apache.ambari.server.state.Clusters;
+import org.apache.ambari.server.state.Config;
+
+import javax.inject.Inject;
+import java.text.MessageFormat;
+import java.util.Map;
+import java.util.concurrent.ConcurrentMap;
+
+public class AtlasProxyUserConfigCalculation extends AbstractUpgradeServerAction {
+
+  private static final String ATLAS_APPLICATION_PROPERTIES_CONFIG_TYPE = "application-properties";
+  private static final String KNOX_ENV_CONFIG_TYPE = "knox-env";
+  private static final String KNOX_USER_CONFIG = "knox_user";
+
+  @Override
+  public CommandReport execute(ConcurrentMap<String, Object> requestSharedDataContext) throws AmbariException, InterruptedException {
+    String clusterName = getExecutionCommand().getClusterName();
+    Cluster cluster = getClusters().getCluster(clusterName);
+    String outputMessage = "";
+
+    Config atlasApplicationProperties = cluster.getDesiredConfigByType(ATLAS_APPLICATION_PROPERTIES_CONFIG_TYPE);
+    if (null == atlasApplicationProperties) {
+      return createCommandReport(0, HostRoleStatus.COMPLETED, "{}",
+        MessageFormat.format("Config type {0} not found, skipping updating property in same.", ATLAS_APPLICATION_PROPERTIES_CONFIG_TYPE), "");
+    }
+
+    Config knoxEnvConfig = cluster.getDesiredConfigByType(KNOX_ENV_CONFIG_TYPE);
+    String atlasProxyUsers = "knox";
+    if (null != knoxEnvConfig && knoxEnvConfig.getProperties().containsKey(KNOX_USER_CONFIG)) {
+      atlasProxyUsers = knoxEnvConfig.getProperties().get(KNOX_USER_CONFIG);
+    }
+
+    Map<String, String> currentAtlasApplicationProperties = atlasApplicationProperties.getProperties();
+    currentAtlasApplicationProperties.put("atlas.proxyusers", atlasProxyUsers);
+    atlasApplicationProperties.setProperties(currentAtlasApplicationProperties);
+    atlasApplicationProperties.save();
+
+    outputMessage = outputMessage + MessageFormat.format("Successfully updated {0} config type.\n", ATLAS_APPLICATION_PROPERTIES_CONFIG_TYPE);
+    return createCommandReport(0, HostRoleStatus.COMPLETED, "{}", outputMessage, "");
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/df108137/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.6.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.6.xml b/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.6.xml
index 1af3b18..cd69a9c 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.6.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.6.xml
@@ -488,6 +488,10 @@
         <task xsi:type="configure" id="atlas_log4j_update_logger_settings"/>
       </execute-stage>
 
+      <execute-stage service="ATLAS" component="ATLAS_SERVER" title="Applying Atlas proxy-user configurations.">
+        <task xsi:type="server_action" class="org.apache.ambari.server.serveraction.upgrades.AtlasProxyUserConfigCalculation"/>
+      </execute-stage>
+
       <!--KAFKA-->
       <execute-stage service="KAFKA" component="KAFKA_BROKER" title="Parameterizing Kafka Log4J Properties">
         <task xsi:type="configure" id="kafka_log4j_parameterize">

http://git-wip-us.apache.org/repos/asf/ambari/blob/df108137/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/upgrade-2.6.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/upgrade-2.6.xml b/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/upgrade-2.6.xml
index 0a01a04..a6d3f29 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/upgrade-2.6.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/upgrade-2.6.xml
@@ -1123,6 +1123,9 @@
           <task xsi:type="configure" id="atlas_env_gc_worker"/>
           <task xsi:type="configure" id="hdp_2_6_atlas_kafka_auto_commit_enable_property_delete"/>
           <task xsi:type="configure" id="atlas_log4j_update_logger_settings"/>
+          <task xsi:type="server_action" class="org.apache.ambari.server.serveraction.upgrades.AtlasProxyUserConfigCalculation" >
+            <summary>Applying Atlas proxy-user configurations.</summary>
+          </task>
         </pre-upgrade>
         <pre-downgrade />
         <upgrade>

http://git-wip-us.apache.org/repos/asf/ambari/blob/df108137/ambari-server/src/main/resources/stacks/HDP/2.6/services/ATLAS/configuration/application-properties.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/services/ATLAS/configuration/application-properties.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/services/ATLAS/configuration/application-properties.xml
index c271dc3..523cb21 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.6/services/ATLAS/configuration/application-properties.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/services/ATLAS/configuration/application-properties.xml
@@ -109,4 +109,19 @@
     <deleted>true</deleted>
     <on-ambari-upgrade add="false"/>
   </property>
+  <property>
+    <name>atlas.proxyusers</name>
+    <value/>
+    <description>Proxy users for Atlas</description>
+    <value-attributes>
+      <empty-value-valid>true</empty-value-valid>
+    </value-attributes>
+    <depends-on>
+      <property>
+        <type>knox-env</type>
+        <name>knox_user</name>
+      </property>
+    </depends-on>
+    <on-ambari-upgrade add="false"/>
+  </property>
 </configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/df108137/ambari-server/src/main/resources/stacks/HDP/2.6/services/stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/services/stack_advisor.py b/ambari-server/src/main/resources/stacks/HDP/2.6/services/stack_advisor.py
index 94f28db..fc12d37 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.6/services/stack_advisor.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/services/stack_advisor.py
@@ -83,6 +83,13 @@ class HDP26StackAdvisor(HDP25StackAdvisor):
         knox_port = services['configurations']["gateway-site"]["properties"]['gateway.port']
       putAtlasApplicationProperty('atlas.sso.knox.providerurl', 'https://{0}:{1}/gateway/knoxsso/api/v1/websso'.format(knox_host, knox_port))
 
+    knox_service_user = ''
+    if 'KNOX' in servicesList and 'knox-env' in services['configurations']:
+      knox_service_user = services['configurations']['knox-env']['properties']['knox_user']
+    else:
+      knox_service_user = 'knox'
+    putAtlasApplicationProperty('atlas.proxyusers',knox_service_user)
+
   def recommendDruidConfigurations(self, configurations, clusterData, services, hosts):
 
       # druid is not in list of services to be installed

http://git-wip-us.apache.org/repos/asf/ambari/blob/df108137/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/nonrolling-upgrade-2.6.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/nonrolling-upgrade-2.6.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/nonrolling-upgrade-2.6.xml
index ebb81d9..832c505 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/nonrolling-upgrade-2.6.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/nonrolling-upgrade-2.6.xml
@@ -376,6 +376,10 @@
         <task xsi:type="configure" id="atlas_hbase_conf_dir"/>
       </execute-stage>
 
+      <execute-stage service="ATLAS" component="ATLAS_SERVER" title="Applying Atlas proxy-user configurations.">
+        <task xsi:type="server_action" class="org.apache.ambari.server.serveraction.upgrades.AtlasProxyUserConfigCalculation"/>
+      </execute-stage>
+
       <!-- KMS -->
       <execute-stage service="RANGER_KMS" component="RANGER_KMS_SERVER" title="Apply config changes for Ranger Kms plugin">
         <task xsi:type="configure" id="hdp_2_6_maint_ranger_kms_plugin_cluster_name"/>

http://git-wip-us.apache.org/repos/asf/ambari/blob/df108137/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/upgrade-2.6.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/upgrade-2.6.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/upgrade-2.6.xml
index ae5972e..d0e11a1 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/upgrade-2.6.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/upgrade-2.6.xml
@@ -1050,6 +1050,9 @@
           <task xsi:type="configure" id="hdp_2_6_atlas_kafka_auto_commit_enable_property_delete"/>
           <task xsi:type="configure" id="atlas_log4j_update_logger_settings"/>
           <task xsi:type="configure" id="atlas_hbase_conf_dir"/>
+          <task xsi:type="server_action" class="org.apache.ambari.server.serveraction.upgrades.AtlasProxyUserConfigCalculation" >
+            <summary>Applying Atlas proxy-user configurations.</summary>
+          </task>
         </pre-upgrade>
         <pre-downgrade/> <!--  no-op to prevent config changes on downgrade -->
         <upgrade>

http://git-wip-us.apache.org/repos/asf/ambari/blob/df108137/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/AtlasProxyUserConfigCalculationTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/AtlasProxyUserConfigCalculationTest.java b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/AtlasProxyUserConfigCalculationTest.java
new file mode 100644
index 0000000..3f8bca9
--- /dev/null
+++ b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/AtlasProxyUserConfigCalculationTest.java
@@ -0,0 +1,108 @@
+package org.apache.ambari.server.serveraction.upgrades;
+
+import com.google.inject.Injector;
+import org.apache.ambari.server.actionmanager.ExecutionCommandWrapper;
+import org.apache.ambari.server.actionmanager.HostRoleCommand;
+import org.apache.ambari.server.agent.CommandReport;
+import org.apache.ambari.server.agent.ExecutionCommand;
+import org.apache.ambari.server.state.Cluster;
+import org.apache.ambari.server.state.Clusters;
+import org.apache.ambari.server.state.Config;
+import org.easymock.EasyMock;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.lang.reflect.Field;
+import java.util.HashMap;
+import java.util.Map;
+
+import static org.easymock.EasyMock.*;
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.expectLastCall;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+public class AtlasProxyUserConfigCalculationTest {
+
+  private Injector m_injector;
+  private Clusters m_clusters;
+  private Field m_clusterField;
+
+  @Before
+  public void setup() throws Exception {
+    m_injector = createMock(Injector.class);
+    m_clusters = createMock(Clusters.class);
+    Cluster cluster = createMock(Cluster.class);
+
+    Map<String, String> mockKnoxEnvProperties = new HashMap<String, String>() {
+      {
+        put("knox_user", "knox_cstm");
+      }
+    };
+
+    Map<String, String> mockAtlasApplicationProperties = new HashMap<String, String>();
+
+    Config knoxEnvConfig = createMock(Config.class);
+    expect(knoxEnvConfig.getType()).andReturn("knox-env").anyTimes();
+    expect(knoxEnvConfig.getProperties()).andReturn(mockKnoxEnvProperties).anyTimes();
+
+
+    Config atlasApplicationPropertiesConfig = createMock(Config.class);
+    expect(atlasApplicationPropertiesConfig.getType()).andReturn("application-properties").anyTimes();
+    expect(atlasApplicationPropertiesConfig.getProperties()).andReturn(mockAtlasApplicationProperties).anyTimes();
+
+
+    atlasApplicationPropertiesConfig.setProperties(anyObject(Map.class));
+    expectLastCall().atLeastOnce();
+
+    atlasApplicationPropertiesConfig.save();
+    expectLastCall().atLeastOnce();
+
+    expect(cluster.getDesiredConfigByType("knox-env")).andReturn(knoxEnvConfig).atLeastOnce();
+    expect(cluster.getDesiredConfigByType("application-properties")).andReturn(atlasApplicationPropertiesConfig).atLeastOnce();
+    expect(m_clusters.getCluster((String) anyObject())).andReturn(cluster).anyTimes();
+    expect(m_injector.getInstance(Clusters.class)).andReturn(m_clusters).atLeastOnce();
+
+    replay(m_injector, m_clusters, cluster, knoxEnvConfig, atlasApplicationPropertiesConfig);
+
+    m_clusterField = AbstractUpgradeServerAction.class.getDeclaredField("m_clusters");
+    m_clusterField.setAccessible(true);
+
+  }
+
+  @Test
+  public void testAction() throws Exception {
+
+    Map<String, String> commandParams = new HashMap<String, String>();
+    commandParams.put("clusterName", "cl1");
+
+    ExecutionCommand executionCommand = new ExecutionCommand();
+    executionCommand.setCommandParams(commandParams);
+    executionCommand.setClusterName("cl1");
+
+    HostRoleCommand hrc = createMock(HostRoleCommand.class);
+    expect(hrc.getRequestId()).andReturn(1L).anyTimes();
+    expect(hrc.getStageId()).andReturn(2L).anyTimes();
+    expect(hrc.getExecutionCommandWrapper()).andReturn(new ExecutionCommandWrapper(executionCommand)).anyTimes();
+    replay(hrc);
+
+    AtlasProxyUserConfigCalculation action = new AtlasProxyUserConfigCalculation();
+    m_clusterField.set(action, m_clusters);
+    action.setExecutionCommand(executionCommand);
+    action.setHostRoleCommand(hrc);
+
+    CommandReport report = action.execute(null);
+    Assert.assertNotNull(report);
+
+    Cluster cl = m_clusters.getCluster("cl1");
+    Config config = cl.getDesiredConfigByType("application-properties");
+    Map<String, String> map = config.getProperties();
+
+    Assert.assertTrue(map.containsKey("atlas.proxyusers"));
+    Assert.assertEquals("knox_cstm", map.get("atlas.proxyusers"));
+
+    report = action.execute(null);
+    Assert.assertNotNull(report);
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/df108137/ambari-server/src/test/python/stacks/2.6/common/test_stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.6/common/test_stack_advisor.py b/ambari-server/src/test/python/stacks/2.6/common/test_stack_advisor.py
index ade08c1..f4c5508 100644
--- a/ambari-server/src/test/python/stacks/2.6/common/test_stack_advisor.py
+++ b/ambari-server/src/test/python/stacks/2.6/common/test_stack_advisor.py
@@ -1303,7 +1303,8 @@ class TestHDP26StackAdvisor(TestCase):
           "atlas.graph.storage.hostname": "",
           "atlas.kafka.bootstrap.servers": "",
           "atlas.kafka.zookeeper.connect": "",
-          "atlas.authorizer.impl": "simple"
+          "atlas.authorizer.impl": "simple",
+          'atlas.proxyusers': 'knox'
         }
       },
       "infra-solr-env": {


[11/50] ambari git commit: AMBARI-22191. Account for merge buffers while calculating druid processing buffer size. (nishantmonu51)

Posted by am...@apache.org.
AMBARI-22191. Account for merge buffers while calculating druid processing buffer size. (nishantmonu51)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/85fb356c
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/85fb356c
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/85fb356c

Branch: refs/heads/branch-feature-AMBARI-22008
Commit: 85fb356ccd13669359810e767da14d014018bac9
Parents: c100197
Author: Nishant <ni...@gmail.com>
Authored: Thu Oct 12 02:58:58 2017 +0530
Committer: Nishant <ni...@gmail.com>
Committed: Thu Oct 12 02:58:58 2017 +0530

----------------------------------------------------------------------
 .../resources/stacks/HDP/2.6/services/stack_advisor.py  |  2 +-
 .../test/python/stacks/2.6/common/test_stack_advisor.py | 12 ++++++------
 2 files changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/85fb356c/ambari-server/src/main/resources/stacks/HDP/2.6/services/stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/services/stack_advisor.py b/ambari-server/src/main/resources/stacks/HDP/2.6/services/stack_advisor.py
index 38af525..94f28db 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.6/services/stack_advisor.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/services/stack_advisor.py
@@ -159,7 +159,7 @@ class HDP26StackAdvisor(HDP25StackAdvisor):
               putComponentProperty('druid.processing.numMergeBuffers', numMergeBuffers)
               totalAvailableMemInMb = self.getMinMemory(component_hosts) / 1024
               maxAvailableBufferSizeInMb = totalAvailableMemInMb/(processingThreads + numMergeBuffers)
-              putComponentProperty('druid.processing.buffer.sizeBytes', self.getDruidProcessingBufferSizeInMb(totalAvailableMemInMb) * 1024 * 1024)
+              putComponentProperty('druid.processing.buffer.sizeBytes', self.getDruidProcessingBufferSizeInMb(maxAvailableBufferSizeInMb) * 1024 * 1024)
 
 
   # returns the recommended druid processing buffer size in Mb.

http://git-wip-us.apache.org/repos/asf/ambari/blob/85fb356c/ambari-server/src/test/python/stacks/2.6/common/test_stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.6/common/test_stack_advisor.py b/ambari-server/src/test/python/stacks/2.6/common/test_stack_advisor.py
index 1c937b7..ade08c1 100644
--- a/ambari-server/src/test/python/stacks/2.6/common/test_stack_advisor.py
+++ b/ambari-server/src/test/python/stacks/2.6/common/test_stack_advisor.py
@@ -985,7 +985,7 @@ class TestHDP26StackAdvisor(TestCase):
           "href": "/api/v1/hosts/c6402.ambari.apache.org",
           "Hosts": {
             "cpu_count": 1,
-            "total_mem": 1922680,
+            "total_mem": 622680,
             "disk_info": [
               {"mountpoint": "/"},
               {"mountpoint": "/dev/shm"},
@@ -1091,12 +1091,12 @@ class TestHDP26StackAdvisor(TestCase):
                         'properties': {'druid.processing.numThreads': '2',
                                        'druid.server.http.numThreads': '40',
                                        'druid.processing.numMergeBuffers': '2',
-                                       'druid.processing.buffer.sizeBytes': '536870912'}},
+                                       'druid.processing.buffer.sizeBytes': '134217728'}},
                         'druid-broker': {
                           'properties': {'druid.processing.numThreads': '1',
                                          'druid.server.http.numThreads': '40',
                                          'druid.processing.numMergeBuffers': '2',
-                                         'druid.processing.buffer.sizeBytes': '268435456'}},
+                                         'druid.processing.buffer.sizeBytes': '67108864'}},
                         'druid-common': {'properties': {'druid.extensions.loadList': '[]',
                                                         'druid.metadata.storage.connector.port': '1527',
                                                         'druid.metadata.storage.connector.connectURI': 'jdbc:derby://c6401.ambari.apache.org:1527/druid;create=true',
@@ -1108,7 +1108,7 @@ class TestHDP26StackAdvisor(TestCase):
                                                               'druid.middlemanager.jvm.heap.memory': {
                                                                 'maximum': '49152'},
                                                               'druid.historical.jvm.heap.memory': {'maximum': '3755'},
-                                                              'druid.broker.jvm.heap.memory': {'maximum': '1877'}}}}
+                                                              'druid.broker.jvm.heap.memory': {'maximum': '1024'}}}}
                       )
 
   def test_recommendDruidConfigurations_low_mem_hosts(self):
@@ -1240,12 +1240,12 @@ class TestHDP26StackAdvisor(TestCase):
                       'properties': {'druid.processing.numThreads': '5',
                                      'druid.server.http.numThreads': '40',
                                      'druid.processing.numMergeBuffers': '2',
-                                     'druid.processing.buffer.sizeBytes': '67108864'}},
+                                     'druid.processing.buffer.sizeBytes': '14680064'}},
                       'druid-broker': {
                         'properties': {'druid.processing.numThreads': '3',
                                        'druid.server.http.numThreads': '40',
                                        'druid.processing.numMergeBuffers': '2',
-                                       'druid.processing.buffer.sizeBytes': '67108864'}},
+                                       'druid.processing.buffer.sizeBytes': '41943040'}},
                       'druid-common': {'properties': {'druid.extensions.loadList': '[]',
                                                       'druid.metadata.storage.connector.port': '1527',
                                                       'druid.metadata.storage.connector.connectURI': 'jdbc:derby://c6401.ambari.apache.org:1527/druid;create=true',


[47/50] ambari git commit: AMBARI-22115. Alerts for OneFS mpack (amagyar)

Posted by am...@apache.org.
AMBARI-22115. Alerts for OneFS mpack (amagyar)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/b552da9e
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/b552da9e
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/b552da9e

Branch: refs/heads/branch-feature-AMBARI-22008
Commit: b552da9e100d2c94eb74a5634ce08c16ad9656e7
Parents: 7eb5cd4
Author: Attila Magyar <am...@hortonworks.com>
Authored: Thu Oct 12 15:21:13 2017 +0200
Committer: Attila Magyar <am...@hortonworks.com>
Committed: Tue Oct 17 16:52:56 2017 +0200

----------------------------------------------------------------------
 ambari-server/docs/configuration/index.md       |   1 +
 .../server/alerts/JmxServerSideAlert.java       | 104 +++++++++++++++++++
 .../apache/ambari/server/alerts/Threshold.java  |  73 +++++++++++++
 .../server/configuration/Configuration.java     |  11 ++
 .../server/controller/ControllerModule.java     |   1 +
 .../server/controller/jmx/JMXMetricHolder.java  |  27 +++++
 .../org/apache/ambari/server/state/Alert.java   |   1 +
 .../ambari/server/state/alert/AlertUri.java     |  41 ++++++++
 .../ambari/server/state/alert/MetricSource.java |   7 ++
 .../ambari/server/state/alert/Reporting.java    |  43 ++++++++
 .../ambari/server/state/alert/ServerSource.java |  15 +++
 .../services/AmbariServerAlertService.java      |   7 +-
 .../ambari/server/alerts/ThresholdTest.java     |  90 ++++++++++++++++
 .../controller/jmx/JMXMetricHolderTest.java     |  61 +++++++++++
 .../ambari/server/state/alert/AlertUriTest.java |  60 +++++++++++
 15 files changed, 541 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/b552da9e/ambari-server/docs/configuration/index.md
----------------------------------------------------------------------
diff --git a/ambari-server/docs/configuration/index.md b/ambari-server/docs/configuration/index.md
index 9dbe9c4..8f1531b 100644
--- a/ambari-server/docs/configuration/index.md
+++ b/ambari-server/docs/configuration/index.md
@@ -57,6 +57,7 @@ The following are the properties which can be used to configure Ambari.
 | alerts.execution.scheduler.threadpool.size.core | The core number of threads used to process incoming alert events. The value should be increased as the size of the cluster increases. |`2` | 
 | alerts.execution.scheduler.threadpool.size.max | The number of threads used to handle alerts received from the Ambari Agents. The value should be increased as the size of the cluster increases. |`2` | 
 | alerts.execution.scheduler.threadpool.worker.size | The number of queued alerts allowed before discarding old alerts which have not been handled. The value should be increased as the size of the cluster increases. |`2000` | 
+| alerts.server.side.scheduler.threadpool.size.core | The core pool size of the executor service that runs server side alerts. |`4` | 
 | alerts.snmp.dispatcher.udp.port | The UDP port to use when binding the SNMP dispatcher on Ambari Server startup. If no port is specified, then a random port will be used. | | 
 | alerts.template.file | The full path to the XML file that describes the different alert templates. | | 
 | ambari.display.url | The URL to use when creating messages which should include the Ambari Server URL.<br/><br/>The following are examples of valid values:<ul><li>`http://ambari.apache.org:8080`</ul> | | 

http://git-wip-us.apache.org/repos/asf/ambari/blob/b552da9e/ambari-server/src/main/java/org/apache/ambari/server/alerts/JmxServerSideAlert.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/alerts/JmxServerSideAlert.java b/ambari-server/src/main/java/org/apache/ambari/server/alerts/JmxServerSideAlert.java
new file mode 100644
index 0000000..a4b86f8
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/alerts/JmxServerSideAlert.java
@@ -0,0 +1,104 @@
+/*
+ * 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.alerts;
+
+import static java.util.Collections.emptyList;
+import static java.util.Collections.singletonList;
+
+import java.net.URI;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.ambari.server.AmbariException;
+import org.apache.ambari.server.configuration.ComponentSSLConfiguration;
+import org.apache.ambari.server.controller.internal.URLStreamProvider;
+import org.apache.ambari.server.controller.jmx.JMXMetricHolder;
+import org.apache.ambari.server.orm.entities.AlertDefinitionEntity;
+import org.apache.ambari.server.state.Alert;
+import org.apache.ambari.server.state.Cluster;
+import org.apache.ambari.server.state.ConfigHelper;
+import org.apache.ambari.server.state.alert.AlertDefinition;
+import org.apache.ambari.server.state.alert.AlertDefinitionFactory;
+import org.apache.ambari.server.state.alert.MetricSource;
+import org.apache.ambari.server.state.alert.Reporting;
+import org.apache.ambari.server.state.alert.ServerSource;
+import org.apache.ambari.server.state.services.MetricsRetrievalService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.inject.Inject;
+
+/**
+ * I represent a "SERVER" {@link org.apache.ambari.server.state.alert.SourceType} alert
+ * which can pull JMX metrics from a remote cluster.
+ */
+public class JmxServerSideAlert extends AlertRunnable {
+  private final static Logger LOG = LoggerFactory.getLogger(JmxServerSideAlert.class);
+  @Inject
+  private AlertDefinitionFactory definitionFactory;
+  @Inject
+  private MetricsRetrievalService metricsRetrievalService;
+  @Inject
+  private ConfigHelper configHelper;
+
+  public JmxServerSideAlert(String definitionName) {
+    super(definitionName);
+  }
+
+  @Override
+  List<Alert> execute(Cluster cluster, AlertDefinitionEntity entity) throws AmbariException {
+    AlertDefinition alertDef = definitionFactory.coerce(entity);
+    ServerSource serverSource = (ServerSource) alertDef.getSource();
+    URI jmxUrl = jmxUrl(cluster, serverSource);
+    JMXMetricHolder metricHolder = jmxMetric(serverSource, jmxUrl);
+    return metricHolder == null
+      ? emptyList()
+      : alerts(alertDef, serverSource.getJmxInfo(), metricHolder, serverSource.getReporting());
+  }
+
+  private URI jmxUrl(Cluster cluster, ServerSource serverSource) throws AmbariException {
+    return serverSource.getUri().resolve(config(cluster)).resolve(serverSource.getJmxInfo().getUrlSuffix());
+  }
+
+  private Map<String, Map<String, String>> config(Cluster cluster) throws AmbariException {
+    return configHelper.getEffectiveConfigProperties(cluster, configHelper.getEffectiveDesiredTags(cluster, null));
+  }
+
+  private JMXMetricHolder jmxMetric(ServerSource serverSource, URI jmxUri) {
+    URLStreamProvider streamProvider = new URLStreamProvider(
+      serverSource.getUri().getConnectionTimeoutMsec(),
+      serverSource.getUri().getReadTimeoutMsec(),
+      ComponentSSLConfiguration.instance());
+    metricsRetrievalService.submitRequest(MetricsRetrievalService.MetricSourceType.JMX, streamProvider, jmxUri.toString());
+    return metricsRetrievalService.getCachedJMXMetric(jmxUri.toString());
+  }
+
+  private List<Alert> alerts(AlertDefinition alertDef, MetricSource.JmxInfo jmxInfo, JMXMetricHolder jmxMetricHolder, Reporting reporting) throws AmbariException {
+    List<Object> metrics = jmxMetricHolder.findAll(jmxInfo.getPropertyList());
+    if (metrics.isEmpty()) {
+      return emptyList();
+    }
+    if (metrics.get(0) instanceof Number) {
+      Alert alert = reporting.alert(((Number) metrics.get(0)).doubleValue(), metrics, alertDef);
+      return singletonList(alert);
+    } else {
+      LOG.info("Unsupported metrics value: {} when running alert: {}", metrics.get(0), alertDef);
+      return emptyList();
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/b552da9e/ambari-server/src/main/java/org/apache/ambari/server/alerts/Threshold.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/alerts/Threshold.java b/ambari-server/src/main/java/org/apache/ambari/server/alerts/Threshold.java
new file mode 100644
index 0000000..ae33eeb
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/alerts/Threshold.java
@@ -0,0 +1,73 @@
+/*
+ * 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.alerts;
+
+import javax.annotation.Nullable;
+
+import org.apache.ambari.server.state.AlertState;
+
+/**
+ * I'm a 3 level threshold where each level corresponds to ok, warn and critical levels.
+ * The levels are either increasing or decreasing numerical sequences.
+ * My main responsibility is to map incoming values to {@link AlertState} based on the threshold levels.
+ */
+public class Threshold {
+  private final Double okValue;
+  private final double warnValue;
+  private final double critValue;
+
+  public Threshold(@Nullable Double okValue, double warnValue, double critValue) {
+    this.okValue = okValue;
+    this.warnValue = warnValue;
+    this.critValue = critValue;
+  }
+
+  public AlertState state(double value) {
+    return directionUp() ? stateWhenDirectionUp(value) : stateWhenDirectionDown(value);
+  }
+
+  private boolean directionUp() {
+    return critValue >= warnValue;
+  }
+
+  private AlertState stateWhenDirectionUp(double value) {
+    if (value >= critValue) {
+      return AlertState.CRITICAL;
+    }
+    if (value >= warnValue) {
+      return AlertState.WARNING;
+    }
+    if (okValue == null || value >= okValue) {
+      return AlertState.OK;
+    }
+    return AlertState.UNKNOWN;
+  }
+
+  private AlertState stateWhenDirectionDown(double value) {
+    if (value <= critValue) {
+      return AlertState.CRITICAL;
+    }
+    if (value <= warnValue) {
+      return AlertState.WARNING;
+    }
+    if (okValue == null || value <= okValue) {
+      return AlertState.OK;
+    }
+    return AlertState.UNKNOWN;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/b552da9e/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 1b4d741..8bc8cbf 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
@@ -2764,6 +2764,13 @@ public class Configuration {
   public static final ConfigurationProperty<String> DISPATCH_PROPERTY_SCRIPT_DIRECTORY = new ConfigurationProperty<>(
           "notification.dispatch.alert.script.directory",AmbariPath.getPath("/var/lib/ambari-server/resources/scripts"));
 
+  /**
+   * The core pool size of the executor service that runs server side alerts.
+   */
+  @Markdown(description = "The core pool size of the executor service that runs server side alerts.")
+  public static final ConfigurationProperty<Integer> SERVER_SIDE_ALERTS_CORE_POOL_SIZE = new ConfigurationProperty<>(
+          "alerts.server.side.scheduler.threadpool.size.core", 4);
+
 
   private static final Logger LOG = LoggerFactory.getLogger(
     Configuration.class);
@@ -6193,4 +6200,8 @@ public class Configuration {
   public String getAutoGroupCreation() {
     return getProperty(AUTO_GROUP_CREATION);
   }
+
+  public int getAlertServiceCorePoolSize() {
+    return Integer.parseInt(getProperty(SERVER_SIDE_ALERTS_CORE_POOL_SIZE));
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/b552da9e/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 dc97871..76cd22e 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
@@ -358,6 +358,7 @@ public class ControllerModule extends AbstractModule {
     // So it's an "additional time", given to stage to finish execution before
     // it is considered as timed out
     bindConstant().annotatedWith(Names.named("actionTimeout")).to(600000L);
+    bindConstant().annotatedWith(Names.named("alertServiceCorePoolSize")).to(configuration.getAlertServiceCorePoolSize());
 
     bindConstant().annotatedWith(Names.named("dbInitNeeded")).to(dbInitNeeded);
     bindConstant().annotatedWith(Names.named("statusCheckInterval")).to(5000L);

http://git-wip-us.apache.org/repos/asf/ambari/blob/b552da9e/ambari-server/src/main/java/org/apache/ambari/server/controller/jmx/JMXMetricHolder.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/jmx/JMXMetricHolder.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/jmx/JMXMetricHolder.java
index 81d72fb..f6ae54f 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/jmx/JMXMetricHolder.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/jmx/JMXMetricHolder.java
@@ -18,13 +18,18 @@
 
 package org.apache.ambari.server.controller.jmx;
 
+import static java.util.stream.Collectors.toList;
+
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
 
 /**
  *
  */
 public final class JMXMetricHolder {
+  private static final String NAME_KEY = "name";
 
   private List<Map<String, Object>> beans;
 
@@ -47,4 +52,26 @@ public final class JMXMetricHolder {
     }
     return stringBuilder.toString();
   }
+
+  public List<Object> findAll(List<String> properties) {
+    return properties.stream()
+      .map(this::find)
+      .filter(Optional::isPresent)
+      .map(Optional::get)
+      .collect(toList());
+  }
+
+  public Optional<Object> find(String property) {
+    String propertyName = property.split("/")[0];
+    String propertyValue = property.split("/")[1];
+    return beans.stream()
+      .filter(each -> propertyName.equals(name(each)))
+      .map(each -> each.get(propertyValue))
+      .filter(Objects::nonNull)
+      .findFirst();
+  }
+
+  private String name(Map<String, Object> bean) {
+    return bean.containsKey(NAME_KEY) ? (String) bean.get(NAME_KEY) : null;
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/b552da9e/ambari-server/src/main/java/org/apache/ambari/server/state/Alert.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/Alert.java b/ambari-server/src/main/java/org/apache/ambari/server/state/Alert.java
index 5d2ecc6..49bd5d2 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/Alert.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/Alert.java
@@ -56,6 +56,7 @@ public class Alert {
     component = componentName;
     this.hostName = hostName;
     state = alertState;
+    timestamp = System.currentTimeMillis();
   }
 
   public Alert() {

http://git-wip-us.apache.org/repos/asf/ambari/blob/b552da9e/ambari-server/src/main/java/org/apache/ambari/server/state/alert/AlertUri.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/alert/AlertUri.java b/ambari-server/src/main/java/org/apache/ambari/server/state/alert/AlertUri.java
index 93801d5..b3ef2de 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/alert/AlertUri.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/alert/AlertUri.java
@@ -17,8 +17,13 @@
  */
 package org.apache.ambari.server.state.alert;
 
+import java.net.URI;
+import java.util.Map;
 import java.util.Set;
 
+import org.apache.ambari.server.AmbariException;
+import org.apache.ambari.server.state.kerberos.VariableReplacementHelper;
+
 import com.google.gson.annotations.SerializedName;
 
 /**
@@ -87,6 +92,13 @@ public class AlertUri {
   @SerializedName("connection_timeout")
   private float m_connectionTimeout = 5.0f;
 
+
+  /**
+   * An optional read timeout value for connections.
+   */
+  @SerializedName("read_timeout")
+  private float readTimeout = 15.0f;
+
   /**
    * If present, then the component supports HA mode and the properties
    * contained within need to be checked to see if an HA URI is required to be
@@ -117,6 +129,18 @@ public class AlertUri {
     m_httpUri = httpUri;
   }
 
+  public void setHttpsUri(String httpsUri) {
+    this.m_httpsUri = httpsUri;
+  }
+
+  public void setHttpsPropertyValue(String m_httpsPropertyValue) {
+    this.m_httpsPropertyValue = m_httpsPropertyValue;
+  }
+
+  public void setHttpsProperty(String m_httpsProperty) {
+    this.m_httpsProperty = m_httpsProperty;
+  }
+
   /**
    * Gets the default port to use on the host running the alert if none of the
    * http properties are available.
@@ -276,6 +300,23 @@ public class AlertUri {
     }
   }
 
+  public URI resolve(Map<String, Map<String, String>> config) throws AmbariException {
+    VariableReplacementHelper variableReplacer = new VariableReplacementHelper();
+    String httpsProperty = variableReplacer.replaceVariables(m_httpsProperty, config);
+    String httpsPropertyValue = variableReplacer.replaceVariables(m_httpsPropertyValue, config);
+    return httpsProperty == null || !httpsProperty.equals(httpsPropertyValue)
+      ? URI.create(String.format("http://%s", variableReplacer.replaceVariables(m_httpUri, config)))
+      : URI.create(String.format("https://%s", variableReplacer.replaceVariables(m_httpsUri, config)));
+  }
+
+  public int getConnectionTimeoutMsec() {
+    return (int) m_connectionTimeout * 1000;
+  }
+
+  public int getReadTimeoutMsec() {
+    return (int) readTimeout * 1000;
+  }
+
   /**
    * {@inheritDoc}
    */

http://git-wip-us.apache.org/repos/asf/ambari/blob/b552da9e/ambari-server/src/main/java/org/apache/ambari/server/state/alert/MetricSource.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/alert/MetricSource.java b/ambari-server/src/main/java/org/apache/ambari/server/state/alert/MetricSource.java
index 11eee05..d7283fe 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/alert/MetricSource.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/alert/MetricSource.java
@@ -129,6 +129,9 @@ public class MetricSource extends Source {
 
     private String value;
 
+    @SerializedName("url_suffix")
+    private String urlSuffix = "/jmx";
+
     public List<String> getPropertyList() {
       return propertyList;
     }
@@ -152,5 +155,9 @@ public class MetricSource extends Source {
       return list1.equals(list2);
 
     }
+
+    public String getUrlSuffix() {
+      return urlSuffix;
+    }
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/b552da9e/ambari-server/src/main/java/org/apache/ambari/server/state/alert/Reporting.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/alert/Reporting.java b/ambari-server/src/main/java/org/apache/ambari/server/state/alert/Reporting.java
index 4aeba45..51d074e 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/alert/Reporting.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/alert/Reporting.java
@@ -17,6 +17,15 @@
  */
 package org.apache.ambari.server.state.alert;
 
+import static org.apache.ambari.server.state.alert.Reporting.ReportingType.PERCENT;
+
+import java.text.MessageFormat;
+import java.util.List;
+
+import org.apache.ambari.server.alerts.Threshold;
+import org.apache.ambari.server.state.Alert;
+import org.apache.ambari.server.state.AlertState;
+
 import com.google.gson.annotations.SerializedName;
 
 /**
@@ -200,6 +209,40 @@ public class Reporting {
   }
 
   /**
+   * Map the incoming value to {@link AlertState} and generate an alert with that state.
+   */
+  public Alert alert(double value, List<Object> args, AlertDefinition alertDef) {
+    Alert alert = new Alert(alertDef.getName(), null, alertDef.getServiceName(), alertDef.getComponentName(), null, state(value));
+    alert.setText(MessageFormat.format(message(value), args.toArray()));
+    return alert;
+  }
+
+  private AlertState state(double value) {
+    return getThreshold().state(PERCENT == getType() ? value * 100 : value);
+  }
+
+  private Threshold getThreshold() {
+    return new Threshold(getOk().getValue(), getWarning().getValue(), getCritical().getValue());
+  }
+
+  private String message(double value) {
+    switch (state(value)) {
+      case OK:
+        return getOk().getText();
+      case WARNING:
+        return getWarning().getText();
+      case CRITICAL:
+        return getCritical().getText();
+      case UNKNOWN:
+        return "Unknown";
+      case SKIPPED:
+        return "Skipped";
+      default:
+        throw new IllegalStateException("Invalid alert state: " + state(value));
+    }
+  }
+
+  /**
    * The {@link ReportTemplate} class is used to pair a label and threshhold
    * value.
    * <p/>

http://git-wip-us.apache.org/repos/asf/ambari/blob/b552da9e/ambari-server/src/main/java/org/apache/ambari/server/state/alert/ServerSource.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/alert/ServerSource.java b/ambari-server/src/main/java/org/apache/ambari/server/state/alert/ServerSource.java
index c58867a..765bdea 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/alert/ServerSource.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/alert/ServerSource.java
@@ -28,6 +28,13 @@ public class ServerSource extends ParameterizedSource {
   @SerializedName("class")
   private String m_class;
 
+  @SerializedName("uri")
+  private AlertUri uri = null;
+
+  @SerializedName("jmx")
+  private MetricSource.JmxInfo jmxInfo = null;
+
+
   /**
    * Gets the fully qualified classname specified in the source.
    */
@@ -35,6 +42,14 @@ public class ServerSource extends ParameterizedSource {
     return m_class;
   }
 
+  public MetricSource.JmxInfo getJmxInfo() {
+    return jmxInfo;
+  }
+
+  public AlertUri getUri() {
+    return uri;
+  }
+
   /**
    * {@inheritDoc}
    */

http://git-wip-us.apache.org/repos/asf/ambari/blob/b552da9e/ambari-server/src/main/java/org/apache/ambari/server/state/services/AmbariServerAlertService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/services/AmbariServerAlertService.java b/ambari-server/src/main/java/org/apache/ambari/server/state/services/AmbariServerAlertService.java
index d3237a9..d235631 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/services/AmbariServerAlertService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/services/AmbariServerAlertService.java
@@ -45,6 +45,7 @@ import com.google.common.util.concurrent.AbstractScheduledService;
 import com.google.inject.Inject;
 import com.google.inject.Injector;
 import com.google.inject.Provider;
+import com.google.inject.name.Named;
 
 /**
  * The {@link AmbariServerAlertService} is used to manage the dynamically loaded
@@ -87,7 +88,7 @@ public class AmbariServerAlertService extends AbstractScheduledService {
   /**
    * The executor to use to run all {@link Runnable} alert classes.
    */
-  private final ScheduledExecutorService m_scheduledExecutorService = Executors.newScheduledThreadPool(3);
+  private ScheduledExecutorService m_scheduledExecutorService;
 
   /**
    * A map of all of the definition names to {@link ScheduledFuture}s.
@@ -101,6 +102,10 @@ public class AmbariServerAlertService extends AbstractScheduledService {
   public AmbariServerAlertService() {
   }
 
+  @Inject
+  public void initExecutor(@Named("alertServiceCorePoolSize") int alertServiceCorePoolSize) {
+    this.m_scheduledExecutorService = Executors.newScheduledThreadPool(alertServiceCorePoolSize);
+  }
   /**
    * {@inheritDoc}
    */

http://git-wip-us.apache.org/repos/asf/ambari/blob/b552da9e/ambari-server/src/test/java/org/apache/ambari/server/alerts/ThresholdTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/alerts/ThresholdTest.java b/ambari-server/src/test/java/org/apache/ambari/server/alerts/ThresholdTest.java
new file mode 100644
index 0000000..07bfa03
--- /dev/null
+++ b/ambari-server/src/test/java/org/apache/ambari/server/alerts/ThresholdTest.java
@@ -0,0 +1,90 @@
+/*
+ * 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.alerts;
+
+import static org.apache.ambari.server.state.AlertState.CRITICAL;
+import static org.apache.ambari.server.state.AlertState.OK;
+import static org.apache.ambari.server.state.AlertState.UNKNOWN;
+import static org.apache.ambari.server.state.AlertState.WARNING;
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertThat;
+
+import org.apache.ambari.server.state.AlertState;
+import org.junit.Test;
+
+public class ThresholdTest {
+  @Test
+  public void testBetweenOkAndWarnIsOk_dirUp() throws Exception {
+    Threshold threshold = new Threshold(10.0, 20.0, 30.0);
+    assertState(threshold, OK, 10, 15, 19);
+  }
+
+  @Test
+  public void testBetweenWarnAndCritIsWarn_dirUp() throws Exception {
+    Threshold threshold = new Threshold(10.0, 20.0, 30.0);
+    assertState(threshold, WARNING, 20, 25, 29);
+  }
+
+  @Test
+  public void testAboveCritIsCrit_dirUp() throws Exception {
+    Threshold threshold = new Threshold(10.0, 20.0, 30.0);
+    assertState(threshold, CRITICAL, 30, 40, 99999);
+  }
+
+  @Test
+  public void testBelowOkIsUnknown_dirUp() throws Exception {
+    Threshold threshold = new Threshold(10.0, 20, 30);
+    assertState(threshold, UNKNOWN, 9, 2, -99999);
+  }
+
+  @Test
+  public void testBelowCritIsCrit_dirDown() throws Exception {
+    Threshold threshold = new Threshold(40.0, 30.0, 20.0);
+    assertState(threshold, CRITICAL, 20, 15, 2, -99999);
+  }
+
+  @Test
+  public void testBetweenWarnAndCritIsWarn_dirDown() throws Exception {
+    Threshold threshold = new Threshold(40.0, 30.0, 20.0);
+    assertState(threshold, WARNING, 30, 25, 21);
+  }
+
+  @Test
+  public void testBetweenOkAndWarnIsOk_dirDown() throws Exception {
+    Threshold threshold = new Threshold(40.0, 30.0, 20.0);
+    assertState(threshold, OK, 40, 35, 31);
+  }
+
+  @Test
+  public void testAboveOkIsUnknown_dirDown() throws Exception {
+    Threshold threshold = new Threshold(40.0, 30.0, 20.0);
+    assertState(threshold, UNKNOWN, 41, 50, 9999);
+  }
+
+  @Test
+  public void testOkIsOptional() throws Exception {
+    Threshold threshold = new Threshold(null, 20.0, 30.0);
+    assertState(threshold, OK, 10, 15, 19);
+  }
+
+  private void assertState(Threshold threshold, AlertState expectedState, int... values) {
+    for (int value: values) {
+      assertThat(expectedState, is(threshold.state(value)));
+    }
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/b552da9e/ambari-server/src/test/java/org/apache/ambari/server/controller/jmx/JMXMetricHolderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/jmx/JMXMetricHolderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/jmx/JMXMetricHolderTest.java
new file mode 100644
index 0000000..61d5bae
--- /dev/null
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/jmx/JMXMetricHolderTest.java
@@ -0,0 +1,61 @@
+/*
+ * 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.jmx;
+
+import static java.util.Arrays.asList;
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertThat;
+import static org.junit.internal.matchers.IsCollectionContaining.hasItems;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Optional;
+
+import org.junit.Before;
+import org.junit.Test;
+
+public class JMXMetricHolderTest {
+  private JMXMetricHolder metrics = new JMXMetricHolder();
+
+  @Before
+  public void setUp() {
+    metrics.setBeans(asList(
+      new HashMap<String, Object>() {{
+        put("name", "bean1");
+        put("value", "val1");
+      }},
+      new HashMap<String, Object>() {{
+        put("name", "bean2");
+        put("value", "val2");
+      }}
+    ));
+  }
+
+  @Test
+  public void testFindSingleBeanByName() throws Exception {
+    assertThat(metrics.find("bean1/value"), is(Optional.of("val1")));
+    assertThat(metrics.find("bean2/value"), is(Optional.of("val2")));
+    assertThat(metrics.find("bean3/notfound"), is(Optional.empty()));
+  }
+
+  @Test
+  public void testFindMultipleBeansByName() throws Exception {
+    List<Object> result = metrics.findAll(asList("bean1/value", "bean2/value", "bean3/notfound"));
+    assertThat(result, hasItems("val1", "val2"));
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/b552da9e/ambari-server/src/test/java/org/apache/ambari/server/state/alert/AlertUriTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/alert/AlertUriTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/alert/AlertUriTest.java
new file mode 100644
index 0000000..295e364
--- /dev/null
+++ b/ambari-server/src/test/java/org/apache/ambari/server/state/alert/AlertUriTest.java
@@ -0,0 +1,60 @@
+/*
+ * 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.state.alert;
+
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertThat;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.ambari.server.AmbariException;
+import org.junit.Test;
+
+public class AlertUriTest {
+  @Test
+  public void testChoosesHttpByDefault() throws Exception {
+    AlertUri uri = new AlertUri();
+    uri.setHttpUri("${config1/http-host}/path");
+    assertThat(resolved(uri), is("http://http-host/path"));
+  }
+
+  @Test
+  public void testChoosesHttpsBasedOnProperties() throws Exception {
+    AlertUri uri = new AlertUri();
+    uri.setHttpUri("${config1/http-host}/path");
+    uri.setHttpsUri("${config1/https-host}/path");
+    uri.setHttpsProperty("${config1/use-http}");
+    uri.setHttpsPropertyValue("YES");
+    assertThat(resolved(uri), is("https://https-host/path"));
+  }
+
+  private Map<String, Map<String, String>> config() {
+    return new HashMap<String, Map<String, String>>() {{
+        put("config1", new HashMap<String, String>() {{
+          put("http-host", "http-host");
+          put("https-host", "https-host");
+          put("use-http", "YES");
+        }});
+      }};
+  }
+
+  private String resolved(AlertUri uri) throws AmbariException {
+    return uri.resolve(config()).toString();
+  }
+}
\ No newline at end of file


[05/50] ambari git commit: AMBARI-22194 - Prevent Patch Upgrades With Known Service Incompatibilities (part2) (jonathanhurley)

Posted by am...@apache.org.
AMBARI-22194 - Prevent Patch Upgrades With Known Service Incompatibilities (part2) (jonathanhurley)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/08bdd803
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/08bdd803
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/08bdd803

Branch: refs/heads/branch-feature-AMBARI-22008
Commit: 08bdd803c51b6a1c7c16d7aa04b6207538f2fd9c
Parents: c19f363
Author: Jonathan Hurley <jh...@hortonworks.com>
Authored: Wed Oct 11 10:24:53 2017 -0400
Committer: Jonathan Hurley <jh...@hortonworks.com>
Committed: Wed Oct 11 10:25:25 2017 -0400

----------------------------------------------------------------------
 .../ambari/server/checks/RequiredServicesInRepositoryCheckTest.java | 1 -
 1 file changed, 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/08bdd803/ambari-server/src/test/java/org/apache/ambari/server/checks/RequiredServicesInRepositoryCheckTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/RequiredServicesInRepositoryCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/RequiredServicesInRepositoryCheckTest.java
index 0285c0a..5984871 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/RequiredServicesInRepositoryCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/RequiredServicesInRepositoryCheckTest.java
@@ -39,7 +39,6 @@ import org.mockito.Mockito;
 import org.mockito.runners.MockitoJUnitRunner;
 
 import com.google.common.collect.Sets;
-import com.google.gson.Gson;
 import com.google.inject.Provider;
 
 /**


[30/50] ambari git commit: AMBARI-22241: accumulo_script.py doesn't override init (Josh Elser via jluniya)

Posted by am...@apache.org.
AMBARI-22241: accumulo_script.py doesn't override init (Josh Elser via jluniya)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/32906779
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/32906779
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/32906779

Branch: refs/heads/branch-feature-AMBARI-22008
Commit: 329067797ecf70b765f6cd5a9febf89dcfbac0a5
Parents: 62a0a18
Author: Jayush Luniya <jl...@hortonworks.com>
Authored: Fri Oct 13 21:15:50 2017 -0700
Committer: Jayush Luniya <jl...@hortonworks.com>
Committed: Fri Oct 13 21:15:50 2017 -0700

----------------------------------------------------------------------
 .../ACCUMULO/1.6.1.2.2.0/package/scripts/accumulo_script.py         | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/32906779/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 6aafb05..2a95820 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
@@ -37,6 +37,7 @@ from accumulo_service import accumulo_service
 class AccumuloScript(Script):
 
   def __init__(self, component):
+    Script.__init__(self)
     self.component = component
 
 


[10/50] ambari git commit: AMBARI-22211. RU was not started on Oracle due to missing table (ncole)

Posted by am...@apache.org.
AMBARI-22211. RU was not started on Oracle due to missing table (ncole)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/c1001973
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/c1001973
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/c1001973

Branch: refs/heads/branch-feature-AMBARI-22008
Commit: c10019736972825c8b60a82c42cfe5713ddbe073
Parents: 323974e
Author: Nate Cole <nc...@hortonworks.com>
Authored: Wed Oct 11 15:44:03 2017 -0400
Committer: Nate Cole <nc...@hortonworks.com>
Committed: Wed Oct 11 15:44:03 2017 -0400

----------------------------------------------------------------------
 .../src/main/resources/Ambari-DDL-Oracle-CREATE.sql          | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/c1001973/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 02f6e3e..ebe5f12 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
@@ -846,12 +846,12 @@ CREATE TABLE upgrade_item (
 );
 
 CREATE TABLE upgrade_history(
-  id BIGINT NOT NULL,
-  upgrade_id BIGINT NOT NULL,
+  id NUMBER(19) NOT NULL,
+  upgrade_id NUMBER(19) NOT NULL,
   service_name VARCHAR2(255) NOT NULL,
   component_name VARCHAR2(255) NOT NULL,
-  from_repo_version_id BIGINT NOT NULL,
-  target_repo_version_id BIGINT NOT NULL,
+  from_repo_version_id NUMBER(19) NOT NULL,
+  target_repo_version_id NUMBER(19) NOT NULL,
   CONSTRAINT PK_upgrade_hist PRIMARY KEY (id),
   CONSTRAINT FK_upgrade_hist_upgrade_id FOREIGN KEY (upgrade_id) REFERENCES upgrade (upgrade_id),
   CONSTRAINT FK_upgrade_hist_from_repo FOREIGN KEY (from_repo_version_id) REFERENCES repo_version (repo_version_id),


[06/50] ambari git commit: AMBARI-22206. Downgrade UI shown Null when on Patch revert (alexantonenko)

Posted by am...@apache.org.
AMBARI-22206. Downgrade UI shown Null when on Patch revert (alexantonenko)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/73415675
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/73415675
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/73415675

Branch: refs/heads/branch-feature-AMBARI-22008
Commit: 734156756c1f8b35f6af0a4c8d9669e61daa8042
Parents: 08bdd80
Author: Alex Antonenko <aa...@hortonworks.com>
Authored: Wed Oct 11 19:02:28 2017 +0300
Committer: Alex Antonenko <aa...@hortonworks.com>
Committed: Wed Oct 11 19:02:28 2017 +0300

----------------------------------------------------------------------
 .../app/controllers/main/admin/stack_and_upgrade_controller.js   | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/73415675/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js b/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js
index 29e0687..2f0cb68 100644
--- a/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js
+++ b/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js
@@ -2147,9 +2147,7 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
     });
     this.loadRepoVersionsToModel().done(function () {
       var toVersion = App.RepositoryVersion.find().findProperty('repositoryVersion', lastUpgradeData.Upgrade.associated_version);
-      if (!isDowngrade) {
-        self.setDBProperty('upgradeVersion', toVersion && toVersion.get('displayName'));
-      }
+      self.setDBProperty('upgradeVersion', toVersion && toVersion.get('displayName'));
       self.initDBProperties();
       self.loadUpgradeData(true);
     });


[24/50] ambari git commit: AMBARI-22230 Hosts and Alerts tables UI tweaks. (atkach)

Posted by am...@apache.org.
AMBARI-22230 Hosts and Alerts tables UI tweaks. (atkach)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/8f53bc45
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/8f53bc45
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/8f53bc45

Branch: refs/heads/branch-feature-AMBARI-22008
Commit: 8f53bc453c47a4f95d5e58825feb77d69e6a6a22
Parents: a8ba5e6
Author: Andrii Tkach <at...@apache.org>
Authored: Fri Oct 13 13:45:06 2017 +0300
Committer: Andrii Tkach <at...@apache.org>
Committed: Fri Oct 13 13:45:06 2017 +0300

----------------------------------------------------------------------
 ambari-web/app/models/alerts/alert_group.js     |   2 +-
 ambari-web/app/styles/application.less          |   5 +
 ambari-web/app/styles/dashboard.less            |   6 +-
 .../app/styles/theme/bootstrap-ambari.css       |   3 +-
 ambari-web/app/templates/main/alerts.hbs        |   3 +-
 .../main/alerts/alert_definitions_actions.hbs   |   2 +-
 ambari-web/app/templates/main/dashboard.hbs     |   2 +-
 .../templates/main/dashboard/config_history.hbs |   2 +-
 ambari-web/app/templates/main/host.hbs          |   2 +-
 .../templates/main/host/bulk_operation_menu.hbs | 132 ++++++++++---------
 .../views/main/host/hosts_table_menu_view.js    |   4 +-
 .../app/views/main/host/stack_versions_view.js  |   2 +-
 .../test/models/alerts/alert_group_test.js      |   5 +-
 13 files changed, 93 insertions(+), 77 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/8f53bc45/ambari-web/app/models/alerts/alert_group.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/alerts/alert_group.js b/ambari-web/app/models/alerts/alert_group.js
index 49a850f..3277fc8 100644
--- a/ambari-web/app/models/alerts/alert_group.js
+++ b/ambari-web/app/models/alerts/alert_group.js
@@ -55,7 +55,7 @@ App.AlertGroup = DS.Model.extend({
    * @type {string}
    */
   displayName: function () {
-    var name = App.config.truncateGroupName(this.get('name'));
+    var name = App.config.truncateGroupName(App.format.role(this.get('name'), true));
     return this.get('default') ? name + ' Default' : name;
   }.property('name', 'default'),
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/8f53bc45/ambari-web/app/styles/application.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/application.less b/ambari-web/app/styles/application.less
index 7c9cc8e..099f3cf 100644
--- a/ambari-web/app/styles/application.less
+++ b/ambari-web/app/styles/application.less
@@ -2802,4 +2802,9 @@ a.abort-icon:hover {
 .breadcrumbs-forward-slash {
   display: inline;
   color: #D2D3D5;
+}
+
+.container-wrap-table {
+  padding: 0 10px;
+  background-color: @diff-background-equal;
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/8f53bc45/ambari-web/app/styles/dashboard.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/dashboard.less b/ambari-web/app/styles/dashboard.less
index 02835bd..6deb30c 100644
--- a/ambari-web/app/styles/dashboard.less
+++ b/ambari-web/app/styles/dashboard.less
@@ -18,14 +18,12 @@
 
 @import 'common.less';
 
-#dashboard-widgets-container{
-  .tabs-left {
-    float: left;
-  }
+#dashboard-widgets-container {
   .btn-toolbar {
     float: right;
     padding-top: 5px;
     margin-bottom: 20px;
+    margin-top: -60px;
   }
   .dashboard-widgets-box {
     clear: both;

http://git-wip-us.apache.org/repos/asf/ambari/blob/8f53bc45/ambari-web/app/styles/theme/bootstrap-ambari.css
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/theme/bootstrap-ambari.css b/ambari-web/app/styles/theme/bootstrap-ambari.css
index 70579e7..cff73ad 100644
--- a/ambari-web/app/styles/theme/bootstrap-ambari.css
+++ b/ambari-web/app/styles/theme/bootstrap-ambari.css
@@ -479,11 +479,12 @@ h2.table-title {
 }
 .nav.nav-tabs li a .badge.badge-important {
   display: inline;
+  vertical-align: baseline;
 }
 .nav.nav-tabs li.active a {
   color: #333;
   border-bottom: 3px solid #3FAE2A;
-  padding-bottom: 1px;
+  padding-bottom: 2px;
 }
 .nav-tabs-left li,
 .nav-tabs-right li {

http://git-wip-us.apache.org/repos/asf/ambari/blob/8f53bc45/ambari-web/app/templates/main/alerts.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/alerts.hbs b/ambari-web/app/templates/main/alerts.hbs
index 40469d3..0f85e27 100644
--- a/ambari-web/app/templates/main/alerts.hbs
+++ b/ambari-web/app/templates/main/alerts.hbs
@@ -16,7 +16,7 @@
 * limitations under the License.
 }}
 
-<div id="alerts">
+<div id="alerts" class="container-wrap-table">
   <div class="row">
     <h2 class="table-title col-sm-1">{{t menu.item.alerts}}</h2>
     <div class="table-controls row col-sm-11 pull-right">
@@ -56,7 +56,6 @@
               {{view App.AlertDefinitionSummary contentBinding="alertDefinition"}}
             </td>
             <td class="alert-name">
-              <span {{bindAttr title="alertDefinition.type"}} {{bindAttr class=":type-icon  alertDefinition.typeIconClass"}}></span>
               <a href="#" {{action "gotoAlertDetails" alertDefinition}}>{{alertDefinition.label}}</a>
             </td>
             <td class="alert-service">{{alertDefinition.serviceDisplayName}}</td>

http://git-wip-us.apache.org/repos/asf/ambari/blob/8f53bc45/ambari-web/app/templates/main/alerts/alert_definitions_actions.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/alerts/alert_definitions_actions.hbs b/ambari-web/app/templates/main/alerts/alert_definitions_actions.hbs
index 0604ac2..f65b000 100644
--- a/ambari-web/app/templates/main/alerts/alert_definitions_actions.hbs
+++ b/ambari-web/app/templates/main/alerts/alert_definitions_actions.hbs
@@ -16,7 +16,7 @@
 * limitations under the License.
 }}
 
-<button class="btn btn-default dropdown-toggle" data-toggle="dropdown" href="#">{{t common.actions}} <span class="caret"></span></button>
+<button class="btn btn-success dropdown-toggle" data-toggle="dropdown" href="#">{{t common.actions}} <span class="caret"></span></button>
 <ul class="dropdown-menu pull-left">
   {{#each action in controller}}
     <li>

http://git-wip-us.apache.org/repos/asf/ambari/blob/8f53bc45/ambari-web/app/templates/main/dashboard.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/dashboard.hbs b/ambari-web/app/templates/main/dashboard.hbs
index 0226626..4b174cc 100644
--- a/ambari-web/app/templates/main/dashboard.hbs
+++ b/ambari-web/app/templates/main/dashboard.hbs
@@ -18,7 +18,7 @@
 
 <div class="row">
   <div class="summary-width col-md-12" id="dashboard-widgets-container">
-    <ul class="nav nav-tabs background-text tabs-left">
+    <ul class="nav nav-tabs background-text">
       {{#each category in view.categories}}
         {{#view view.NavItemView itemBinding="category.name" }}
           <a href="#" {{action "goToDashboardView" category.url}} >{{category.label}}</a>

http://git-wip-us.apache.org/repos/asf/ambari/blob/8f53bc45/ambari-web/app/templates/main/dashboard/config_history.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/dashboard/config_history.hbs b/ambari-web/app/templates/main/dashboard/config_history.hbs
index 00f9c38..bc6ef7c 100644
--- a/ambari-web/app/templates/main/dashboard/config_history.hbs
+++ b/ambari-web/app/templates/main/dashboard/config_history.hbs
@@ -16,7 +16,7 @@
 * limitations under the License.
 }}
 
-<div id="config_history">
+<div id="config_history" class="container-wrap-table">
   <div class="row">
     <h2 class="table-title col-md-12">{{t dashboard.configHistory.title}}</h2>
   </div>

http://git-wip-us.apache.org/repos/asf/ambari/blob/8f53bc45/ambari-web/app/templates/main/host.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/host.hbs b/ambari-web/app/templates/main/host.hbs
index ae37a0f..b373c40 100644
--- a/ambari-web/app/templates/main/host.hbs
+++ b/ambari-web/app/templates/main/host.hbs
@@ -16,7 +16,7 @@
 * limitations under the License.
 }}
 
-<div id="hosts">
+<div id="hosts" class="container-wrap-table">
 
   <div class="row">
     <h2 class="table-title col-sm-1">{{t common.hosts}}</h2>

http://git-wip-us.apache.org/repos/asf/ambari/blob/8f53bc45/ambari-web/app/templates/main/host/bulk_operation_menu.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/host/bulk_operation_menu.hbs b/ambari-web/app/templates/main/host/bulk_operation_menu.hbs
index 64ab4e9..89551ca 100644
--- a/ambari-web/app/templates/main/host/bulk_operation_menu.hbs
+++ b/ambari-web/app/templates/main/host/bulk_operation_menu.hbs
@@ -16,7 +16,7 @@
 * limitations under the License.
 }}
 
-<button class="btn btn-default dropdown-toggle" data-toggle="dropdown" href="#">{{t common.actions}} <span class="caret"></span></button>
+<button class="btn btn-success dropdown-toggle" data-toggle="dropdown" href="#">{{t common.actions}} <span class="caret"></span></button>
 <ul class="dropdown-menu">
   {{#isAuthorized "HOST.ADD_DELETE_HOSTS"}}
     <li><a href="#" {{action addHost}}><i class="glyphicon glyphicon-plus glyphicon-white"></i> {{t hosts.host.add}}</a></li>
@@ -29,32 +29,36 @@
       <ul {{bindAttr class="view.parentView.showSelectedFilter::hidden :dropdown-menu"}}>
         {{#view view.hostItemView}}
           <a href="javascript:void(null);">{{view.label}}</a>
-          <ul class="dropdown-menu">
-            {{#each operation in view.operationsInfo}}
-              {{#if operation.label.length}}
-                {{#view view.operationView contentBinding="operation.operationData" selection="s"}}
-                  <a href="javascript:void(null);">{{operation.label}}</a>
-                {{/view}}
-              {{/if}}
-            {{/each}}
-          </ul>
-        {{/view}}
-        {{#each component in view.components}}
-          {{#view view.slaveItemView contentBinding="component"}}
-            <a href="javascript:void(null);">{{component.componentNameFormatted}}</a>
+          <div class="dropdown-menu-wrap">
             <ul class="dropdown-menu">
               {{#each operation in view.operationsInfo}}
-                {{#if operation.decommission}}
-                  {{#view view.advancedOperationView contentBinding="operation.operationData" selection="s"}}
-                    <a href="javascript:void(null);">{{operation.label}}</a>
-                  {{/view}}
-                {{else}}
-                  {{#view view.commonOperationView contentBinding="operation.operationData" selection="s"}}
+                {{#if operation.label.length}}
+                  {{#view view.operationView contentBinding="operation.operationData" selection="s"}}
                     <a href="javascript:void(null);">{{operation.label}}</a>
                   {{/view}}
                 {{/if}}
               {{/each}}
             </ul>
+          </div>
+        {{/view}}
+        {{#each component in view.components}}
+          {{#view view.slaveItemView contentBinding="component"}}
+            <a href="javascript:void(null);">{{component.componentNameFormatted}}</a>
+            <div class="dropdown-menu-wrap">
+              <ul class="dropdown-menu">
+                {{#each operation in view.operationsInfo}}
+                  {{#if operation.decommission}}
+                    {{#view view.advancedOperationView contentBinding="operation.operationData" selection="s"}}
+                      <a href="javascript:void(null);">{{operation.label}}</a>
+                    {{/view}}
+                  {{else}}
+                    {{#view view.commonOperationView contentBinding="operation.operationData" selection="s"}}
+                      <a href="javascript:void(null);">{{operation.label}}</a>
+                    {{/view}}
+                  {{/if}}
+                {{/each}}
+              </ul>
+            </div>
           {{/view}}
         {{/each}}
       </ul>
@@ -67,32 +71,36 @@
       <ul {{bindAttr class="view.parentView.hasFilteredItems::hidden :dropdown-menu"}}>
         {{#view view.hostItemView}}
           <a href="javascript:void(null);">{{view.label}}</a>
-          <ul class="dropdown-menu">
-            {{#each operation in view.operationsInfo}}
-              {{#if operation.label.length}}
-                {{#view view.operationView contentBinding="operation.operationData" selection="f"}}
-                  <a href="javascript:void(null);">{{operation.label}}</a>
-                {{/view}}
-              {{/if}}
-            {{/each}}
-          </ul>
-        {{/view}}
-        {{#each component in view.components}}
-          {{#view view.slaveItemView contentBinding="component"}}
-            <a href="javascript:void(null);">{{component.componentNameFormatted}}</a>
+          <div class="dropdown-menu-wrap">
             <ul class="dropdown-menu">
               {{#each operation in view.operationsInfo}}
-                {{#if operation.decommission}}
-                  {{#view view.advancedOperationView contentBinding="operation.operationData" selection="f"}}
-                    <a href="javascript:void(null);">{{operation.label}}</a>
-                  {{/view}}
-                {{else}}
-                  {{#view view.commonOperationView contentBinding="operation.operationData" selection="f"}}
+                {{#if operation.label.length}}
+                  {{#view view.operationView contentBinding="operation.operationData" selection="f"}}
                     <a href="javascript:void(null);">{{operation.label}}</a>
                   {{/view}}
                 {{/if}}
               {{/each}}
             </ul>
+          </div>
+        {{/view}}
+        {{#each component in view.components}}
+          {{#view view.slaveItemView contentBinding="component"}}
+            <a href="javascript:void(null);">{{component.componentNameFormatted}}</a>
+            <div class="dropdown-menu-wrap">
+              <ul class="dropdown-menu">
+                {{#each operation in view.operationsInfo}}
+                  {{#if operation.decommission}}
+                    {{#view view.advancedOperationView contentBinding="operation.operationData" selection="f"}}
+                      <a href="javascript:void(null);">{{operation.label}}</a>
+                    {{/view}}
+                  {{else}}
+                    {{#view view.commonOperationView contentBinding="operation.operationData" selection="f"}}
+                      <a href="javascript:void(null);">{{operation.label}}</a>
+                    {{/view}}
+                  {{/if}}
+                {{/each}}
+              </ul>
+            </div>
           {{/view}}
         {{/each}}
       </ul>
@@ -105,34 +113,38 @@
       <ul class="dropdown-menu">
         {{#view view.hostItemView}}
           <a href="javascript:void(null);">{{view.label}}</a>
-          <ul class="dropdown-menu">
-            {{#each operation in view.operationsInfo}}
-              {{#if operation.label.length}}
-                {{#view view.operationView contentBinding="operation.operationData" selection="a"}}
-                  <a href="javascript:void(null);">{{operation.label}}</a>
-                {{/view}}
-              {{/if}}
-            {{/each}}
-          </ul>
-        {{/view}}
-        {{#each component in view.components}}
-          {{#view view.slaveItemView contentBinding="component"}}
-            <a href="javascript:void(null);">{{component.componentNameFormatted}}</a>
+          <div class="dropdown-menu-wrap">
             <ul class="dropdown-menu">
               {{#each operation in view.operationsInfo}}
-                {{#if operation.decommission}}
-                  {{#view view.advancedOperationView contentBinding="operation.operationData" selection="a"}}
+                {{#if operation.label.length}}
+                  {{#view view.operationView contentBinding="operation.operationData" selection="a"}}
                     <a href="javascript:void(null);">{{operation.label}}</a>
                   {{/view}}
-                {{else}}
-                  {{#unless operation.delete}}
-                    {{#view view.commonOperationView contentBinding="operation.operationData" selection="a"}}
-                      <a href="javascript:void(null);">{{operation.label}}</a>
-                    {{/view}}
-                  {{/unless}}
                 {{/if}}
               {{/each}}
             </ul>
+          </div>
+        {{/view}}
+        {{#each component in view.components}}
+          {{#view view.slaveItemView contentBinding="component"}}
+            <a href="javascript:void(null);">{{component.componentNameFormatted}}</a>
+            <div class="dropdown-menu-wrap">
+              <ul class="dropdown-menu">
+                {{#each operation in view.operationsInfo}}
+                  {{#if operation.decommission}}
+                    {{#view view.advancedOperationView contentBinding="operation.operationData" selection="a"}}
+                      <a href="javascript:void(null);">{{operation.label}}</a>
+                    {{/view}}
+                  {{else}}
+                    {{#unless operation.delete}}
+                      {{#view view.commonOperationView contentBinding="operation.operationData" selection="a"}}
+                        <a href="javascript:void(null);">{{operation.label}}</a>
+                      {{/view}}
+                    {{/unless}}
+                  {{/if}}
+                {{/each}}
+              </ul>
+            </div>
           {{/view}}
         {{/each}}
       </ul>

http://git-wip-us.apache.org/repos/asf/ambari/blob/8f53bc45/ambari-web/app/views/main/host/hosts_table_menu_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/host/hosts_table_menu_view.js b/ambari-web/app/views/main/host/hosts_table_menu_view.js
index 25b4052..08fd0d4 100644
--- a/ambari-web/app/views/main/host/hosts_table_menu_view.js
+++ b/ambari-web/app/views/main/host/hosts_table_menu_view.js
@@ -70,7 +70,7 @@ App.HostTableMenuView = Em.View.extend({
   slaveItemView: Em.View.extend({
 
     tagName: 'li',
-    classNames: ['dropdown-submenu'],
+    classNames: ['dropdown-submenu', 'submenu-left'],
 
     /**
      * Get third-level menu items ingo for slave components
@@ -240,7 +240,7 @@ App.HostTableMenuView = Em.View.extend({
   hostItemView: Em.View.extend({
 
     tagName: 'li',
-    classNames: ['dropdown-submenu'],
+    classNames: ['dropdown-submenu', 'submenu-left'],
 
     label: Em.I18n.t('common.hosts'),
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/8f53bc45/ambari-web/app/views/main/host/stack_versions_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/host/stack_versions_view.js b/ambari-web/app/views/main/host/stack_versions_view.js
index cebe8c7..62a88b4 100644
--- a/ambari-web/app/views/main/host/stack_versions_view.js
+++ b/ambari-web/app/views/main/host/stack_versions_view.js
@@ -22,7 +22,7 @@ var sort = require('views/common/sort_view');
 
 App.MainHostStackVersionsView = App.TableView.extend({
   templateName: require('templates/main/host/stack_versions'),
-  classNames: ['host-tab-content'],
+  classNames: ['host-tab-content', 'container-wrap-table'],
 
   /**
    * @type {Ember.Object}

http://git-wip-us.apache.org/repos/asf/ambari/blob/8f53bc45/ambari-web/test/models/alerts/alert_group_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/models/alerts/alert_group_test.js b/ambari-web/test/models/alerts/alert_group_test.js
index 6f64b7a..34237d2 100644
--- a/ambari-web/test/models/alerts/alert_group_test.js
+++ b/ambari-web/test/models/alerts/alert_group_test.js
@@ -35,8 +35,9 @@ describe('App.AlertGroup', function() {
   describe('#displayName', function () {
 
     [
-      {name: 'abc', default: true, e: 'abc Default'},
-      {name: 'abc', default: false, e: 'abc'},
+      {name: 'abc', default: true, e: 'Abc Default'},
+      {name: 'abc', default: false, e: 'Abc'},
+      {name: 'ABC', default: false, e: 'Abc'},
       {name: '12345678901234567890', default: true, e: '123456789...234567890 Default'},
       {name: '12345678901234567890', default: false, e: '123456789...234567890'},
     ].forEach(function (test) {


[17/50] ambari git commit: AMBARI-22214.Livy protocol to be set to https in Zeppelin's interpreter setting(Venkata Sairam)

Posted by am...@apache.org.
AMBARI-22214.Livy protocol to be set to https in Zeppelin's interpreter setting(Venkata Sairam)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/3c3b1b81
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/3c3b1b81
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/3c3b1b81

Branch: refs/heads/branch-feature-AMBARI-22008
Commit: 3c3b1b810ee05490fe2fe370de6132ba31bf8b72
Parents: b86f53f
Author: Venkata Sairam <ve...@gmail.com>
Authored: Thu Oct 12 17:05:12 2017 +0530
Committer: Venkata Sairam <ve...@gmail.com>
Committed: Thu Oct 12 17:05:12 2017 +0530

----------------------------------------------------------------------
 .../common-services/ZEPPELIN/0.7.0/package/scripts/master.py   | 6 ++++--
 .../common-services/ZEPPELIN/0.7.0/package/scripts/params.py   | 6 ++++++
 2 files changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/3c3b1b81/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/master.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/master.py b/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/master.py
index 09944bd..eaa2cb9 100644
--- a/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/master.py
+++ b/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/master.py
@@ -530,14 +530,16 @@ class Master(Script):
 
       elif interpreter['group'] == 'livy' and interpreter['name'] == 'livy':
         if params.livy_livyserver_host:
-          interpreter['properties']['zeppelin.livy.url'] = "http://" + params.livy_livyserver_host + \
+          interpreter['properties']['zeppelin.livy.url'] = params.livy_livyserver_protocol + \
+                                                           "://" + params.livy_livyserver_host + \
                                                            ":" + params.livy_livyserver_port
         else:
           del interpreter_settings[setting_key]
 
       elif interpreter['group'] == 'livy' and interpreter['name'] == 'livy2':
         if params.livy2_livyserver_host:
-          interpreter['properties']['zeppelin.livy.url'] = "http://" + params.livy2_livyserver_host + \
+          interpreter['properties']['zeppelin.livy.url'] = params.livy2_livyserver_protocol + \
+                                                           "://" + params.livy2_livyserver_host + \
                                                            ":" + params.livy2_livyserver_port
         else:
           del interpreter_settings[setting_key]

http://git-wip-us.apache.org/repos/asf/ambari/blob/3c3b1b81/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/params.py b/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/params.py
index 3242f26..b7d3df0 100644
--- a/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/params.py
+++ b/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/params.py
@@ -219,17 +219,23 @@ livy2_hosts = default("/clusterHostInfo/livy2_server_hosts", [])
 
 livy_livyserver_host = None
 livy_livyserver_port = None
+livy_livyserver_protocol = 'http'
 livy2_livyserver_host = None
 livy2_livyserver_port = None
+livy2_livyserver_protocol = 'http'
 if stack_version_formatted and check_stack_feature(StackFeature.SPARK_LIVY, stack_version_formatted) and \
     len(livy_hosts) > 0:
   livy_livyserver_host = str(livy_hosts[0])
   livy_livyserver_port = config['configurations']['livy-conf']['livy.server.port']
+  if 'livy.keystore' in config['configurations']['livy-conf']:
+    livy_livyserver_protocol = 'https'
 
 if stack_version_formatted and check_stack_feature(StackFeature.SPARK_LIVY2, stack_version_formatted) and \
     len(livy2_hosts) > 0:
   livy2_livyserver_host = str(livy2_hosts[0])
   livy2_livyserver_port = config['configurations']['livy2-conf']['livy.server.port']
+  if 'livy.keystore' in config['configurations']['livy2-conf']:
+    livy2_livyserver_protocol = 'https'
 
 hdfs_user = config['configurations']['hadoop-env']['hdfs_user']
 security_enabled = config['configurations']['cluster-env']['security_enabled']


[28/50] ambari git commit: AMBARI-22237. Restarting Storm Supervisor from Ambari always fails while Stop and Start works fine. (Arpit Khare, swagle via swagle)

Posted by am...@apache.org.
AMBARI-22237. Restarting Storm Supervisor from Ambari always fails while Stop and Start works fine. (Arpit Khare, swagle via swagle)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/6e1cac85
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/6e1cac85
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/6e1cac85

Branch: refs/heads/branch-feature-AMBARI-22008
Commit: 6e1cac85e33132c93fd843e402e3702ee584b947
Parents: c8c1812
Author: Siddharth Wagle <sw...@hortonworks.com>
Authored: Fri Oct 13 20:55:22 2017 -0700
Committer: Siddharth Wagle <sw...@hortonworks.com>
Committed: Fri Oct 13 20:55:22 2017 -0700

----------------------------------------------------------------------
 .../STORM/0.9.1/package/scripts/supervisord_service.py              | 1 +
 .../STORM/1.0.1.3.0/package/scripts/supervisord_service.py          | 1 +
 2 files changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/6e1cac85/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/supervisord_service.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/supervisord_service.py b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/supervisord_service.py
index 6ff9f9c..498db15 100644
--- a/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/supervisord_service.py
+++ b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/supervisord_service.py
@@ -20,6 +20,7 @@ limitations under the License.
 
 from resource_management.core.resources.system import Execute
 from resource_management.libraries.functions.format import format
+from resource_management.core.exceptions import Fail
 
 def supervisord_service(component_name, action):
   Execute(format("supervisorctl {action} storm-{component_name}"),

http://git-wip-us.apache.org/repos/asf/ambari/blob/6e1cac85/ambari-server/src/main/resources/common-services/STORM/1.0.1.3.0/package/scripts/supervisord_service.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/STORM/1.0.1.3.0/package/scripts/supervisord_service.py b/ambari-server/src/main/resources/common-services/STORM/1.0.1.3.0/package/scripts/supervisord_service.py
index 6ff9f9c..498db15 100644
--- a/ambari-server/src/main/resources/common-services/STORM/1.0.1.3.0/package/scripts/supervisord_service.py
+++ b/ambari-server/src/main/resources/common-services/STORM/1.0.1.3.0/package/scripts/supervisord_service.py
@@ -20,6 +20,7 @@ limitations under the License.
 
 from resource_management.core.resources.system import Execute
 from resource_management.libraries.functions.format import format
+from resource_management.core.exceptions import Fail
 
 def supervisord_service(component_name, action):
   Execute(format("supervisorctl {action} storm-{component_name}"),


[04/50] ambari git commit: AMBARI-22194 - Prevent Patch Upgrades With Known Service Incompatibilities (jonathanhurley)

Posted by am...@apache.org.
AMBARI-22194 - Prevent Patch Upgrades With Known Service Incompatibilities (jonathanhurley)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/c19f363c
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/c19f363c
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/c19f363c

Branch: refs/heads/branch-feature-AMBARI-22008
Commit: c19f363c877776623fd42d285717e6e95b9036ad
Parents: 8ec33db
Author: Jonathan Hurley <jh...@hortonworks.com>
Authored: Tue Oct 10 15:42:30 2017 -0400
Committer: Jonathan Hurley <jh...@hortonworks.com>
Committed: Wed Oct 11 09:08:27 2017 -0400

----------------------------------------------------------------------
 .../server/checks/AbstractCheckDescriptor.java  |  81 +++++++++++--
 .../ambari/server/checks/CheckDescription.java  |   8 ++
 .../RequiredServicesInRepositoryCheck.java      |  91 +++++++++++++++
 .../ambari/server/checks/UpgradeCheck.java      |  11 ++
 .../ClusterStackVersionResourceProvider.java    |  26 +++++
 .../ambari/server/state/RepositoryType.java     |  18 +++
 .../server/state/repository/StackPackage.java   |  69 +++++++++++
 .../state/repository/VersionDefinitionXml.java  |  87 ++++++++++++++
 .../HDP/2.0.6/properties/stack_packages.json    |   6 +-
 .../checks/AbstractCheckDescriptorTest.java     |   3 +
 .../checks/AutoStartDisabledCheckTest.java      |  12 +-
 .../checks/ClientRetryPropertyCheckTest.java    |   2 +
 .../checks/ComponentExistsInRepoCheckTest.java  |   2 +
 .../checks/ComponentsInstallationCheckTest.java |   3 +
 .../checks/ConfigurationMergeCheckTest.java     |   2 +
 .../checks/DruidHighAvailabilityCheckTest.java  |   2 +
 .../checks/HiveMultipleMetastoreCheckTest.java  |   3 +
 .../checks/HiveNotRollingWarningTest.java       |   3 +
 .../server/checks/HostsHeartbeatCheckTest.java  |   2 +
 .../checks/HostsMasterMaintenanceCheckTest.java |   5 +-
 .../checks/HostsRepositoryVersionCheckTest.java |   2 +
 .../server/checks/InstallPackagesCheckTest.java |   2 +
 .../server/checks/KafkaKerberosCheckTest.java   |   2 +
 ...duce2JobHistoryStatePreservingCheckTest.java |   2 +
 .../server/checks/RangerAuditDbCheckTest.java   |   3 +
 .../server/checks/RangerPasswordCheckTest.java  |   3 +
 .../server/checks/RangerSSLConfigCheckTest.java |   3 +
 .../RequiredServicesInRepositoryCheckTest.java  | 116 +++++++++++++++++++
 .../SecondaryNamenodeDeletedCheckTest.java      |   3 +
 .../ServicesMaintenanceModeCheckTest.java       |   2 +
 ...vicesMapReduceDistributedCacheCheckTest.java |   3 +
 ...rvicesNamenodeHighAvailabilityCheckTest.java |   3 +
 .../ServicesNamenodeTruncateCheckTest.java      |   2 +
 .../ServicesTezDistributedCacheCheckTest.java   |   3 +
 .../server/checks/ServicesUpCheckTest.java      |   2 +
 .../ServicesYarnWorkPreservingCheckTest.java    |   2 +
 .../server/checks/StormShutdownWarningTest.java |   3 +
 .../ambari/server/state/CheckHelperTest.java    |   7 ++
 38 files changed, 588 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/c19f363c/ambari-server/src/main/java/org/apache/ambari/server/checks/AbstractCheckDescriptor.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/AbstractCheckDescriptor.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/AbstractCheckDescriptor.java
index 6726d30..478489d 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/checks/AbstractCheckDescriptor.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/AbstractCheckDescriptor.java
@@ -35,6 +35,7 @@ import org.apache.ambari.server.state.Cluster;
 import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.Config;
 import org.apache.ambari.server.state.DesiredConfig;
+import org.apache.ambari.server.state.RepositoryType;
 import org.apache.ambari.server.state.ServiceInfo;
 import org.apache.ambari.server.state.repository.ClusterVersionSummary;
 import org.apache.ambari.server.state.repository.VersionDefinitionXml;
@@ -44,11 +45,11 @@ import org.apache.ambari.server.state.stack.PrerequisiteCheck;
 import org.apache.ambari.server.state.stack.UpgradePack;
 import org.apache.ambari.server.state.stack.upgrade.RepositoryVersionHelper;
 import org.apache.ambari.server.state.stack.upgrade.UpgradeType;
+import org.apache.commons.lang.ArrayUtils;
 import org.apache.commons.lang.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 import com.google.common.collect.Lists;
+import com.google.gson.Gson;
 import com.google.inject.Inject;
 import com.google.inject.Provider;
 
@@ -57,8 +58,6 @@ import com.google.inject.Provider;
  */
 public abstract class AbstractCheckDescriptor {
 
-  private static final Logger LOG = LoggerFactory.getLogger(AbstractCheckDescriptor.class);
-
   protected static final String DEFAULT = "default";
 
   @Inject
@@ -82,6 +81,9 @@ public abstract class AbstractCheckDescriptor {
   @Inject
   Configuration config;
 
+  @Inject
+  Gson gson;
+
   private CheckDescription m_description;
 
   /**
@@ -128,7 +130,7 @@ public abstract class AbstractCheckDescriptor {
    */
   public final boolean isApplicable(PrereqCheckRequest request) throws AmbariException {
     List<CheckQualification> qualifications = Lists.newArrayList(
-        new ServiceQualification());
+        new ServiceQualification(), new OrchestrationQualification(getClass()));
 
     // add any others from the concrete check
     qualifications.addAll(getQualifications());
@@ -302,6 +304,27 @@ public abstract class AbstractCheckDescriptor {
   }
 
   /**
+   * Gets a de-serialized {@link VersionDefinitionXml} from the repository for
+   * this upgrade.
+   *
+   * @param request
+   *          the upgrade check request.
+   * @return the VDF XML
+   * @throws AmbariException
+   */
+  final VersionDefinitionXml getVersionDefinitionXml(PrereqCheckRequest request) throws AmbariException {
+    RepositoryVersionEntity repositoryVersion = request.getTargetRepositoryVersion();
+
+    try {
+      VersionDefinitionXml vdf = repositoryVersion.getRepositoryXml();
+      return vdf;
+    } catch (Exception exception) {
+      throw new AmbariException("Unable to run upgrade checks because of an invalid VDF",
+          exception);
+    }
+  }
+
+  /**
    * Gets the services participating in the upgrade from the VDF.
    *
    * @param request
@@ -311,12 +334,11 @@ public abstract class AbstractCheckDescriptor {
    */
   final Set<String> getServicesInUpgrade(PrereqCheckRequest request) throws AmbariException {
     final Cluster cluster = clustersProvider.get().getCluster(request.getClusterName());
-    RepositoryVersionEntity repositoryVersion = request.getTargetRepositoryVersion();
 
     // the check is scoped to some services, so determine if any of those
     // services are included in this upgrade
     try {
-      VersionDefinitionXml vdf = repositoryVersion.getRepositoryXml();
+      VersionDefinitionXml vdf = getVersionDefinitionXml(request);
       ClusterVersionSummary clusterVersionSummary = vdf.getClusterSummary(cluster);
       return clusterVersionSummary.getAvailableServiceNames();
     } catch (Exception exception) {
@@ -403,4 +425,47 @@ public abstract class AbstractCheckDescriptor {
       return true;
     }
   }
-}
\ No newline at end of file
+
+  /**
+   * The {@link OrchestrationQualification} class is used to determine if the
+   * check is required to run based on the {@link RepositoryType}.
+   */
+  final class OrchestrationQualification implements CheckQualification {
+
+    private final Class<? extends AbstractCheckDescriptor> m_checkClass;
+
+    /**
+     * Constructor.
+     *
+     * @param checkClass
+     *          the class of the check which is being considered for
+     *          applicability.
+     */
+    public OrchestrationQualification(Class<? extends AbstractCheckDescriptor> checkClass) {
+      m_checkClass = checkClass;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean isApplicable(PrereqCheckRequest request) throws AmbariException {
+      RepositoryVersionEntity repositoryVersion = request.getTargetRepositoryVersion();
+      RepositoryType repositoryType = repositoryVersion.getType();
+
+      UpgradeCheck annotation = m_checkClass.getAnnotation(UpgradeCheck.class);
+      if (null == annotation) {
+        return true;
+      }
+
+      RepositoryType[] repositoryTypes = annotation.orchestration();
+
+      if (ArrayUtils.isEmpty(repositoryTypes)
+          || ArrayUtils.contains(repositoryTypes, repositoryType)) {
+        return true;
+      }
+
+      return false;
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/c19f363c/ambari-server/src/main/java/org/apache/ambari/server/checks/CheckDescription.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/CheckDescription.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/CheckDescription.java
index c4d0820..3caac14 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/checks/CheckDescription.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/CheckDescription.java
@@ -352,6 +352,14 @@ public class CheckDescription {
           )
           .build()
   );
+  
+  public static CheckDescription VALID_SERVICES_INCLUDED_IN_REPOSITORY = new CheckDescription("VALID_SERVICES_INCLUDED_IN_REPOSITORY",
+      PrereqCheckType.CLUSTER,
+      "The repository is missing services which are required",
+      new ImmutableMap.Builder<String, String>()
+        .put(AbstractCheckDescriptor.DEFAULT,
+            "The following services are included in the upgrade but the repository is missing their dependencies:\n%s").build());
+  
 
   private String m_name;
   private PrereqCheckType m_type;

http://git-wip-us.apache.org/repos/asf/ambari/blob/c19f363c/ambari-server/src/main/java/org/apache/ambari/server/checks/RequiredServicesInRepositoryCheck.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/RequiredServicesInRepositoryCheck.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/RequiredServicesInRepositoryCheck.java
new file mode 100644
index 0000000..d911411
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/RequiredServicesInRepositoryCheck.java
@@ -0,0 +1,91 @@
+/*
+ * 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.checks;
+
+import java.util.LinkedHashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.ambari.server.AmbariException;
+import org.apache.ambari.server.controller.PrereqCheckRequest;
+import org.apache.ambari.server.state.Cluster;
+import org.apache.ambari.server.state.RepositoryType;
+import org.apache.ambari.server.state.repository.VersionDefinitionXml;
+import org.apache.ambari.server.state.stack.PrereqCheckStatus;
+import org.apache.ambari.server.state.stack.PrerequisiteCheck;
+import org.apache.ambari.server.state.stack.upgrade.UpgradeType;
+import org.apache.commons.lang.StringUtils;
+
+import com.google.inject.Singleton;
+
+/**
+ * The {@link RequiredServicesInRepositoryCheck} is used to ensure that if there
+ * are any services which require other services to also be included in the
+ * upgrade that they are included in the repository.
+ * <p/>
+ * This check is to prevent problems which can be caused by trying to patch
+ * upgrade services which have known depdenencies on other services because of
+ * things like hard coded versions.
+ */
+@Singleton
+@UpgradeCheck(
+    group = UpgradeCheckGroup.REPOSITORY_VERSION,
+    order = 1.0f,
+    required = { UpgradeType.ROLLING, UpgradeType.NON_ROLLING, UpgradeType.HOST_ORDERED },
+    orchestration = { RepositoryType.PATCH, RepositoryType.MAINT, RepositoryType.SERVICE })
+public class RequiredServicesInRepositoryCheck extends AbstractCheckDescriptor {
+
+  /**
+   * Constructor.
+   */
+  public RequiredServicesInRepositoryCheck() {
+    super(CheckDescription.VALID_SERVICES_INCLUDED_IN_REPOSITORY);
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  @Override
+  public void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request) throws AmbariException {
+    String clusterName = request.getClusterName();
+    Cluster cluster = clustersProvider.get().getCluster(clusterName);
+
+    VersionDefinitionXml xml = getVersionDefinitionXml(request);
+    Map<String, Set<String>> missingDependencies = xml.getMissingDependencies(cluster);
+
+    if (!missingDependencies.isEmpty()) {
+      String failReasonTemplate = getFailReason(prerequisiteCheck, request);
+
+      StringBuilder message = new StringBuilder();
+      for (String failedService : missingDependencies.keySet()) {
+        Set<String> servicesRequired = missingDependencies.get(failedService);
+
+        message.append(String.format(
+            "%s requires the following services which are not included: %s",
+            failedService, StringUtils.join(servicesRequired, ','))).append(System.lineSeparator());
+      }
+
+      prerequisiteCheck.setFailedOn(new LinkedHashSet<>(missingDependencies.keySet()));
+      prerequisiteCheck.setStatus(PrereqCheckStatus.FAIL);
+      prerequisiteCheck.setFailReason(String.format(failReasonTemplate, message.toString()));
+      return;
+    }
+
+    prerequisiteCheck.setStatus(PrereqCheckStatus.PASS);
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/c19f363c/ambari-server/src/main/java/org/apache/ambari/server/checks/UpgradeCheck.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/UpgradeCheck.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/UpgradeCheck.java
index 58ef4ba..4e03f47 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/checks/UpgradeCheck.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/UpgradeCheck.java
@@ -23,6 +23,7 @@ import java.lang.annotation.ElementType;
 import java.lang.annotation.Retention;
 import java.lang.annotation.Target;
 
+import org.apache.ambari.server.state.RepositoryType;
 import org.apache.ambari.server.state.stack.upgrade.UpgradeType;
 
 import com.google.inject.ScopeAnnotation;
@@ -69,4 +70,14 @@ public @interface UpgradeCheck {
    *         defined in the upgrade pack or an empty array for none.
    */
   UpgradeType[] required() default {};
+
+
+  /**
+   * The valid orchestration repository type that this check if valid for. By
+   * default, a check is valid for all orchestration types.
+   *
+   * @return the repository types that the check is valid for.
+   */
+  RepositoryType[] orchestration() default { RepositoryType.STANDARD, RepositoryType.PATCH,
+      RepositoryType.MAINT, RepositoryType.SERVICE };
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/c19f363c/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterStackVersionResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterStackVersionResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterStackVersionResourceProvider.java
index ba5a4e7..388551f 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterStackVersionResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterStackVersionResourceProvider.java
@@ -442,6 +442,32 @@ public class ClusterStackVersionResourceProvider extends AbstractControllerResou
           String.format("Version %s is backed by a version definition, but it could not be parsed", desiredRepoVersion), e);
     }
 
+    // stop the VDF distribution right now if there are problems with service
+    // dependencies
+    try {
+      if (repoVersionEntity.getType().isPartial()) {
+        Map<String, Set<String>> missingDependencies = desiredVersionDefinition.getMissingDependencies(cluster);
+
+        if (!missingDependencies.isEmpty()) {
+          StringBuilder message = new StringBuilder(
+              "The following services are included in this repository, but the repository is missing their dependencies: ").append(
+                  System.lineSeparator());
+
+          for (String failedService : missingDependencies.keySet()) {
+            message.append(String.format("%s requires the following services: %s", failedService,
+                StringUtils.join(missingDependencies.get(failedService), ','))).append(
+                    System.lineSeparator());
+          }
+
+          throw new SystemException(message.toString());
+        }
+      }
+    } catch (AmbariException ambariException) {
+      throw new SystemException(
+          "Unable to determine if this repository contains the necessary service dependencies",
+          ambariException);
+    }
+
     // if true, then we need to force all new host versions into the INSTALLED state
     boolean forceInstalled = Boolean.parseBoolean((String)propertyMap.get(
         CLUSTER_STACK_VERSION_FORCE));

http://git-wip-us.apache.org/repos/asf/ambari/blob/c19f363c/ambari-server/src/main/java/org/apache/ambari/server/state/RepositoryType.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/RepositoryType.java b/ambari-server/src/main/java/org/apache/ambari/server/state/RepositoryType.java
index bf7eab0..da2eb06 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/RepositoryType.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/RepositoryType.java
@@ -54,6 +54,13 @@ public enum RepositoryType {
       RepositoryType.PATCH);
 
   /**
+   * The types of repositories which can participate in an upgrade where only
+   * some services are orchestrated.
+   */
+  public static final EnumSet<RepositoryType> PARTIAL = EnumSet.of(RepositoryType.MAINT,
+      RepositoryType.PATCH, RepositoryType.SERVICE);
+
+  /**
    * Gets whether applications of this repository are revertable after they have
    * been finalized.
    *
@@ -72,4 +79,15 @@ public enum RepositoryType {
         return false;
     }
   }
+
+  /**
+   * Gets whether this repository type can be used to upgrade only a subset of
+   * services.
+   *
+   * @return {@code true} if the repository can be be applied to a subset of
+   *         isntalled services, {@code false} otherwise.
+   */
+  public boolean isPartial() {
+    return PARTIAL.contains(this);
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/c19f363c/ambari-server/src/main/java/org/apache/ambari/server/state/repository/StackPackage.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/repository/StackPackage.java b/ambari-server/src/main/java/org/apache/ambari/server/state/repository/StackPackage.java
new file mode 100644
index 0000000..39670da
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/repository/StackPackage.java
@@ -0,0 +1,69 @@
+/**
+ * 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.state.repository;
+
+import java.lang.reflect.Type;
+import java.util.List;
+import java.util.Map;
+
+import com.google.gson.JsonDeserializationContext;
+import com.google.gson.JsonDeserializer;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonParseException;
+import com.google.gson.annotations.SerializedName;
+import com.google.gson.reflect.TypeToken;
+
+/**
+ * Represents the data inside of the {@code stack_packages.json}.
+ */
+public class StackPackage {
+
+  /**
+   * The upgrade dependencies, if any. Will be {@code null} if none.
+   */
+  @SerializedName("upgrade-dependencies")
+  public UpgradeDependencies upgradeDependencies;
+
+  /**
+   * The upgrade dependencies between services.
+   */
+  public static class UpgradeDependencies {
+    Map<String, List<String>> dependencies;
+  }
+
+  /**
+   * A deserializer which extracts the "upgrade-dependencies" key from the
+   * stack_packages.json.
+   */
+  public static class UpgradeDependencyDeserializer
+      implements JsonDeserializer<UpgradeDependencies> {
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public UpgradeDependencies deserialize(JsonElement json, Type typeOfT,
+        JsonDeserializationContext context) throws JsonParseException {
+      Type mapType = new TypeToken<Map<String, List<String>>>() {}.getType();
+      Map<String, List<String>> data = context.deserialize(json, mapType);
+
+      UpgradeDependencies upgradeDependencies = new UpgradeDependencies();
+      upgradeDependencies.dependencies = data;
+      return upgradeDependencies;
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/c19f363c/ambari-server/src/main/java/org/apache/ambari/server/state/repository/VersionDefinitionXml.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/repository/VersionDefinitionXml.java b/ambari-server/src/main/java/org/apache/ambari/server/state/repository/VersionDefinitionXml.java
index ec4814b..1dda0b1 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/repository/VersionDefinitionXml.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/repository/VersionDefinitionXml.java
@@ -20,6 +20,7 @@ package org.apache.ambari.server.state.repository;
 import java.io.ByteArrayInputStream;
 import java.io.InputStream;
 import java.io.StringWriter;
+import java.lang.reflect.Type;
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -29,6 +30,7 @@ import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.TreeMap;
 import java.util.TreeSet;
 
 import javax.xml.XMLConstants;
@@ -50,18 +52,28 @@ import javax.xml.validation.SchemaFactory;
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.state.Cluster;
 import org.apache.ambari.server.state.ComponentInfo;
+import org.apache.ambari.server.state.ConfigHelper;
 import org.apache.ambari.server.state.RepositoryType;
 import org.apache.ambari.server.state.Service;
 import org.apache.ambari.server.state.ServiceInfo;
 import org.apache.ambari.server.state.StackId;
 import org.apache.ambari.server.state.StackInfo;
 import org.apache.ambari.server.state.repository.AvailableVersion.Component;
+import org.apache.ambari.server.state.repository.StackPackage.UpgradeDependencies;
+import org.apache.ambari.server.state.repository.StackPackage.UpgradeDependencyDeserializer;
 import org.apache.ambari.server.state.stack.RepositoryXml;
 import org.apache.ambari.server.state.stack.RepositoryXml.Os;
 import org.apache.ambari.server.utils.VersionUtils;
 import org.apache.commons.io.IOUtils;
 import org.apache.commons.lang.StringUtils;
 
+import com.google.common.collect.Sets;
+import com.google.common.reflect.TypeToken;
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+
+import jline.internal.Log;
+
 /**
  * Class that wraps a repository definition file.
  */
@@ -310,6 +322,81 @@ public class VersionDefinitionXml {
   }
 
   /**
+   * Gets information about services which cannot be upgraded because the
+   * repository does not contain required dependencies. This method will look at
+   * the {@code cluster-env/stack_packages} structure to see if there are any
+   * dependencies listed in the {@code upgrade-dependencies} key.
+   *
+   * @param cluster
+   *          the cluster (not {@code null}).
+   * @return a mapping of service name to its missing service dependencies, or
+   *         an empty map if there are none (never {@code null}).
+   * @throws AmbariException
+   */
+  public Map<String, Set<String>> getMissingDependencies(Cluster cluster)
+      throws AmbariException {
+    Map<String, Set<String>> missingDependencies = new TreeMap<>();
+
+    String stackPackagesJson = cluster.getClusterProperty(
+        ConfigHelper.CLUSTER_ENV_STACK_PACKAGES_PROPERTY, null);
+
+    // quick exit
+    if (StringUtils.isEmpty(stackPackagesJson)) {
+      return missingDependencies;
+    }
+
+    // create a GSON builder which can deserialize the stack_packages.json
+    GsonBuilder gsonBuilder = new GsonBuilder();
+    gsonBuilder.registerTypeAdapter(UpgradeDependencies.class, new UpgradeDependencyDeserializer());
+    Gson gson = gsonBuilder.create();
+    Type type = new TypeToken<Map<String, StackPackage>>(){}.getType();
+
+    // a mapping of stack name to stack-select/conf-select/upgade-deps
+    final Map<String, StackPackage> stackPackages;
+
+    try {
+      stackPackages = gson.fromJson(stackPackagesJson, type);
+    } catch( Exception exception ) {
+      Log.warn("Unable to deserialize the stack packages JSON, assuming no service dependencies",
+          exception);
+
+      return missingDependencies;
+    }
+
+    StackId stackId = new StackId(release.stackId);
+    StackPackage stackPackage = stackPackages.get(stackId.getStackName());
+    if (null == stackPackage || null == stackPackage.upgradeDependencies) {
+      return missingDependencies;
+    }
+
+    Map<String, List<String>> dependencies = stackPackage.upgradeDependencies.dependencies;
+
+    if (null == dependencies || dependencies.isEmpty()) {
+      return missingDependencies;
+    }
+
+    ClusterVersionSummary clusterVersionSummary = getClusterSummary(cluster);
+    Set<String> servicesInUpgrade = clusterVersionSummary.getAvailableServiceNames();
+    Set<String> servicesInRepository = getAvailableServiceNames();
+
+    for (String serviceInUpgrade : servicesInUpgrade) {
+      List<String> servicesRequired = dependencies.get(serviceInUpgrade);
+      if (null == servicesRequired) {
+        continue;
+      }
+
+      for (String serviceRequired : servicesRequired) {
+        if (!servicesInRepository.contains(serviceRequired)) {
+          missingDependencies.put(serviceInUpgrade, Sets.newTreeSet(servicesRequired));
+          break;
+        }
+      }
+    }
+
+    return missingDependencies;
+  }
+
+  /**
    * Structures the manifest by service name.
    * <p/>
    * !!! WARNING. This is currently based on the assumption that there is one and only

http://git-wip-us.apache.org/repos/asf/ambari/blob/c19f363c/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_packages.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_packages.json b/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_packages.json
index 8f685f6..c217ea8 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_packages.json
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_packages.json
@@ -1174,6 +1174,10 @@
           "current_dir": "{0}/current/zookeeper-client/conf"
         }
       ]
-    }
+    },
+    "upgrade-dependencies" : {
+      "YARN": ["TEZ"],
+      "TEZ": ["YARN"]
+    }    
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/c19f363c/ambari-server/src/test/java/org/apache/ambari/server/checks/AbstractCheckDescriptorTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/AbstractCheckDescriptorTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/AbstractCheckDescriptorTest.java
index 092bd0b..9915346 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/AbstractCheckDescriptorTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/AbstractCheckDescriptorTest.java
@@ -30,6 +30,7 @@ import org.apache.ambari.server.controller.PrereqCheckRequest;
 import org.apache.ambari.server.orm.entities.RepositoryVersionEntity;
 import org.apache.ambari.server.state.Cluster;
 import org.apache.ambari.server.state.Clusters;
+import org.apache.ambari.server.state.RepositoryType;
 import org.apache.ambari.server.state.Service;
 import org.apache.ambari.server.state.repository.ClusterVersionSummary;
 import org.apache.ambari.server.state.repository.VersionDefinitionXml;
@@ -120,6 +121,7 @@ public class AbstractCheckDescriptorTest extends EasyMockSupport {
     expect(cluster.getServices()).andReturn(services).atLeastOnce();
 
     RepositoryVersionEntity repositoryVersion = createNiceMock(RepositoryVersionEntity.class);
+    expect(repositoryVersion.getType()).andReturn(RepositoryType.STANDARD).anyTimes();
     expect(repositoryVersion.getRepositoryXml()).andReturn(m_vdfXml).atLeastOnce();
     expect(m_vdfXml.getClusterSummary(EasyMock.anyObject(Cluster.class))).andReturn(
         m_clusterVersionSummary).atLeastOnce();
@@ -170,6 +172,7 @@ public class AbstractCheckDescriptorTest extends EasyMockSupport {
     expect(cluster.getServices()).andReturn(services).atLeastOnce();
 
     RepositoryVersionEntity repositoryVersion = createNiceMock(RepositoryVersionEntity.class);
+    expect(repositoryVersion.getType()).andReturn(RepositoryType.STANDARD).anyTimes();
     expect(repositoryVersion.getRepositoryXml()).andReturn(m_vdfXml).atLeastOnce();
     expect(m_vdfXml.getClusterSummary(EasyMock.anyObject(Cluster.class))).andReturn(
         m_clusterVersionSummary).atLeastOnce();

http://git-wip-us.apache.org/repos/asf/ambari/blob/c19f363c/ambari-server/src/test/java/org/apache/ambari/server/checks/AutoStartDisabledCheckTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/AutoStartDisabledCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/AutoStartDisabledCheckTest.java
index 4a84483..b3d5b32 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/AutoStartDisabledCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/AutoStartDisabledCheckTest.java
@@ -25,10 +25,12 @@ import java.util.HashMap;
 import java.util.Map;
 
 import org.apache.ambari.server.controller.PrereqCheckRequest;
+import org.apache.ambari.server.orm.entities.RepositoryVersionEntity;
 import org.apache.ambari.server.state.Cluster;
 import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.Config;
 import org.apache.ambari.server.state.DesiredConfig;
+import org.apache.ambari.server.state.RepositoryType;
 import org.apache.ambari.server.state.stack.PrereqCheckStatus;
 import org.apache.ambari.server.state.stack.PrerequisiteCheck;
 import org.apache.commons.lang.StringUtils;
@@ -48,6 +50,8 @@ public class AutoStartDisabledCheckTest {
   private final Clusters m_clusters = EasyMock.createMock(Clusters.class);
   private Map<String, String> m_configMap = new HashMap<>();
 
+  RepositoryVersionEntity repositoryVersionEntity;
+
   @Before
   public void before() throws Exception {
 
@@ -73,7 +77,10 @@ public class AutoStartDisabledCheckTest {
 
     expect(m_clusters.getCluster((String) anyObject())).andReturn(cluster).anyTimes();
 
-    replay(m_clusters, cluster, config);
+    repositoryVersionEntity = EasyMock.createNiceMock(RepositoryVersionEntity.class);
+    expect(repositoryVersionEntity.getType()).andReturn(RepositoryType.STANDARD).anyTimes();
+
+    replay(m_clusters, cluster, config, repositoryVersionEntity);
 
     m_configMap.clear();
   }
@@ -82,6 +89,7 @@ public class AutoStartDisabledCheckTest {
   public void testNoAutoStart() throws Exception {
     PrerequisiteCheck check = new PrerequisiteCheck(CheckDescription.AUTO_START_DISABLED, "foo");
     PrereqCheckRequest request = new PrereqCheckRequest("cluster");
+    request.setTargetRepositoryVersion(repositoryVersionEntity);
 
     Assert.assertTrue(m_check.isApplicable(request));
 
@@ -95,6 +103,7 @@ public class AutoStartDisabledCheckTest {
   public void testAutoStartFalse() throws Exception {
     PrerequisiteCheck check = new PrerequisiteCheck(CheckDescription.AUTO_START_DISABLED, "foo");
     PrereqCheckRequest request = new PrereqCheckRequest("cluster");
+    request.setTargetRepositoryVersion(repositoryVersionEntity);
 
     Assert.assertTrue(m_check.isApplicable(request));
 
@@ -110,6 +119,7 @@ public class AutoStartDisabledCheckTest {
   public void testAutoStartTrue() throws Exception {
     PrerequisiteCheck check = new PrerequisiteCheck(CheckDescription.AUTO_START_DISABLED, "foo");
     PrereqCheckRequest request = new PrereqCheckRequest("cluster");
+    request.setTargetRepositoryVersion(repositoryVersionEntity);
 
     Assert.assertTrue(m_check.isApplicable(request));
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/c19f363c/ambari-server/src/test/java/org/apache/ambari/server/checks/ClientRetryPropertyCheckTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/ClientRetryPropertyCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/ClientRetryPropertyCheckTest.java
index ecc3165..52ec530 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/ClientRetryPropertyCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/ClientRetryPropertyCheckTest.java
@@ -27,6 +27,7 @@ import org.apache.ambari.server.state.Cluster;
 import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.Config;
 import org.apache.ambari.server.state.DesiredConfig;
+import org.apache.ambari.server.state.RepositoryType;
 import org.apache.ambari.server.state.Service;
 import org.apache.ambari.server.state.StackId;
 import org.apache.ambari.server.state.repository.ClusterVersionSummary;
@@ -78,6 +79,7 @@ public class ClientRetryPropertyCheckTest {
     Configuration config = Mockito.mock(Configuration.class);
     m_check.config = config;
 
+    Mockito.when(m_repositoryVersion.getType()).thenReturn(RepositoryType.STANDARD);
     Mockito.when(m_repositoryVersion.getVersion()).thenReturn("2.3.0.0-1234");
     Mockito.when(m_repositoryVersion.getStackId()).thenReturn(new StackId("HDP", "2.3"));
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/c19f363c/ambari-server/src/test/java/org/apache/ambari/server/checks/ComponentExistsInRepoCheckTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/ComponentExistsInRepoCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/ComponentExistsInRepoCheckTest.java
index ede1daa..2fe8ee0 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/ComponentExistsInRepoCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/ComponentExistsInRepoCheckTest.java
@@ -30,6 +30,7 @@ import org.apache.ambari.server.orm.entities.RepositoryVersionEntity;
 import org.apache.ambari.server.state.Cluster;
 import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.ComponentInfo;
+import org.apache.ambari.server.state.RepositoryType;
 import org.apache.ambari.server.state.Service;
 import org.apache.ambari.server.state.ServiceComponent;
 import org.apache.ambari.server.state.ServiceInfo;
@@ -147,6 +148,7 @@ public class ComponentExistsInRepoCheckTest extends EasyMockSupport {
         TARGET_STACK.getStackVersion(), "ZOOKEEPER", "ZOOKEEPER_SERVER")).andReturn(
             m_zookeeperServerInfo).anyTimes();
 
+    expect(m_repositoryVersion.getType()).andReturn(RepositoryType.STANDARD).anyTimes();
     expect(m_repositoryVersion.getStackId()).andReturn(TARGET_STACK).anyTimes();
     expect(m_repositoryVersion.getVersion()).andReturn("2.2.0").anyTimes();
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/c19f363c/ambari-server/src/test/java/org/apache/ambari/server/checks/ComponentsInstallationCheckTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/ComponentsInstallationCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/ComponentsInstallationCheckTest.java
index 4ae33f8..0e57966 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/ComponentsInstallationCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/ComponentsInstallationCheckTest.java
@@ -33,6 +33,7 @@ import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.ComponentInfo;
 import org.apache.ambari.server.state.Host;
 import org.apache.ambari.server.state.MaintenanceState;
+import org.apache.ambari.server.state.RepositoryType;
 import org.apache.ambari.server.state.Service;
 import org.apache.ambari.server.state.ServiceComponent;
 import org.apache.ambari.server.state.StackId;
@@ -86,6 +87,8 @@ public class ComponentsInstallationCheckTest {
     MockitoAnnotations.initMocks(this);
 
     m_services.clear();
+
+    Mockito.when(m_repositoryVersion.getType()).thenReturn(RepositoryType.STANDARD);
     Mockito.when(m_repositoryVersion.getVersion()).thenReturn("2.2.0.0-1234");
     Mockito.when(m_repositoryVersion.getStackId()).thenReturn(new StackId("HDP", "2.2"));
     Mockito.when(m_repositoryVersion.getRepositoryXml()).thenReturn(m_vdfXml);

http://git-wip-us.apache.org/repos/asf/ambari/blob/c19f363c/ambari-server/src/test/java/org/apache/ambari/server/checks/ConfigurationMergeCheckTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/ConfigurationMergeCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/ConfigurationMergeCheckTest.java
index fd450b9..e017a02 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/ConfigurationMergeCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/ConfigurationMergeCheckTest.java
@@ -37,6 +37,7 @@ import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.Config;
 import org.apache.ambari.server.state.ConfigMergeHelper;
 import org.apache.ambari.server.state.PropertyInfo;
+import org.apache.ambari.server.state.RepositoryType;
 import org.apache.ambari.server.state.Service;
 import org.apache.ambari.server.state.StackId;
 import org.apache.ambari.server.state.stack.PrerequisiteCheck;
@@ -82,6 +83,7 @@ public class ConfigurationMergeCheckTest {
 
     expect(cluster.getDesiredConfigByType(CONFIG_TYPE)).andReturn(config).anyTimes();
 
+    Mockito.when(m_repositoryVersion.getType()).thenReturn(RepositoryType.STANDARD);
     Mockito.when(m_repositoryVersion.getVersion()).thenReturn("1.1.0.0-1234");
     Mockito.when(m_repositoryVersion.getStackId()).thenReturn(new StackId("HDP", "1.1"));
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/c19f363c/ambari-server/src/test/java/org/apache/ambari/server/checks/DruidHighAvailabilityCheckTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/DruidHighAvailabilityCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/DruidHighAvailabilityCheckTest.java
index dfb18ed..efc6a80 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/DruidHighAvailabilityCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/DruidHighAvailabilityCheckTest.java
@@ -27,6 +27,7 @@ import org.apache.ambari.server.controller.PrereqCheckRequest;
 import org.apache.ambari.server.orm.entities.RepositoryVersionEntity;
 import org.apache.ambari.server.state.Cluster;
 import org.apache.ambari.server.state.Clusters;
+import org.apache.ambari.server.state.RepositoryType;
 import org.apache.ambari.server.state.Service;
 import org.apache.ambari.server.state.ServiceComponent;
 import org.apache.ambari.server.state.ServiceComponentHost;
@@ -87,6 +88,7 @@ public class DruidHighAvailabilityCheckTest
     druidHighAvailabilityCheck.config = config;
 
     m_services.clear();
+    Mockito.when(m_repositoryVersion.getType()).thenReturn(RepositoryType.STANDARD);
     Mockito.when(m_repositoryVersion.getRepositoryXml()).thenReturn(m_vdfXml);
     Mockito.when(m_vdfXml.getClusterSummary(Mockito.any(Cluster.class))).thenReturn(m_clusterVersionSummary);
     Mockito.when(m_clusterVersionSummary.getAvailableServiceNames()).thenReturn(m_services.keySet());

http://git-wip-us.apache.org/repos/asf/ambari/blob/c19f363c/ambari-server/src/test/java/org/apache/ambari/server/checks/HiveMultipleMetastoreCheckTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/HiveMultipleMetastoreCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/HiveMultipleMetastoreCheckTest.java
index 3dfe2f8..6bba2ea 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/HiveMultipleMetastoreCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/HiveMultipleMetastoreCheckTest.java
@@ -27,6 +27,7 @@ import org.apache.ambari.server.orm.dao.RepositoryVersionDAO;
 import org.apache.ambari.server.orm.entities.RepositoryVersionEntity;
 import org.apache.ambari.server.state.Cluster;
 import org.apache.ambari.server.state.Clusters;
+import org.apache.ambari.server.state.RepositoryType;
 import org.apache.ambari.server.state.Service;
 import org.apache.ambari.server.state.ServiceComponent;
 import org.apache.ambari.server.state.ServiceComponentHost;
@@ -85,6 +86,8 @@ public class HiveMultipleMetastoreCheckTest {
     Mockito.when(m_repositoryVersion.getStackId()).thenReturn(new StackId("HDP", "1.0"));
 
     m_services.clear();
+
+    Mockito.when(m_repositoryVersion.getType()).thenReturn(RepositoryType.STANDARD);
     Mockito.when(m_repositoryVersion.getRepositoryXml()).thenReturn(m_vdfXml);
     Mockito.when(m_vdfXml.getClusterSummary(Mockito.any(Cluster.class))).thenReturn(m_clusterVersionSummary);
     Mockito.when(m_clusterVersionSummary.getAvailableServiceNames()).thenReturn(m_services.keySet());

http://git-wip-us.apache.org/repos/asf/ambari/blob/c19f363c/ambari-server/src/test/java/org/apache/ambari/server/checks/HiveNotRollingWarningTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/HiveNotRollingWarningTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/HiveNotRollingWarningTest.java
index 3b0c900..bed1b43 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/HiveNotRollingWarningTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/HiveNotRollingWarningTest.java
@@ -24,6 +24,7 @@ import org.apache.ambari.server.controller.PrereqCheckRequest;
 import org.apache.ambari.server.orm.entities.RepositoryVersionEntity;
 import org.apache.ambari.server.state.Cluster;
 import org.apache.ambari.server.state.Clusters;
+import org.apache.ambari.server.state.RepositoryType;
 import org.apache.ambari.server.state.Service;
 import org.apache.ambari.server.state.StackId;
 import org.apache.ambari.server.state.repository.ClusterVersionSummary;
@@ -66,6 +67,8 @@ public class HiveNotRollingWarningTest extends EasyMockSupport {
   @Before
   public void setup() throws Exception {
     m_services.clear();
+
+    Mockito.when(m_repositoryVersion.getType()).thenReturn(RepositoryType.STANDARD);
     Mockito.when(m_repositoryVersion.getRepositoryXml()).thenReturn(m_vdfXml);
     Mockito.when(m_vdfXml.getClusterSummary(Mockito.any(Cluster.class))).thenReturn(m_clusterVersionSummary);
     Mockito.when(m_clusterVersionSummary.getAvailableServiceNames()).thenReturn(m_services.keySet());

http://git-wip-us.apache.org/repos/asf/ambari/blob/c19f363c/ambari-server/src/test/java/org/apache/ambari/server/checks/HostsHeartbeatCheckTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/HostsHeartbeatCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/HostsHeartbeatCheckTest.java
index daf2e4c..cf42ab7 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/HostsHeartbeatCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/HostsHeartbeatCheckTest.java
@@ -29,6 +29,7 @@ import org.apache.ambari.server.state.Host;
 import org.apache.ambari.server.state.HostHealthStatus;
 import org.apache.ambari.server.state.HostHealthStatus.HealthStatus;
 import org.apache.ambari.server.state.MaintenanceState;
+import org.apache.ambari.server.state.RepositoryType;
 import org.apache.ambari.server.state.StackId;
 import org.apache.ambari.server.state.stack.PrereqCheckStatus;
 import org.apache.ambari.server.state.stack.PrerequisiteCheck;
@@ -53,6 +54,7 @@ public class HostsHeartbeatCheckTest {
    */
   @Before
   public void setup() throws Exception {
+    Mockito.when(m_repositoryVersion.getType()).thenReturn(RepositoryType.STANDARD);
     Mockito.when(m_repositoryVersion.getVersion()).thenReturn("2.2.0.0-1234");
     Mockito.when(m_repositoryVersion.getStackId()).thenReturn(new StackId("HDP", "2.2"));
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/c19f363c/ambari-server/src/test/java/org/apache/ambari/server/checks/HostsMasterMaintenanceCheckTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/HostsMasterMaintenanceCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/HostsMasterMaintenanceCheckTest.java
index 8fcb1b2..c7cb13f 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/HostsMasterMaintenanceCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/HostsMasterMaintenanceCheckTest.java
@@ -27,6 +27,7 @@ import org.apache.ambari.server.orm.dao.RepositoryVersionDAO;
 import org.apache.ambari.server.orm.entities.RepositoryVersionEntity;
 import org.apache.ambari.server.state.Cluster;
 import org.apache.ambari.server.state.Clusters;
+import org.apache.ambari.server.state.RepositoryType;
 import org.apache.ambari.server.state.Service;
 import org.apache.ambari.server.state.StackId;
 import org.apache.ambari.server.state.repository.ClusterVersionSummary;
@@ -71,6 +72,8 @@ public class HostsMasterMaintenanceCheckTest {
   @Before
   public void setup() throws Exception {
     m_services.clear();
+
+    Mockito.when(m_repositoryVersion.getType()).thenReturn(RepositoryType.STANDARD);
     Mockito.when(m_repositoryVersion.getRepositoryXml()).thenReturn(m_vdfXml);
     Mockito.when(m_vdfXml.getClusterSummary(Mockito.any(Cluster.class))).thenReturn(m_clusterVersionSummary);
     Mockito.when(m_clusterVersionSummary.getAvailableServiceNames()).thenReturn(m_services.keySet());
@@ -170,4 +173,4 @@ public class HostsMasterMaintenanceCheckTest {
     hostsMasterMaintenanceCheck.perform(check, checkRequest);
     Assert.assertEquals(PrereqCheckStatus.PASS, check.getStatus());
   }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/c19f363c/ambari-server/src/test/java/org/apache/ambari/server/checks/HostsRepositoryVersionCheckTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/HostsRepositoryVersionCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/HostsRepositoryVersionCheckTest.java
index 5539618..2d60a52 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/HostsRepositoryVersionCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/HostsRepositoryVersionCheckTest.java
@@ -31,6 +31,7 @@ import org.apache.ambari.server.state.Cluster;
 import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.Host;
 import org.apache.ambari.server.state.MaintenanceState;
+import org.apache.ambari.server.state.RepositoryType;
 import org.apache.ambari.server.state.RepositoryVersionState;
 import org.apache.ambari.server.state.Service;
 import org.apache.ambari.server.state.StackId;
@@ -73,6 +74,7 @@ public class HostsRepositoryVersionCheckTest {
   public void setup() throws Exception {
     m_services.clear();
 
+    Mockito.when(m_repositoryVersion.getType()).thenReturn(RepositoryType.STANDARD);
     Mockito.when(m_repositoryVersion.getVersion()).thenReturn("1.0.0.0-1234");
     Mockito.when(m_repositoryVersion.getStackId()).thenReturn(new StackId("HDP", "1.0"));
     Mockito.when(m_repositoryVersion.getRepositoryXml()).thenReturn(m_vdfXml);

http://git-wip-us.apache.org/repos/asf/ambari/blob/c19f363c/ambari-server/src/test/java/org/apache/ambari/server/checks/InstallPackagesCheckTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/InstallPackagesCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/InstallPackagesCheckTest.java
index cdfbb0a..b02d834 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/InstallPackagesCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/InstallPackagesCheckTest.java
@@ -34,6 +34,7 @@ import org.apache.ambari.server.state.Cluster;
 import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.Host;
 import org.apache.ambari.server.state.MaintenanceState;
+import org.apache.ambari.server.state.RepositoryType;
 import org.apache.ambari.server.state.RepositoryVersionState;
 import org.apache.ambari.server.state.StackId;
 import org.apache.ambari.server.state.stack.PrereqCheckStatus;
@@ -73,6 +74,7 @@ public class InstallPackagesCheckTest {
    */
   @Before
   public void setup() throws Exception {
+    Mockito.when(m_repositoryVersion.getType()).thenReturn(RepositoryType.STANDARD);
     Mockito.when(m_repositoryVersion.getVersion()).thenReturn(repositoryVersion);
     Mockito.when(m_repositoryVersion.getStackId()).thenReturn(targetStackId);
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/c19f363c/ambari-server/src/test/java/org/apache/ambari/server/checks/KafkaKerberosCheckTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/KafkaKerberosCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/KafkaKerberosCheckTest.java
index 9a95c42..b4ee6ec 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/KafkaKerberosCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/KafkaKerberosCheckTest.java
@@ -24,6 +24,7 @@ import org.apache.ambari.server.controller.PrereqCheckRequest;
 import org.apache.ambari.server.orm.entities.RepositoryVersionEntity;
 import org.apache.ambari.server.state.Cluster;
 import org.apache.ambari.server.state.Clusters;
+import org.apache.ambari.server.state.RepositoryType;
 import org.apache.ambari.server.state.SecurityType;
 import org.apache.ambari.server.state.Service;
 import org.apache.ambari.server.state.repository.ClusterVersionSummary;
@@ -68,6 +69,7 @@ public class KafkaKerberosCheckTest {
     };
 
     m_services.clear();
+    Mockito.when(m_repositoryVersion.getType()).thenReturn(RepositoryType.STANDARD);
     Mockito.when(m_repositoryVersion.getRepositoryXml()).thenReturn(m_vdfXml);
     Mockito.when(m_vdfXml.getClusterSummary(Mockito.any(Cluster.class))).thenReturn(m_clusterVersionSummary);
     Mockito.when(m_clusterVersionSummary.getAvailableServiceNames()).thenReturn(m_services.keySet());

http://git-wip-us.apache.org/repos/asf/ambari/blob/c19f363c/ambari-server/src/test/java/org/apache/ambari/server/checks/MapReduce2JobHistoryStatePreservingCheckTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/MapReduce2JobHistoryStatePreservingCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/MapReduce2JobHistoryStatePreservingCheckTest.java
index 096781c..f8ea169 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/MapReduce2JobHistoryStatePreservingCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/MapReduce2JobHistoryStatePreservingCheckTest.java
@@ -97,6 +97,8 @@ public class MapReduce2JobHistoryStatePreservingCheckTest {
     Mockito.when(m_repositoryVersion.getStackId()).thenReturn(new StackId("HDP", "2.3"));
 
     m_services.clear();
+
+    Mockito.when(m_repositoryVersion.getType()).thenReturn(RepositoryType.STANDARD);
     Mockito.when(m_repositoryVersion.getRepositoryXml()).thenReturn(m_vdfXml);
     Mockito.when(m_vdfXml.getClusterSummary(Mockito.any(Cluster.class))).thenReturn(m_clusterVersionSummary);
     Mockito.when(m_clusterVersionSummary.getAvailableServiceNames()).thenReturn(m_services.keySet());

http://git-wip-us.apache.org/repos/asf/ambari/blob/c19f363c/ambari-server/src/test/java/org/apache/ambari/server/checks/RangerAuditDbCheckTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/RangerAuditDbCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/RangerAuditDbCheckTest.java
index ec91e48..4a7e8d3 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/RangerAuditDbCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/RangerAuditDbCheckTest.java
@@ -27,6 +27,7 @@ import org.apache.ambari.server.state.Cluster;
 import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.Config;
 import org.apache.ambari.server.state.DesiredConfig;
+import org.apache.ambari.server.state.RepositoryType;
 import org.apache.ambari.server.state.Service;
 import org.apache.ambari.server.state.repository.ClusterVersionSummary;
 import org.apache.ambari.server.state.repository.VersionDefinitionXml;
@@ -72,6 +73,8 @@ public class RangerAuditDbCheckTest {
     rangerAuditDbCheck.config = config;
 
     m_services.clear();
+
+    Mockito.when(m_repositoryVersion.getType()).thenReturn(RepositoryType.STANDARD);
     Mockito.when(m_repositoryVersion.getRepositoryXml()).thenReturn(m_vdfXml);
     Mockito.when(m_vdfXml.getClusterSummary(Mockito.any(Cluster.class))).thenReturn(m_clusterVersionSummary);
     Mockito.when(m_clusterVersionSummary.getAvailableServiceNames()).thenReturn(m_services.keySet());

http://git-wip-us.apache.org/repos/asf/ambari/blob/c19f363c/ambari-server/src/test/java/org/apache/ambari/server/checks/RangerPasswordCheckTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/RangerPasswordCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/RangerPasswordCheckTest.java
index cfffb8f..d24c73c 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/RangerPasswordCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/RangerPasswordCheckTest.java
@@ -39,6 +39,7 @@ import org.apache.ambari.server.state.Cluster;
 import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.Config;
 import org.apache.ambari.server.state.DesiredConfig;
+import org.apache.ambari.server.state.RepositoryType;
 import org.apache.ambari.server.state.Service;
 import org.apache.ambari.server.state.StackId;
 import org.apache.ambari.server.state.repository.ClusterVersionSummary;
@@ -149,6 +150,8 @@ public class RangerPasswordCheckTest {
     PowerMockito.whenNew(URLStreamProvider.class).withAnyArguments().thenReturn(m_streamProvider);
 
     m_services.clear();
+
+    Mockito.when(m_repositoryVersion.getType()).thenReturn(RepositoryType.STANDARD);
     Mockito.when(m_repositoryVersion.getRepositoryXml()).thenReturn(m_vdfXml);
     Mockito.when(m_vdfXml.getClusterSummary(Mockito.any(Cluster.class))).thenReturn(m_clusterVersionSummary);
     Mockito.when(m_clusterVersionSummary.getAvailableServiceNames()).thenReturn(m_services.keySet());

http://git-wip-us.apache.org/repos/asf/ambari/blob/c19f363c/ambari-server/src/test/java/org/apache/ambari/server/checks/RangerSSLConfigCheckTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/RangerSSLConfigCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/RangerSSLConfigCheckTest.java
index af016b0..50ec21c 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/RangerSSLConfigCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/RangerSSLConfigCheckTest.java
@@ -27,6 +27,7 @@ import org.apache.ambari.server.state.Cluster;
 import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.Config;
 import org.apache.ambari.server.state.DesiredConfig;
+import org.apache.ambari.server.state.RepositoryType;
 import org.apache.ambari.server.state.Service;
 import org.apache.ambari.server.state.repository.ClusterVersionSummary;
 import org.apache.ambari.server.state.repository.VersionDefinitionXml;
@@ -73,6 +74,8 @@ public class RangerSSLConfigCheckTest {
     rangerSSLConfigCheck.config = config;
 
     m_services.clear();
+
+    Mockito.when(m_repositoryVersion.getType()).thenReturn(RepositoryType.STANDARD);
     Mockito.when(m_repositoryVersion.getRepositoryXml()).thenReturn(m_vdfXml);
     Mockito.when(m_vdfXml.getClusterSummary(Mockito.any(Cluster.class))).thenReturn(m_clusterVersionSummary);
     Mockito.when(m_clusterVersionSummary.getAvailableServiceNames()).thenReturn(m_services.keySet());

http://git-wip-us.apache.org/repos/asf/ambari/blob/c19f363c/ambari-server/src/test/java/org/apache/ambari/server/checks/RequiredServicesInRepositoryCheckTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/RequiredServicesInRepositoryCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/RequiredServicesInRepositoryCheckTest.java
new file mode 100644
index 0000000..0285c0a
--- /dev/null
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/RequiredServicesInRepositoryCheckTest.java
@@ -0,0 +1,116 @@
+/**
+ * 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.checks;
+
+import static org.mockito.Mockito.mock;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.ambari.server.controller.PrereqCheckRequest;
+import org.apache.ambari.server.orm.entities.RepositoryVersionEntity;
+import org.apache.ambari.server.state.Cluster;
+import org.apache.ambari.server.state.Clusters;
+import org.apache.ambari.server.state.repository.VersionDefinitionXml;
+import org.apache.ambari.server.state.stack.PrereqCheckStatus;
+import org.apache.ambari.server.state.stack.PrerequisiteCheck;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.runners.MockitoJUnitRunner;
+
+import com.google.common.collect.Sets;
+import com.google.gson.Gson;
+import com.google.inject.Provider;
+
+/**
+ * Tests {@link RequiredServicesInRepositoryCheck}.
+ */
+@RunWith(MockitoJUnitRunner.class)
+public class RequiredServicesInRepositoryCheckTest {
+
+  private static final String CLUSTER_NAME = "c1";
+
+  @Mock
+  private VersionDefinitionXml m_vdfXml;
+
+  @Mock
+  private RepositoryVersionEntity m_repositoryVersion;
+
+  private RequiredServicesInRepositoryCheck m_requiredServicesCheck;
+
+  /**
+   * Used to return the missing dependencies for the test.
+   */
+  private Map<String, Set<String>> m_missingDependencies = new HashMap<>();
+
+  @Before
+  public void setUp() throws Exception {
+    final Clusters clusters = mock(Clusters.class);
+    m_requiredServicesCheck = new RequiredServicesInRepositoryCheck();
+    m_requiredServicesCheck.clustersProvider = new Provider<Clusters>() {
+      @Override
+      public Clusters get() {
+        return clusters;
+      }
+    };
+
+    final Cluster cluster = Mockito.mock(Cluster.class);
+    Mockito.when(cluster.getClusterId()).thenReturn(1L);
+    Mockito.when(clusters.getCluster(CLUSTER_NAME)).thenReturn(cluster);
+
+    Mockito.when(m_repositoryVersion.getRepositoryXml()).thenReturn(m_vdfXml);
+    Mockito.when(m_vdfXml.getMissingDependencies(Mockito.eq(cluster))).thenReturn(m_missingDependencies);
+  }
+
+  /**
+   * Tests that a no missing services results in a passed test.
+   *
+   * @throws Exception
+   */
+  @Test
+  public void testNoMissingServices() throws Exception {
+    PrereqCheckRequest request = new PrereqCheckRequest(CLUSTER_NAME);
+    request.setTargetRepositoryVersion(m_repositoryVersion);
+
+    PrerequisiteCheck check = new PrerequisiteCheck(null, CLUSTER_NAME);
+    m_requiredServicesCheck.perform(check, request);
+    Assert.assertEquals(PrereqCheckStatus.PASS, check.getStatus());
+  }
+
+  /**
+   * Tests that a missing required service causes the test to fail.
+   *
+   * @throws Exception
+   */
+  @Test
+  public void testMissingRequiredService() throws Exception {
+    PrereqCheckRequest request = new PrereqCheckRequest(CLUSTER_NAME);
+    request.setTargetRepositoryVersion(m_repositoryVersion);
+
+    m_missingDependencies.put("FOO", Sets.newHashSet("BAR"));
+
+    PrerequisiteCheck check = new PrerequisiteCheck(null, CLUSTER_NAME);
+    m_requiredServicesCheck.perform(check, request);
+    Assert.assertEquals(PrereqCheckStatus.FAIL, check.getStatus());
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/c19f363c/ambari-server/src/test/java/org/apache/ambari/server/checks/SecondaryNamenodeDeletedCheckTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/SecondaryNamenodeDeletedCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/SecondaryNamenodeDeletedCheckTest.java
index 67c458a..c038c47 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/SecondaryNamenodeDeletedCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/SecondaryNamenodeDeletedCheckTest.java
@@ -28,6 +28,7 @@ import org.apache.ambari.server.orm.dao.HostComponentStateDAO;
 import org.apache.ambari.server.orm.entities.RepositoryVersionEntity;
 import org.apache.ambari.server.state.Cluster;
 import org.apache.ambari.server.state.Clusters;
+import org.apache.ambari.server.state.RepositoryType;
 import org.apache.ambari.server.state.Service;
 import org.apache.ambari.server.state.ServiceComponent;
 import org.apache.ambari.server.state.repository.ClusterVersionSummary;
@@ -87,6 +88,8 @@ public class SecondaryNamenodeDeletedCheckTest {
     secondaryNamenodeDeletedCheck.config = config;
 
     m_services.clear();
+
+    Mockito.when(m_repositoryVersion.getType()).thenReturn(RepositoryType.STANDARD);
     Mockito.when(m_repositoryVersion.getRepositoryXml()).thenReturn(m_vdfXml);
     Mockito.when(m_vdfXml.getClusterSummary(Mockito.any(Cluster.class))).thenReturn(m_clusterVersionSummary);
     Mockito.when(m_clusterVersionSummary.getAvailableServiceNames()).thenReturn(m_services.keySet());

http://git-wip-us.apache.org/repos/asf/ambari/blob/c19f363c/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesMaintenanceModeCheckTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesMaintenanceModeCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesMaintenanceModeCheckTest.java
index 6577651..694a9b6 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesMaintenanceModeCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesMaintenanceModeCheckTest.java
@@ -27,6 +27,7 @@ import org.apache.ambari.server.controller.PrereqCheckRequest;
 import org.apache.ambari.server.orm.entities.RepositoryVersionEntity;
 import org.apache.ambari.server.state.Cluster;
 import org.apache.ambari.server.state.Clusters;
+import org.apache.ambari.server.state.RepositoryType;
 import org.apache.ambari.server.state.Service;
 import org.apache.ambari.server.state.StackId;
 import org.apache.ambari.server.state.State;
@@ -70,6 +71,7 @@ public class ServicesMaintenanceModeCheckTest {
   public void setup() throws Exception {
     m_services.clear();
 
+    Mockito.when(m_repositoryVersion.getType()).thenReturn(RepositoryType.STANDARD);
     Mockito.when(m_repositoryVersion.getVersion()).thenReturn("2.2.0.0-1234");
     Mockito.when(m_repositoryVersion.getStackId()).thenReturn(new StackId("HDP", "2.2"));
     Mockito.when(m_repositoryVersion.getRepositoryXml()).thenReturn(m_vdfXml);

http://git-wip-us.apache.org/repos/asf/ambari/blob/c19f363c/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesMapReduceDistributedCacheCheckTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesMapReduceDistributedCacheCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesMapReduceDistributedCacheCheckTest.java
index a8569cc..b32a782 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesMapReduceDistributedCacheCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesMapReduceDistributedCacheCheckTest.java
@@ -27,6 +27,7 @@ import org.apache.ambari.server.state.Cluster;
 import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.Config;
 import org.apache.ambari.server.state.DesiredConfig;
+import org.apache.ambari.server.state.RepositoryType;
 import org.apache.ambari.server.state.Service;
 import org.apache.ambari.server.state.repository.ClusterVersionSummary;
 import org.apache.ambari.server.state.repository.VersionDefinitionXml;
@@ -77,6 +78,8 @@ public class ServicesMapReduceDistributedCacheCheckTest {
     servicesMapReduceDistributedCacheCheck.config = config;
 
     m_services.clear();
+
+    Mockito.when(m_repositoryVersion.getType()).thenReturn(RepositoryType.STANDARD);
     Mockito.when(m_repositoryVersion.getRepositoryXml()).thenReturn(m_vdfXml);
     Mockito.when(m_vdfXml.getClusterSummary(Mockito.any(Cluster.class))).thenReturn(m_clusterVersionSummary);
     Mockito.when(m_clusterVersionSummary.getAvailableServiceNames()).thenReturn(m_services.keySet());

http://git-wip-us.apache.org/repos/asf/ambari/blob/c19f363c/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesNamenodeHighAvailabilityCheckTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesNamenodeHighAvailabilityCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesNamenodeHighAvailabilityCheckTest.java
index c7e8fd6..8c51add 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesNamenodeHighAvailabilityCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesNamenodeHighAvailabilityCheckTest.java
@@ -28,6 +28,7 @@ import org.apache.ambari.server.state.Cluster;
 import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.Config;
 import org.apache.ambari.server.state.DesiredConfig;
+import org.apache.ambari.server.state.RepositoryType;
 import org.apache.ambari.server.state.Service;
 import org.apache.ambari.server.state.repository.ClusterVersionSummary;
 import org.apache.ambari.server.state.repository.VersionDefinitionXml;
@@ -77,6 +78,8 @@ public class ServicesNamenodeHighAvailabilityCheckTest {
     servicesNamenodeHighAvailabilityCheck.config = config;
 
     m_services.clear();
+
+    Mockito.when(m_repositoryVersion.getType()).thenReturn(RepositoryType.STANDARD);
     Mockito.when(m_repositoryVersion.getRepositoryXml()).thenReturn(m_vdfXml);
     Mockito.when(m_vdfXml.getClusterSummary(Mockito.any(Cluster.class))).thenReturn(m_clusterVersionSummary);
     Mockito.when(m_clusterVersionSummary.getAvailableServiceNames()).thenReturn(m_services.keySet());

http://git-wip-us.apache.org/repos/asf/ambari/blob/c19f363c/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesNamenodeTruncateCheckTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesNamenodeTruncateCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesNamenodeTruncateCheckTest.java
index 545caf3..356d2cd 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesNamenodeTruncateCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesNamenodeTruncateCheckTest.java
@@ -31,6 +31,7 @@ import org.apache.ambari.server.orm.entities.RepositoryVersionEntity;
 import org.apache.ambari.server.state.Cluster;
 import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.Config;
+import org.apache.ambari.server.state.RepositoryType;
 import org.apache.ambari.server.state.Service;
 import org.apache.ambari.server.state.StackId;
 import org.apache.ambari.server.state.repository.ClusterVersionSummary;
@@ -99,6 +100,7 @@ public class ServicesNamenodeTruncateCheckTest {
       }
     };
 
+    Mockito.when(m_repositoryVersion.getType()).thenReturn(RepositoryType.STANDARD);
     Mockito.when(m_repositoryVersion.getVersion()).thenReturn("HDP-2.2.0.0");
     Mockito.when(m_repositoryVersion.getStackId()).thenReturn(new StackId("HDP", "2.2.0"));
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/c19f363c/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesTezDistributedCacheCheckTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesTezDistributedCacheCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesTezDistributedCacheCheckTest.java
index 96eefc1..0123f18 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesTezDistributedCacheCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesTezDistributedCacheCheckTest.java
@@ -27,6 +27,7 @@ import org.apache.ambari.server.state.Cluster;
 import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.Config;
 import org.apache.ambari.server.state.DesiredConfig;
+import org.apache.ambari.server.state.RepositoryType;
 import org.apache.ambari.server.state.Service;
 import org.apache.ambari.server.state.repository.ClusterVersionSummary;
 import org.apache.ambari.server.state.repository.VersionDefinitionXml;
@@ -77,6 +78,8 @@ public class ServicesTezDistributedCacheCheckTest {
     servicesTezDistributedCacheCheck.config = config;
 
     m_services.clear();
+
+    Mockito.when(m_repositoryVersion.getType()).thenReturn(RepositoryType.STANDARD);
     Mockito.when(m_repositoryVersion.getRepositoryXml()).thenReturn(m_vdfXml);
     Mockito.when(m_vdfXml.getClusterSummary(Mockito.any(Cluster.class))).thenReturn(m_clusterVersionSummary);
     Mockito.when(m_clusterVersionSummary.getAvailableServiceNames()).thenReturn(m_services.keySet());

http://git-wip-us.apache.org/repos/asf/ambari/blob/c19f363c/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesUpCheckTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesUpCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesUpCheckTest.java
index a851919..4d00644 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesUpCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesUpCheckTest.java
@@ -33,6 +33,7 @@ import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.ComponentInfo;
 import org.apache.ambari.server.state.Host;
 import org.apache.ambari.server.state.MaintenanceState;
+import org.apache.ambari.server.state.RepositoryType;
 import org.apache.ambari.server.state.Service;
 import org.apache.ambari.server.state.ServiceComponent;
 import org.apache.ambari.server.state.StackId;
@@ -87,6 +88,7 @@ public class ServicesUpCheckTest {
 
     m_services.clear();
 
+    Mockito.when(m_repositoryVersion.getType()).thenReturn(RepositoryType.STANDARD);
     Mockito.when(m_repositoryVersion.getVersion()).thenReturn("2.2.0.0-1234");
     Mockito.when(m_repositoryVersion.getStackId()).thenReturn(new StackId("HDP", "2.2"));
     Mockito.when(m_repositoryVersion.getRepositoryXml()).thenReturn(m_vdfXml);

http://git-wip-us.apache.org/repos/asf/ambari/blob/c19f363c/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesYarnWorkPreservingCheckTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesYarnWorkPreservingCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesYarnWorkPreservingCheckTest.java
index 331223d..5164a4f 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesYarnWorkPreservingCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesYarnWorkPreservingCheckTest.java
@@ -28,6 +28,7 @@ import org.apache.ambari.server.state.Cluster;
 import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.Config;
 import org.apache.ambari.server.state.DesiredConfig;
+import org.apache.ambari.server.state.RepositoryType;
 import org.apache.ambari.server.state.Service;
 import org.apache.ambari.server.state.repository.ClusterVersionSummary;
 import org.apache.ambari.server.state.repository.VersionDefinitionXml;
@@ -77,6 +78,7 @@ public class ServicesYarnWorkPreservingCheckTest {
     Configuration config = Mockito.mock(Configuration.class);
     servicesYarnWorkPreservingCheck.config = config;
 
+    Mockito.when(m_repositoryVersion.getType()).thenReturn(RepositoryType.STANDARD);
     Mockito.when(m_repositoryVersion.getRepositoryXml()).thenReturn(m_vdfXml);
     Mockito.when(m_vdfXml.getClusterSummary(Mockito.any(Cluster.class))).thenReturn(m_clusterVersionSummary);
     Mockito.when(m_clusterVersionSummary.getAvailableServiceNames()).thenReturn(m_services.keySet());

http://git-wip-us.apache.org/repos/asf/ambari/blob/c19f363c/ambari-server/src/test/java/org/apache/ambari/server/checks/StormShutdownWarningTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/StormShutdownWarningTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/StormShutdownWarningTest.java
index 1441256..a5e24f1 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/StormShutdownWarningTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/StormShutdownWarningTest.java
@@ -24,6 +24,7 @@ import org.apache.ambari.server.controller.PrereqCheckRequest;
 import org.apache.ambari.server.orm.entities.RepositoryVersionEntity;
 import org.apache.ambari.server.state.Cluster;
 import org.apache.ambari.server.state.Clusters;
+import org.apache.ambari.server.state.RepositoryType;
 import org.apache.ambari.server.state.Service;
 import org.apache.ambari.server.state.StackId;
 import org.apache.ambari.server.state.repository.ClusterVersionSummary;
@@ -66,6 +67,8 @@ public class StormShutdownWarningTest extends EasyMockSupport {
   @Before
   public void setup() throws Exception {
     m_services.clear();
+
+    Mockito.when(m_repositoryVersion.getType()).thenReturn(RepositoryType.STANDARD);
     Mockito.when(m_repositoryVersion.getRepositoryXml()).thenReturn(m_vdfXml);
     Mockito.when(m_vdfXml.getClusterSummary(Mockito.any(Cluster.class))).thenReturn(m_clusterVersionSummary);
     Mockito.when(m_clusterVersionSummary.getAvailableServiceNames()).thenReturn(m_services.keySet());

http://git-wip-us.apache.org/repos/asf/ambari/blob/c19f363c/ambari-server/src/test/java/org/apache/ambari/server/state/CheckHelperTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/CheckHelperTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/CheckHelperTest.java
index 0301431..14a1eaf 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/state/CheckHelperTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/state/CheckHelperTest.java
@@ -100,6 +100,8 @@ public class CheckHelperTest {
     updateChecksRegistry.add(m_mockCheck);
 
     PrereqCheckRequest request = new PrereqCheckRequest("cluster");
+    request.setTargetRepositoryVersion(m_repositoryVersion);
+
     helper.performChecks(request, updateChecksRegistry, configuration);
 
     Assert.assertEquals(PrereqCheckStatus.PASS, request.getResult(m_mockCheckDescription));
@@ -128,6 +130,7 @@ public class CheckHelperTest {
     updateChecksRegistry.add(m_mockCheck);
 
     PrereqCheckRequest request = new PrereqCheckRequest("cluster");
+
     helper.performChecks(request, updateChecksRegistry, configuration);
 
 
@@ -151,6 +154,8 @@ public class CheckHelperTest {
     Mockito.when(m_mockPerform.toString()).thenThrow(new RuntimeException());
 
     PrereqCheckRequest request = new PrereqCheckRequest("cluster");
+    request.setTargetRepositoryVersion(m_repositoryVersion);
+
     helper.performChecks(request, updateChecksRegistry, configuration);
 
     Assert.assertEquals(PrereqCheckStatus.FAIL, request.getResult(m_mockCheckDescription));
@@ -173,6 +178,8 @@ public class CheckHelperTest {
     Mockito.when(m_mockPerform.toString()).thenThrow(new RuntimeException());
 
     PrereqCheckRequest request = new PrereqCheckRequest("cluster");
+    request.setTargetRepositoryVersion(m_repositoryVersion);
+
     helper.performChecks(request, updateChecksRegistry, configuration);
 
     Assert.assertEquals(PrereqCheckStatus.BYPASS, request.getResult(m_mockCheckDescription));


[03/50] ambari git commit: AMBARI-22203. ZKFC start failed due to hadoop-hdfs-zkfc is not supported (aonishuk)

Posted by am...@apache.org.
AMBARI-22203. ZKFC start failed due to hadoop-hdfs-zkfc is not supported (aonishuk)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/8ec33db0
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/8ec33db0
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/8ec33db0

Branch: refs/heads/branch-feature-AMBARI-22008
Commit: 8ec33db0803a7c7a7ef51b87e98bc610c9c72196
Parents: aeb1865
Author: Andrew Onishuk <ao...@hortonworks.com>
Authored: Wed Oct 11 15:57:51 2017 +0300
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Wed Oct 11 15:57:51 2017 +0300

----------------------------------------------------------------------
 .../resources/stacks/HDP/2.0.6/properties/stack_packages.json     | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/8ec33db0/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_packages.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_packages.json b/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_packages.json
index 2db0a74..8f685f6 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_packages.json
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_packages.json
@@ -360,6 +360,7 @@
         },
         "ZKFC": {
           "STACK-SELECT-PACKAGE": "hadoop-hdfs-zkfc",
+          "LEGACY": "hadoop-client",
           "INSTALL": [
             "hadoop-hdfs-zkfc"
           ],
@@ -367,7 +368,7 @@
             "hadoop-hdfs-zkfc"
           ],
           "STANDARD": [
-            "hadoop-hdfs-zkfc"
+            "hadoop-client"
           ]
         }
       },


[20/50] ambari git commit: AMBARI-22218 Log Search UI generated by maven build uses mock data instead of real API. (ababiichuk)

Posted by am...@apache.org.
AMBARI-22218 Log Search UI generated by maven build uses mock data instead of real API. (ababiichuk)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/527e45d5
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/527e45d5
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/527e45d5

Branch: refs/heads/branch-feature-AMBARI-22008
Commit: 527e45d50f2a6faebd7cf842297aa37ef53f8b16
Parents: 68df85d
Author: ababiichuk <ab...@hortonworks.com>
Authored: Thu Oct 12 15:54:31 2017 +0300
Committer: ababiichuk <ab...@hortonworks.com>
Committed: Thu Oct 12 17:15:32 2017 +0300

----------------------------------------------------------------------
 ambari-logsearch/ambari-logsearch-web/package.json | 2 +-
 ambari-logsearch/ambari-logsearch-web/pom.xml      | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/527e45d5/ambari-logsearch/ambari-logsearch-web/package.json
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/package.json b/ambari-logsearch/ambari-logsearch-web/package.json
index f8525c4..2c6aa8d 100644
--- a/ambari-logsearch/ambari-logsearch-web/package.json
+++ b/ambari-logsearch/ambari-logsearch-web/package.json
@@ -6,7 +6,7 @@
     "ng": "ng",
     "start": "webpack-dev-server --port=4200",
     "build": "webpack",
-    "build-prod": "NODE_ENV='production' webpack -p",
+    "build-prod": "NODE_ENV=production webpack -p",
     "test": "karma start ./karma.conf.js",
     "lint": "ng lint",
     "e2e": "protractor ./protractor.conf.js",

http://git-wip-us.apache.org/repos/asf/ambari/blob/527e45d5/ambari-logsearch/ambari-logsearch-web/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/pom.xml b/ambari-logsearch/ambari-logsearch-web/pom.xml
index a0621d9..953f0df 100644
--- a/ambari-logsearch/ambari-logsearch-web/pom.xml
+++ b/ambari-logsearch/ambari-logsearch-web/pom.xml
@@ -76,6 +76,9 @@
             <!-- optional: the default phase is "generate-resources" -->
             <phase>generate-resources</phase>
             <configuration>
+              <environmentVariables>
+                <NODE_ENV>production</NODE_ENV>
+              </environmentVariables>
               <!-- optional: if not specified, it will run webpack's default
               build (and you can remove this whole <configuration> section.) -->
               <arguments>-p</arguments>


[45/50] ambari git commit: AMBARI-22234 Optimizing Ranger KMS imports (mugdha)

Posted by am...@apache.org.
AMBARI-22234 Optimizing Ranger KMS imports (mugdha)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/d6cd303d
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/d6cd303d
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/d6cd303d

Branch: refs/heads/branch-feature-AMBARI-22008
Commit: d6cd303d0207ac6ffcdbc16d129758bba9494423
Parents: e19029c
Author: Mugdha Varadkar <mu...@apache.org>
Authored: Tue Oct 17 11:22:05 2017 +0530
Committer: Mugdha Varadkar <mu...@apache.org>
Committed: Tue Oct 17 11:24:13 2017 +0530

----------------------------------------------------------------------
 .../0.5.0.2.3/package/scripts/kms_server.py     | 21 ++++++++++----------
 .../1.0.0.3.0/package/scripts/kms_server.py     | 19 +++++++++---------
 2 files changed, 21 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/d6cd303d/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/package/scripts/kms_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/package/scripts/kms_server.py b/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/package/scripts/kms_server.py
index fcf2478..0b37489 100755
--- a/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/package/scripts/kms_server.py
+++ b/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/package/scripts/kms_server.py
@@ -27,9 +27,10 @@ from resource_management.libraries.functions.format import format
 from resource_management.core.logger import Logger
 from resource_management.core import shell
 from resource_management.libraries.functions.default import default
-from kms import kms, setup_kms_db, setup_java_patch, enable_kms_plugin, setup_kms_jce, update_password_configs
 from kms_service import kms_service
 
+import kms
+
 class KmsServer(Script):
 
   def install(self, env):
@@ -44,9 +45,9 @@ class KmsServer(Script):
       sudo = True
     )
 
-    setup_kms_db()
+    kms.setup_kms_db()
     self.configure(env)
-    setup_java_patch()
+    kms.setup_java_patch()
 
   def stop(self, env, upgrade_type=None):
     import params
@@ -63,9 +64,9 @@ class KmsServer(Script):
 
     env.set_params(params)
     self.configure(env)
-    enable_kms_plugin()
-    setup_kms_jce()
-    update_password_configs()
+    kms.enable_kms_plugin()
+    kms.setup_kms_jce()
+    kms.update_password_configs()
     kms_service(action = 'start', upgrade_type=upgrade_type)
 
   def status(self, env):
@@ -87,15 +88,15 @@ class KmsServer(Script):
     import params
 
     env.set_params(params)
-    kms()
+    kms.kms()
 
   def pre_upgrade_restart(self, env, upgrade_type=None):
     import params
     env.set_params(params)
 
     stack_select.select_packages(params.version)
-    kms(upgrade_type=upgrade_type)
-    setup_java_patch()
+    kms.kms(upgrade_type=upgrade_type)
+    kms.setup_java_patch()
 
   def setup_ranger_kms_database(self, env):
     import params
@@ -107,7 +108,7 @@ class KmsServer(Script):
 
     stack_version = upgrade_stack[1]
     Logger.info(format('Setting Ranger KMS database schema, using version {stack_version}'))
-    setup_kms_db(stack_version=stack_version)
+    kms.setup_kms_db(stack_version=stack_version)
     
   def get_log_folder(self):
     import params

http://git-wip-us.apache.org/repos/asf/ambari/blob/d6cd303d/ambari-server/src/main/resources/common-services/RANGER_KMS/1.0.0.3.0/package/scripts/kms_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/RANGER_KMS/1.0.0.3.0/package/scripts/kms_server.py b/ambari-server/src/main/resources/common-services/RANGER_KMS/1.0.0.3.0/package/scripts/kms_server.py
index 4c313c4..4708da1 100755
--- a/ambari-server/src/main/resources/common-services/RANGER_KMS/1.0.0.3.0/package/scripts/kms_server.py
+++ b/ambari-server/src/main/resources/common-services/RANGER_KMS/1.0.0.3.0/package/scripts/kms_server.py
@@ -27,10 +27,11 @@ from resource_management.libraries.functions.format import format
 from resource_management.core.logger import Logger
 from resource_management.core import shell
 from resource_management.libraries.functions.default import default
-from kms import kms, setup_kms_db, setup_java_patch, enable_kms_plugin, setup_kms_jce
 from kms_service import kms_service
 import upgrade
 
+import kms
+
 class KmsServer(Script):
 
   def install(self, env):
@@ -38,9 +39,9 @@ class KmsServer(Script):
     import params
     env.set_params(params)
 
-    setup_kms_db()
+    kms.setup_kms_db()
     self.configure(env)
-    setup_java_patch()
+    kms.setup_java_patch()
 
   def stop(self, env, upgrade_type=None):
     import params
@@ -57,8 +58,8 @@ class KmsServer(Script):
 
     env.set_params(params)
     self.configure(env)
-    enable_kms_plugin()
-    setup_kms_jce()
+    kms.enable_kms_plugin()
+    kms.setup_kms_jce()
     kms_service(action = 'start', upgrade_type=upgrade_type)
 
   def status(self, env):
@@ -80,15 +81,15 @@ class KmsServer(Script):
     import params
 
     env.set_params(params)
-    kms()
+    kms.kms()
 
   def pre_upgrade_restart(self, env, upgrade_type=None):
     import params
     env.set_params(params)
 
     upgrade.prestart(env)
-    kms(upgrade_type=upgrade_type)
-    setup_java_patch()
+    kms.kms(upgrade_type=upgrade_type)
+    kms.setup_java_patch()
 
   def setup_ranger_kms_database(self, env):
     import params
@@ -100,7 +101,7 @@ class KmsServer(Script):
 
     stack_version = upgrade_stack[1]
     Logger.info(format('Setting Ranger KMS database schema, using version {stack_version}'))
-    setup_kms_db(stack_version=stack_version)
+    kms.setup_kms_db(stack_version=stack_version)
 
   def get_log_folder(self):
     import params


[27/50] ambari git commit: AMBARI-22235. Druid service check failed during EU. (b-slim via nishantmonu51)

Posted by am...@apache.org.
AMBARI-22235. Druid service check failed during EU. (b-slim via nishantmonu51)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/c8c1812b
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/c8c1812b
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/c8c1812b

Branch: refs/heads/branch-feature-AMBARI-22008
Commit: c8c1812b07ba0f64093190519cf829df8ea639d0
Parents: 20faae7
Author: Nishant <ni...@gmail.com>
Authored: Fri Oct 13 22:06:41 2017 +0530
Committer: Nishant <ni...@gmail.com>
Committed: Fri Oct 13 22:06:41 2017 +0530

----------------------------------------------------------------------
 .../stacks/HDP/2.6/services/DRUID/kerberos.json | 45 ++++----------------
 .../HDP/2.6/services/SUPERSET/kerberos.json     | 10 +----
 2 files changed, 11 insertions(+), 44 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/c8c1812b/ambari-server/src/main/resources/stacks/HDP/2.6/services/DRUID/kerberos.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/services/DRUID/kerberos.json b/ambari-server/src/main/resources/stacks/HDP/2.6/services/DRUID/kerberos.json
index 198c351..f186e31 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.6/services/DRUID/kerberos.json
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/services/DRUID/kerberos.json
@@ -16,7 +16,7 @@
         {
           "name": "druid",
           "principal": {
-            "value": "${druid-env/druid_user}@${realm}",
+            "value": "${druid-env/druid_user}${principal_suffix}@${realm}",
             "type": "user",
             "configuration": "druid-common/druid.hadoop.security.kerberos.principal",
             "local_username": "${druid-env/druid_user}"
@@ -41,49 +41,22 @@
       ],
       "components": [
         {
-          "name": "DRUID_HISTORICAL",
-          "identities": [
-            {
-              "name": "druid_druid_historical_druid",
-              "reference": "/druid"
-            }
-          ]
+          "name": "DRUID_HISTORICAL"
         },
         {
-          "name": "DRUID_BROKER",
-          "identities": [
-            {
-              "name": "druid_druid_broker_druid",
-              "reference": "/druid"
-            }
-          ]
+          "name": "DRUID_BROKER"
         },
         {
-          "name": "DRUID_OVERLORD",
-          "identities": [
-            {
-              "name": "druid_druid_historical_druid",
-              "reference": "/druid"
-            }
-          ]
+          "name": "DRUID_OVERLORD"
         },
         {
-          "name": "DRUID_COORDINATOR",
-          "identities": [
-            {
-              "name": "druid_druid_coordinator_druid",
-              "reference": "/druid"
-            }
-          ]
+          "name": "DRUID_COORDINATOR"
         },
         {
-          "name": "DRUID_MIDDLEMANAGER",
-          "identities": [
-            {
-              "name": "druid_druid_middlemanager_druid",
-              "reference": "/druid"
-            }
-          ]
+          "name": "DRUID_MIDDLEMANAGER"
+        },
+        {
+          "name": "DRUID_ROUTER"
         }
       ],
       "configurations": [

http://git-wip-us.apache.org/repos/asf/ambari/blob/c8c1812b/ambari-server/src/main/resources/stacks/HDP/2.6/services/SUPERSET/kerberos.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/services/SUPERSET/kerberos.json b/ambari-server/src/main/resources/stacks/HDP/2.6/services/SUPERSET/kerberos.json
index 5d5125d..0de6737 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.6/services/SUPERSET/kerberos.json
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/services/SUPERSET/kerberos.json
@@ -6,7 +6,7 @@
         {
           "name": "superset",
           "principal": {
-            "value": "${superset-env/superset_user}@${realm}",
+            "value": "${superset-env/superset_user}${principal_suffix}@${realm}",
             "type": "user",
             "configuration": "superset/KERBEROS_PRINCIPAL",
             "local_username": "${superset-env/superset_user}"
@@ -31,13 +31,7 @@
       ],
       "components": [
         {
-          "name": "SUPERSET",
-          "identities": [
-            {
-              "name": "superset_superset_superset",
-              "reference": "/superset"
-            }
-          ]
+          "name": "SUPERSET"
         }
       ],
       "configurations": [


[02/50] ambari git commit: AMBARI-22174. Remove unnecessary Kerberos related properties from BlueprintConfigurationProcessor (magyari_sandor)

Posted by am...@apache.org.
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/branch-feature-AMBARI-22008
Commit: aeb1865c95b86980ac31bc9362203f4bd84a027d
Parents: 33d67f3
Author: Sandor Magyari <sm...@hortonworks.com>
Authored: Mon Jan 16 14:30:28 2017 +0100
Committer: Sandor Magyari <sm...@hortonworks.com>
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/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java
@@ -897,11 +897,6 @@ public class BlueprintConfigurationProcessorTest extends EasyMockSupport {
     assertEquals("Falcon Broker URL property not properly exported",
       createExportedAddress(expectedPortNum, expectedHostGroupName), falconStartupProperties.get("*.broker.url"));
 
-    assertEquals("Falcon Kerberos Principal property not properly exported",
-      "falcon/" + "%HOSTGROUP::" + expectedHostGroupName + "%" + "@EXAMPLE.COM", falconStartupProperties.get("*.falcon.service.authentication.kerberos.principal"));
-
-    assertEquals("Falcon Kerberos HTTP Principal property not properly exported",
-      "HTTP/" + "%HOSTGROUP::" + expectedHostGroupName + "%" + "@EXAMPLE.COM", falconStartupProperties.get("*.falcon.http.authentication.kerberos.principal"));
   }
 
   @Test
@@ -1598,8 +1593,6 @@ public class BlueprintConfigurationProcessorTest extends EasyMockSupport {
     assertEquals("hive property not properly exported",
       createExportedHostName(expectedHostGroupName) + "," + createExportedHostName(expectedHostGroupNameTwo),
       webHCatSiteProperties.get("templeton.hive.properties"));
-    assertEquals("hive property not properly exported",
-      createExportedHostName(expectedHostGroupName), webHCatSiteProperties.get("templeton.kerberos.principal"));
 
     assertEquals("hive property not properly exported",
       createExportedHostName(expectedHostGroupName) + "," + createExportedHostName(expectedHostGroupNameTwo), coreSiteProperties.get("hadoop.proxyuser.hive.hosts"));
@@ -1695,8 +1688,6 @@ public class BlueprintConfigurationProcessorTest extends EasyMockSupport {
     assertEquals("hive property not properly exported",
       createExportedHostName(expectedHostGroupName) + "," + createExportedHostName(expectedHostGroupNameTwo),
       webHCatSiteProperties.get("templeton.hive.properties"));
-    assertEquals("hive property not properly exported",
-      createExportedHostName(expectedHostGroupName), webHCatSiteProperties.get("templeton.kerberos.principal"));
 
     assertEquals("hive property not properly exported",
       createExportedHostName(expectedHostGroupName) + "," + createExportedHostName(expectedHostGroupNameTwo), coreSiteProperties.get("hadoop.proxyuser.hive.hosts"));
@@ -1791,10 +1782,6 @@ public class BlueprintConfigurationProcessorTest extends EasyMockSupport {
     assertEquals("oozie property not exported correctly",
       createExportedHostName(expectedHostGroupName), oozieSiteProperties.get("oozie.base.url"));
     assertEquals("oozie property not exported correctly",
-      createExportedHostName(expectedHostGroupName), oozieSiteProperties.get("oozie.authentication.kerberos.principal"));
-    assertEquals("oozie property not exported correctly",
-      createExportedHostName(expectedHostGroupName), oozieSiteProperties.get("oozie.service.HadoopAccessorService.kerberos.principal"));
-    assertEquals("oozie property not exported correctly",
       createExportedHostName(expectedHostGroupName) + "," + createExportedHostName(expectedHostGroupNameTwo), coreSiteProperties.get("hadoop.proxyuser.oozie.hosts"));
 
     // verify that the oozie properties that can refer to an external DB are not included in the export
@@ -3302,10 +3289,6 @@ public class BlueprintConfigurationProcessorTest extends EasyMockSupport {
     assertEquals("oozie property not updated correctly",
       createExportedHostName(expectedHostGroupName, expectedPortNum), oozieSiteProperties.get("oozie.base.url"));
     assertEquals("oozie property not updated correctly",
-      createExportedHostName(expectedHostGroupName), oozieSiteProperties.get("oozie.authentication.kerberos.principal"));
-    assertEquals("oozie property not updated correctly",
-      createExportedHostName(expectedHostGroupName), oozieSiteProperties.get("oozie.service.HadoopAccessorService.kerberos.principal"));
-    assertEquals("oozie property not updated correctly",
       createExportedHostName(expectedHostGroupName) + "," + createExportedHostName(expectedHostGroupNameTwo), coreSiteProperties.get("hadoop.proxyuser.oozie.hosts"));
     assertEquals("oozie property not updated correctly",
       createExportedAddress("2181", expectedHostGroupName) + "," + createExportedAddress("2181", expectedHostGroupNameTwo), oozieSiteProperties.get("oozie.zookeeper.connection.string"));
@@ -4477,11 +4460,6 @@ public class BlueprintConfigurationProcessorTest extends EasyMockSupport {
     assertEquals("Falcon Broker URL property not properly exported",
       expectedHostName + ":" + expectedPortNum, falconStartupProperties.get("*.broker.url"));
 
-    assertEquals("Falcon Kerberos Principal property not properly exported",
-      "falcon/" + expectedHostName + "@EXAMPLE.COM", falconStartupProperties.get("*.falcon.service.authentication.kerberos.principal"));
-
-    assertEquals("Falcon Kerberos HTTP Principal property not properly exported",
-      "HTTP/" + expectedHostName + "@EXAMPLE.COM", falconStartupProperties.get("*.falcon.http.authentication.kerberos.principal"));
   }
 
   @Test
@@ -4523,12 +4501,6 @@ public class BlueprintConfigurationProcessorTest extends EasyMockSupport {
 
     assertEquals("Falcon Broker URL property not properly exported",
       expectedHostName + ":" + expectedPortNum, falconStartupProperties.get("*.broker.url"));
-
-    assertEquals("Falcon Kerberos Principal property not properly exported",
-      "falcon/" + expectedHostName + "@EXAMPLE.COM", falconStartupProperties.get("*.falcon.service.authentication.kerberos.principal"));
-
-    assertEquals("Falcon Kerberos HTTP Principal property not properly exported",
-      "HTTP/" + expectedHostName + "@EXAMPLE.COM", falconStartupProperties.get("*.falcon.http.authentication.kerberos.principal"));
   }
 
   @Test


[36/50] ambari git commit: AMBARI-22232 : ADDENDUM Need to add a new property to support proxy users for Atlas service (Vishal Suvagia via mugdha).

Posted by am...@apache.org.
AMBARI-22232 : ADDENDUM Need to add a new property to support proxy users for Atlas service (Vishal Suvagia via mugdha).


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/d4458daa
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/d4458daa
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/d4458daa

Branch: refs/heads/branch-feature-AMBARI-22008
Commit: d4458daa9bf5209eb2f86409185221cdbd749b13
Parents: e219186
Author: Vishal Suvagia <vi...@yahoo.com>
Authored: Mon Oct 16 15:16:17 2017 +0530
Committer: Mugdha Varadkar <mu...@apache.org>
Committed: Mon Oct 16 15:35:35 2017 +0530

----------------------------------------------------------------------
 .../upgrades/AtlasProxyUserConfigCalculation.java  | 17 +++++++++++++++++
 .../AtlasProxyUserConfigCalculationTest.java       | 17 +++++++++++++++++
 2 files changed, 34 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/d4458daa/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/AtlasProxyUserConfigCalculation.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/AtlasProxyUserConfigCalculation.java b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/AtlasProxyUserConfigCalculation.java
index 85fb200..40d64b5 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/AtlasProxyUserConfigCalculation.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/AtlasProxyUserConfigCalculation.java
@@ -1,3 +1,20 @@
+/*
+ * 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.serveraction.upgrades;
 
 import org.apache.ambari.server.AmbariException;

http://git-wip-us.apache.org/repos/asf/ambari/blob/d4458daa/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/AtlasProxyUserConfigCalculationTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/AtlasProxyUserConfigCalculationTest.java b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/AtlasProxyUserConfigCalculationTest.java
index 3f8bca9..33ec7f3 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/AtlasProxyUserConfigCalculationTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/AtlasProxyUserConfigCalculationTest.java
@@ -1,3 +1,20 @@
+/*
+ * 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.serveraction.upgrades;
 
 import com.google.inject.Injector;


[12/50] ambari git commit: AMBARI-22202 : Hive View 2.0 in Ambari 2.5.1 does not use the specified YARN queue when using the "Upload Table" feature. (nitirajrathore)

Posted by am...@apache.org.
AMBARI-22202 : Hive View 2.0 in Ambari 2.5.1 does not use the specified YARN queue when using the "Upload Table" feature. (nitirajrathore)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/5de82da3
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/5de82da3
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/5de82da3

Branch: refs/heads/branch-feature-AMBARI-22008
Commit: 5de82da3b293a0306d796d79960af45bc7c88372
Parents: 85fb356
Author: Nitiraj Singh Rathore <ni...@gmail.com>
Authored: Thu Oct 12 12:45:56 2017 +0530
Committer: Nitiraj Singh Rathore <ni...@gmail.com>
Committed: Thu Oct 12 12:47:12 2017 +0530

----------------------------------------------------------------------
 .../view/hive20/resources/browser/DDLProxy.java | 154 +++++++++++++------
 .../hive20/resources/uploads/UploadService.java |  12 +-
 .../uploads/query/InsertFromQueryInput.java     |  13 +-
 .../databases/database/tables/upload-table.js   |  12 ++
 4 files changed, 140 insertions(+), 51 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/5de82da3/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/resources/browser/DDLProxy.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/resources/browser/DDLProxy.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/resources/browser/DDLProxy.java
index 77857f9..6d793d3 100644
--- a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/resources/browser/DDLProxy.java
+++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/resources/browser/DDLProxy.java
@@ -19,6 +19,7 @@
 package org.apache.ambari.view.hive20.resources.browser;
 
 import com.google.common.base.Function;
+import com.google.common.base.Joiner;
 import com.google.common.base.Optional;
 import com.google.common.base.Predicate;
 import com.google.common.base.Strings;
@@ -54,6 +55,8 @@ import org.apache.ambari.view.hive20.resources.jobs.viewJobs.Job;
 import org.apache.ambari.view.hive20.resources.jobs.viewJobs.JobController;
 import org.apache.ambari.view.hive20.resources.jobs.viewJobs.JobImpl;
 import org.apache.ambari.view.hive20.resources.jobs.viewJobs.JobResourceManager;
+import org.apache.ambari.view.hive20.resources.settings.Setting;
+import org.apache.ambari.view.hive20.resources.settings.SettingsResourceManager;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -73,11 +76,13 @@ public class DDLProxy {
 
   private final ViewContext context;
   private final TableMetaParserImpl tableMetaParser;
+  private SettingsResourceManager settingsResourceManager;
 
   @Inject
-  public DDLProxy(ViewContext context, TableMetaParserImpl tableMetaParser) {
+  public DDLProxy(ViewContext context, TableMetaParserImpl tableMetaParser, SettingsResourceManager settingsResourceManager) {
     this.context = context;
     this.tableMetaParser = tableMetaParser;
+    this.settingsResourceManager = settingsResourceManager;
     LOG.info("Creating DDLProxy");
   }
 
@@ -130,15 +135,19 @@ public class DDLProxy {
   }
 
   public Job getColumnStatsJob(final String databaseName, final String tableName, final String columnName,
-                         JobResourceManager resourceManager) throws ServiceException {
+                               JobResourceManager resourceManager) throws ServiceException {
     FetchColumnStatsQueryGenerator queryGenerator = new FetchColumnStatsQueryGenerator(databaseName, tableName,
-      columnName);
+        columnName);
     Optional<String> q = queryGenerator.getQuery();
     String jobTitle = "Fetch column stats for " + databaseName + "." + tableName + "." + columnName;
-    if(q.isPresent()) {
+    if (q.isPresent()) {
       String query = q.get();
+      Optional<String> settingsString = generateSettingsString();
+      if (settingsString.isPresent()) {
+        query = settingsString.get() + query;
+      }
       return createJob(databaseName, query, jobTitle, resourceManager);
-    }else{
+    } else {
       throw new ServiceException("Failed to generate job for {}" + jobTitle);
     }
   }
@@ -228,32 +237,56 @@ public class DDLProxy {
       tableMeta.setDatabase(databaseName);
     }
     Optional<String> createTableQuery = new CreateTableQueryGenerator(tableMeta).getQuery();
-    if(createTableQuery.isPresent()) {
+    if (createTableQuery.isPresent()) {
       LOG.info("generated create table query : {}", createTableQuery);
       return createTableQuery.get();
-    }else {
+    } else {
       throw new ServiceException("could not generate create table query for database : " + databaseName + " table : " + tableMeta.getTable());
     }
   }
 
   public Job createTable(String databaseName, TableMeta tableMeta, JobResourceManager resourceManager) throws ServiceException {
     String createTableQuery = this.generateCreateTableDDL(databaseName, tableMeta);
+    Optional<String> settingsString = generateSettingsString();
+    if (settingsString.isPresent()) {
+      createTableQuery = settingsString.get() + createTableQuery;
+    }
     String jobTitle = "Create table " + tableMeta.getDatabase() + "." + tableMeta.getTable();
+
     return createJob(databaseName, createTableQuery, jobTitle, resourceManager);
   }
 
+  private Optional<String> generateSettingsString() {
+    List<Setting> settings = settingsResourceManager.getSettings();
+    if (null != settings && !settings.isEmpty()) {
+      return Optional.of(Joiner.on(";\n").join(FluentIterable.from(settings).transform(new Function<Setting, String>() {
+        @Override
+        public String apply(Setting setting) {
+          return "set " + setting.getKey() + "=" + setting.getValue();
+        }
+      }).toList()) + ";\n"/*need this ;\n at the end of last line also.*/);
+    } else {
+      return Optional.absent();
+    }
+  }
+
   public Job deleteTable(String databaseName, String tableName, JobResourceManager resourceManager) throws ServiceException {
     String deleteTableQuery = generateDeleteTableDDL(databaseName, tableName);
     String jobTitle = "Delete table " + databaseName + "." + tableName;
+    Optional<String> settingsString = generateSettingsString();
+    if (settingsString.isPresent()) {
+      deleteTableQuery = settingsString.get() + deleteTableQuery;
+    }
+
     return createJob(databaseName, deleteTableQuery, jobTitle, resourceManager);
   }
 
   public String generateDeleteTableDDL(String databaseName, String tableName) throws ServiceException {
     Optional<String> deleteTableQuery = new DeleteTableQueryGenerator(databaseName, tableName).getQuery();
-    if(deleteTableQuery.isPresent()) {
+    if (deleteTableQuery.isPresent()) {
       LOG.info("deleting table {} with query {}", databaseName + "." + tableName, deleteTableQuery);
       return deleteTableQuery.get();
-    }else{
+    } else {
       throw new ServiceException("Failed to generate query for delete table " + databaseName + "." + tableName);
     }
   }
@@ -261,6 +294,11 @@ public class DDLProxy {
   public Job alterTable(ViewContext context, ConnectionConfig hiveConnectionConfig, String databaseName, String oldTableName, TableMeta newTableMeta, JobResourceManager resourceManager) throws ServiceException {
     String alterQuery = generateAlterTableQuery(context, hiveConnectionConfig, databaseName, oldTableName, newTableMeta);
     String jobTitle = "Alter table " + databaseName + "." + oldTableName;
+    Optional<String> settingsString = generateSettingsString();
+    if (settingsString.isPresent()) {
+      alterQuery = settingsString.get() + alterQuery;
+    }
+
     return createJob(databaseName, alterQuery, jobTitle, resourceManager);
   }
 
@@ -272,58 +310,72 @@ public class DDLProxy {
   public String generateAlterTableQuery(TableMeta oldTableMeta, TableMeta newTableMeta) throws ServiceException {
     AlterTableQueryGenerator queryGenerator = new AlterTableQueryGenerator(oldTableMeta, newTableMeta);
     Optional<String> alterQuery = queryGenerator.getQuery();
-    if(alterQuery.isPresent()){
+    if (alterQuery.isPresent()) {
       return alterQuery.get();
-    }else{
+    } else {
       throw new ServiceException("Failed to generate alter table query for table " + oldTableMeta.getDatabase() + "." + oldTableMeta.getTable() + ". No difference was found.");
     }
   }
 
   public Job renameTable(String oldDatabaseName, String oldTableName, String newDatabaseName, String newTableName,
                          JobResourceManager resourceManager)
-    throws ServiceException {
+      throws ServiceException {
     RenameTableQueryGenerator queryGenerator = new RenameTableQueryGenerator(oldDatabaseName, oldTableName,
-      newDatabaseName, newTableName);
+        newDatabaseName, newTableName);
     Optional<String> renameTable = queryGenerator.getQuery();
-    if(renameTable.isPresent()) {
+    if (renameTable.isPresent()) {
       String renameQuery = renameTable.get();
       String jobTitle = "Rename table " + oldDatabaseName + "." + oldTableName + " to " + newDatabaseName + "." +
-        newTableName;
+          newTableName;
+      Optional<String> settingsString = generateSettingsString();
+      if (settingsString.isPresent()) {
+        renameQuery = settingsString.get() + renameQuery;
+      }
       return createJob(oldDatabaseName, renameQuery, jobTitle, resourceManager);
-    }else{
+    } else {
       throw new ServiceException("Failed to generate rename table query for table " + oldDatabaseName + "." +
-        oldTableName);
+          oldTableName);
     }
   }
 
   public Job deleteDatabase(String databaseName, JobResourceManager resourceManager) throws ServiceException {
     DeleteDatabaseQueryGenerator queryGenerator = new DeleteDatabaseQueryGenerator(databaseName);
     Optional<String> deleteDatabase = queryGenerator.getQuery();
-    if(deleteDatabase.isPresent()) {
+    if (deleteDatabase.isPresent()) {
       String deleteQuery = deleteDatabase.get();
-      return createJob(databaseName, deleteQuery, "Delete database " + databaseName , resourceManager);
-    }else{
+      Optional<String> settingsString = generateSettingsString();
+      if (settingsString.isPresent()) {
+        deleteQuery = settingsString.get() + deleteQuery;
+      }
+
+      return createJob(databaseName, deleteQuery, "Delete database " + databaseName, resourceManager);
+    } else {
       throw new ServiceException("Failed to generate delete database query for database " + databaseName);
     }
   }
 
   public Job createDatabase(String databaseName, JobResourceManager resourceManager) throws ServiceException {
     CreateDatabaseQueryGenerator queryGenerator = new CreateDatabaseQueryGenerator(databaseName);
-    Optional<String> deleteDatabase = queryGenerator.getQuery();
-    if(deleteDatabase.isPresent()) {
-      String deleteQuery = deleteDatabase.get();
-      return createJob("default", deleteQuery, "CREATE DATABASE " + databaseName , resourceManager);
-    }else{
+    Optional<String> createDatabase = queryGenerator.getQuery();
+    if (createDatabase.isPresent()) {
+      String createQuery = createDatabase.get();
+      Optional<String> settingsString = generateSettingsString();
+      if (settingsString.isPresent()) {
+        createQuery = settingsString.get() + createQuery;
+      }
+
+      return createJob("default", createQuery, "CREATE DATABASE " + databaseName, resourceManager);
+    } else {
       throw new ServiceException("Failed to generate create database query for database " + databaseName);
     }
   }
 
-  public Job createJob(String databaseName, String deleteQuery, String jobTitle, JobResourceManager resourceManager)
-    throws ServiceException {
-    LOG.info("Creating job for : {}", deleteQuery );
+  public Job createJob(String databaseName, String query, String jobTitle, JobResourceManager resourceManager)
+      throws ServiceException {
+    LOG.info("Creating job for : {}", query);
     Map jobInfo = new HashMap<>();
     jobInfo.put("title", jobTitle);
-    jobInfo.put("forcedContent", deleteQuery);
+    jobInfo.put("forcedContent", query);
     jobInfo.put("dataBase", databaseName);
     jobInfo.put("referrer", JobImpl.REFERRER.INTERNAL.name());
 
@@ -334,7 +386,7 @@ public class DDLProxy {
       LOG.info("returning job with id {} for {}", returnableJob.getId(), jobTitle);
       return returnableJob;
     } catch (Throwable e) {
-      LOG.error("Exception occurred while {} : {}", jobTitle, deleteQuery, e);
+      LOG.error("Exception occurred while {} : {}", jobTitle, query, e);
       throw new ServiceException(e);
     }
   }
@@ -345,10 +397,14 @@ public class DDLProxy {
     AnalyzeTableQueryGenerator queryGenerator = new AnalyzeTableQueryGenerator(tableMeta, shouldAnalyzeColumns);
     Optional<String> analyzeTable = queryGenerator.getQuery();
     String jobTitle = "Analyze table " + databaseName + "." + tableName;
-    if(analyzeTable.isPresent()) {
+    if (analyzeTable.isPresent()) {
       String query = analyzeTable.get();
+      Optional<String> settingsString = generateSettingsString();
+      if (settingsString.isPresent()) {
+        query = settingsString.get() + query;
+      }
       return createJob(databaseName, query, jobTitle, resourceManager);
-    }else{
+    } else {
       throw new ServiceException("Failed to generate job for {}" + jobTitle);
     }
   }
@@ -356,31 +412,30 @@ public class DDLProxy {
   public ColumnStats fetchColumnStats(String columnName, String jobId, ViewContext context) throws ServiceException {
     try {
       ResultsPaginationController.ResultsResponse results = ResultsPaginationController.getResult(jobId, null, null, null, null, context);
-      if(results.getHasResults()){
-       List<String[]> rows = results.getRows();
-       Map<Integer, String> headerMap = new HashMap<>();
-       boolean header = true;
+      if (results.getHasResults()) {
+        List<String[]> rows = results.getRows();
+        Map<Integer, String> headerMap = new HashMap<>();
+        boolean header = true;
         ColumnStats columnStats = new ColumnStats();
-        for(String[] row : rows){
-          if(header){
-            for(int i = 0 ; i < row.length; i++){
-              if(!Strings.isNullOrEmpty(row[i])){
+        for (String[] row : rows) {
+          if (header) {
+            for (int i = 0; i < row.length; i++) {
+              if (!Strings.isNullOrEmpty(row[i])) {
                 headerMap.put(i, row[i].trim());
               }
             }
             header = false;
-          }
-          else if(row.length > 0 ){
-            if(columnName.equals(row[0])){ // the first column of the row contains column name
+          } else if (row.length > 0) {
+            if (columnName.equals(row[0])) { // the first column of the row contains column name
               createColumnStats(row, headerMap, columnStats);
-            }else if( row.length > 1 && row[0].equalsIgnoreCase("COLUMN_STATS_ACCURATE")){
+            } else if (row.length > 1 && row[0].equalsIgnoreCase("COLUMN_STATS_ACCURATE")) {
               columnStats.setColumnStatsAccurate(row[1]);
             }
           }
         }
 
         return columnStats;
-      }else{
+      } else {
         throw new ServiceException("Cannot find any result for this jobId: " + jobId);
       }
     } catch (HiveClientException e) {
@@ -391,19 +446,20 @@ public class DDLProxy {
 
   /**
    * order of values in array
-   *  row [# col_name, data_type, min, max, num_nulls, distinct_count, avg_col_len, max_col_len,num_trues,num_falses,comment]
+   * row [# col_name, data_type, min, max, num_nulls, distinct_count, avg_col_len, max_col_len,num_trues,num_falses,comment]
    * indexes : 0           1        2    3     4             5               6             7           8         9    10
+   *
    * @param row
    * @param headerMap
    * @param columnStats
    * @return
    */
   private ColumnStats createColumnStats(String[] row, Map<Integer, String> headerMap, ColumnStats columnStats) throws ServiceException {
-    if(null == row){
+    if (null == row) {
       throw new ServiceException("row cannot be null.");
     }
-    for(int i = 0 ; i < row.length; i++){
-      switch(headerMap.get(i)){
+    for (int i = 0; i < row.length; i++) {
+      switch (headerMap.get(i)) {
         case ColumnStats.COLUMN_NAME:
           columnStats.setColumnName(row[i]);
           break;

http://git-wip-us.apache.org/repos/asf/ambari/blob/5de82da3/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/resources/uploads/UploadService.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/resources/uploads/UploadService.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/resources/uploads/UploadService.java
index 3164da0..8704440 100644
--- a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/resources/uploads/UploadService.java
+++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/resources/uploads/UploadService.java
@@ -49,6 +49,7 @@ import org.apache.ambari.view.utils.ambari.AmbariApi;
 import org.apache.commons.io.input.ReaderInputStream;
 import org.apache.hadoop.fs.FSDataInputStream;
 import org.apache.hadoop.fs.FSDataOutputStream;
+import org.apache.parquet.Strings;
 import org.codehaus.jackson.map.ObjectMapper;
 import org.codehaus.jackson.type.TypeReference;
 import org.json.simple.JSONObject;
@@ -301,7 +302,16 @@ public class UploadService extends BaseService {
     try {
       String insertQuery = generateInsertFromQuery(input);
       LOG.info("insertQuery : {}", insertQuery);
-
+      if( null != input.getGlobalSettings() && !Strings.isNullOrEmpty(input.getGlobalSettings().trim())){
+        String globalSettings = input.getGlobalSettings().trim();
+        if(!globalSettings.endsWith(";")){
+          globalSettings += ";\n";
+        }else{
+          globalSettings += "\n";
+        }
+        insertQuery = globalSettings + insertQuery;
+      }
+      LOG.info("creating job for query : {}", insertQuery);
       Job job = createJob(insertQuery, input.getFromDatabase(), "Insert from " +
               input.getFromDatabase() + "." + input.getFromTable() + " to " +
               input.getToDatabase() + "." + input.getToTable());

http://git-wip-us.apache.org/repos/asf/ambari/blob/5de82da3/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/resources/uploads/query/InsertFromQueryInput.java
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/resources/uploads/query/InsertFromQueryInput.java b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/resources/uploads/query/InsertFromQueryInput.java
index b74ba9b..02a6038 100644
--- a/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/resources/uploads/query/InsertFromQueryInput.java
+++ b/contrib/views/hive20/src/main/java/org/apache/ambari/view/hive20/resources/uploads/query/InsertFromQueryInput.java
@@ -28,6 +28,7 @@ public class InsertFromQueryInput {
   private String fromTable;
   private String toDatabase;
   private String toTable;
+  private String globalSettings;
   private List<ColumnInfo> partitionedColumns;
   private List<ColumnInfo> normalColumns;
   private Boolean unhexInsert = Boolean.FALSE;
@@ -36,13 +37,15 @@ public class InsertFromQueryInput {
   }
 
   public InsertFromQueryInput(String fromDatabase, String fromTable, String toDatabase, String toTable,
-                              List<ColumnInfo> partitionedColumns, List<ColumnInfo> normalColumns, Boolean unhexInsert) {
+                              List<ColumnInfo> partitionedColumns, List<ColumnInfo> normalColumns,
+                              String globalSettings, Boolean unhexInsert) {
     this.fromDatabase = fromDatabase;
     this.fromTable = fromTable;
     this.toDatabase = toDatabase;
     this.toTable = toTable;
     this.partitionedColumns = partitionedColumns;
     this.normalColumns = normalColumns;
+    this.globalSettings = globalSettings;
     this.unhexInsert = unhexInsert;
   }
 
@@ -101,4 +104,12 @@ public class InsertFromQueryInput {
   public void setToTable(String toTable) {
     this.toTable = toTable;
   }
+
+  public String getGlobalSettings() {
+    return globalSettings;
+  }
+
+  public void setGlobalSettings(String globalSettings) {
+    this.globalSettings = globalSettings;
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/5de82da3/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/upload-table.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/upload-table.js b/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/upload-table.js
index f47d820..799a87a 100644
--- a/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/upload-table.js
+++ b/contrib/views/hive20/src/main/resources/ui/app/routes/databases/database/tables/upload-table.js
@@ -35,6 +35,16 @@ export default NewTable.extend(UILoggerMixin, {
   init: function () {
     this._super();
   },
+
+  afterModel(){
+    return this.store.findAll('setting').then((data) => {
+      let localStr = '';
+      data.forEach(x => {
+        localStr = localStr + 'set '+ x.get('key')+ '='+ x.get('value') + ';\n';
+      });
+      this.set('globalSettings', localStr);
+    });
+  },
   setupController(controller, model) {
     this._super(controller, model);
     this.controller.set("showUploadTableModal", false);
@@ -421,6 +431,7 @@ export default NewTable.extend(UILoggerMixin, {
   insertIntoTable : function(tableData){
     console.log("insertIntoTable");
     this.pushUploadProgressInfos(this.formatMessage('hive.messages.startingToInsertRows'));
+    let globalSettings = this.get('globalSettings');
 
     let partitionedColumns = tableData.get("tableMeta").columns.filter(function(column){
       return column.isPartitioned;
@@ -445,6 +456,7 @@ export default NewTable.extend(UILoggerMixin, {
       "toTable": tableData.get("tableMeta").name,
       "partitionedColumns": partitionedColumns,
       "normalColumns": normalColumns,
+      "globalSettings": globalSettings,
       "unhexInsert": tableData.fileFormatInfo.containsEndlines
     });
   },


[16/50] ambari git commit: AMBARI-22213. "ambari-server upgrade" failed on db schema [Upgrade] (dlysnichenko)

Posted by am...@apache.org.
AMBARI-22213. "ambari-server upgrade" failed on db schema [Upgrade] (dlysnichenko)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/b86f53fb
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/b86f53fb
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/b86f53fb

Branch: refs/heads/branch-feature-AMBARI-22008
Commit: b86f53fbe1c940811c3e49d658aad870d1dd53da
Parents: a8caac3
Author: Lisnichenko Dmitro <dl...@hortonworks.com>
Authored: Thu Oct 12 13:57:24 2017 +0300
Committer: Lisnichenko Dmitro <dl...@hortonworks.com>
Committed: Thu Oct 12 13:58:23 2017 +0300

----------------------------------------------------------------------
 .../apache/ambari/server/orm/DBAccessorImpl.java    | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/b86f53fb/ambari-server/src/main/java/org/apache/ambari/server/orm/DBAccessorImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/DBAccessorImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/DBAccessorImpl.java
index 26670fc..faa58f2 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/DBAccessorImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/DBAccessorImpl.java
@@ -1551,8 +1551,12 @@ public class DBAccessorImpl implements DBAccessor {
    */
   @Override
   public void clearTable(String tableName) throws SQLException {
-    String sqlQuery = "DELETE FROM " + convertObjectName(tableName);
-    executeQuery(sqlQuery);
+    if (tableExists(tableName)){
+      String sqlQuery = "DELETE FROM " + convertObjectName(tableName);
+      executeQuery(sqlQuery);
+    } else {
+      LOG.warn("{} table doesn't exists, skipping", tableName);
+    }
   }
 
   /**
@@ -1564,7 +1568,11 @@ public class DBAccessorImpl implements DBAccessor {
    */
   @Override
   public void clearTableColumn(String tableName, String columnName, Object value) throws SQLException {
-    String sqlQuery = String.format("UPDATE %s SET %s = ?", convertObjectName(tableName), convertObjectName(columnName));
-    executePreparedUpdate(sqlQuery, value);
+    if (tableExists(tableName)){
+      String sqlQuery = String.format("UPDATE %s SET %s = ?", convertObjectName(tableName), convertObjectName(columnName));
+      executePreparedUpdate(sqlQuery, value);
+    } else {
+      LOG.warn("{} table doesn't exists, skipping", tableName);
+    }
   }
 }


[21/50] ambari git commit: AMBARI-22221. Fix initialization of Druid Script object. (nishantmonu51)

Posted by am...@apache.org.
AMBARI-22221. Fix initialization of Druid Script object. (nishantmonu51)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/d88d3cc0
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/d88d3cc0
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/d88d3cc0

Branch: refs/heads/branch-feature-AMBARI-22008
Commit: d88d3cc06f5355802a95db35c26e383502b658c7
Parents: 527e45d
Author: Nishant <ni...@gmail.com>
Authored: Thu Oct 12 21:20:11 2017 +0530
Committer: Nishant <ni...@gmail.com>
Committed: Thu Oct 12 22:37:26 2017 +0530

----------------------------------------------------------------------
 .../common-services/DRUID/0.10.1/package/scripts/druid_node.py      | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/d88d3cc0/ambari-server/src/main/resources/common-services/DRUID/0.10.1/package/scripts/druid_node.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/DRUID/0.10.1/package/scripts/druid_node.py b/ambari-server/src/main/resources/common-services/DRUID/0.10.1/package/scripts/druid_node.py
index 8053dcb..8e1a44f 100644
--- a/ambari-server/src/main/resources/common-services/DRUID/0.10.1/package/scripts/druid_node.py
+++ b/ambari-server/src/main/resources/common-services/DRUID/0.10.1/package/scripts/druid_node.py
@@ -32,6 +32,7 @@ from druid import druid, get_daemon_cmd, getPid
 
 class DruidBase(Script):
   def __init__(self, nodeType=None):
+    Script.__init__(self)
     self.nodeType = nodeType
 
   def install(self, env):


[13/50] ambari git commit: AMBARI-22204 Updating Ranger Admin pre-upgrade task (mugdha)

Posted by am...@apache.org.
AMBARI-22204 Updating Ranger Admin pre-upgrade task (mugdha)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/3acfa5c1
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/3acfa5c1
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/3acfa5c1

Branch: refs/heads/branch-feature-AMBARI-22008
Commit: 3acfa5c12708ff00c896943cd44e81b0a9ec85d1
Parents: 5de82da
Author: Mugdha Varadkar <mu...@apache.org>
Authored: Thu Oct 12 14:26:43 2017 +0530
Committer: Mugdha Varadkar <mu...@apache.org>
Committed: Thu Oct 12 14:35:59 2017 +0530

----------------------------------------------------------------------
 .../0.4.0/package/scripts/ranger_admin.py       | 23 +++++++++++++++----
 .../0.4.0/package/scripts/ranger_tagsync.py     | 23 +++++++++++++++----
 .../1.0.0.3.0/package/scripts/ranger_admin.py   | 24 +++++++++++++++-----
 .../1.0.0.3.0/package/scripts/ranger_tagsync.py | 23 +++++++++++++++----
 4 files changed, 75 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/3acfa5c1/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 848b137..d0a725a 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
@@ -20,6 +20,7 @@ limitations under the License.
 from resource_management.core.exceptions import Fail
 from resource_management.libraries.functions.check_process_status import check_process_status
 from resource_management.libraries.functions import stack_select
+from resource_management.libraries.functions import upgrade_summary
 from resource_management.libraries.script import Script
 from resource_management.core.resources.system import Execute, File
 from resource_management.core.exceptions import ComponentIsNotRunning
@@ -199,11 +200,25 @@ class RangerAdmin(Script):
     import params
     env.set_params(params)
 
-    upgrade_stack = stack_select._get_upgrade_stack()
-    if upgrade_stack is None:
-      raise Fail('Unable to determine the stack and stack version')
+    orchestration = stack_select.PACKAGE_SCOPE_STANDARD
+    summary = upgrade_summary.get_upgrade_summary()
 
-    stack_select.select_packages(params.version)
+    if summary is not None:
+      orchestration = summary.orchestration
+      if orchestration is None:
+        raise Fail("The upgrade summary does not contain an orchestration type")
+
+      if orchestration.upper() in stack_select._PARTIAL_ORCHESTRATION_SCOPES:
+        orchestration = stack_select.PACKAGE_SCOPE_PATCH
+
+    stack_select_packages = stack_select.get_packages(orchestration, service_name = "RANGER", component_name = "RANGER_ADMIN")
+    if stack_select_packages is None:
+      raise Fail("Unable to get packages for stack-select")
+
+    Logger.info("RANGER_ADMIN component will be stack-selected to version {0} using a {1} orchestration".format(params.version, orchestration.upper()))
+
+    for stack_select_package_name in stack_select_packages:
+      stack_select.select(stack_select_package_name, params.version)
 
   def get_log_folder(self):
     import params

http://git-wip-us.apache.org/repos/asf/ambari/blob/3acfa5c1/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/ranger_tagsync.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/ranger_tagsync.py b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/ranger_tagsync.py
index 3aae8ff..b1a1819 100644
--- a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/ranger_tagsync.py
+++ b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/ranger_tagsync.py
@@ -19,6 +19,7 @@ limitations under the License.
 """
 from resource_management.libraries.script import Script
 from resource_management.libraries.functions import stack_select
+from resource_management.libraries.functions import upgrade_summary
 from resource_management.core.resources.system import Execute, File
 from resource_management.libraries.functions.check_process_status import check_process_status
 from resource_management.core.exceptions import ComponentIsNotRunning
@@ -102,11 +103,25 @@ class RangerTagsync(Script):
     import params
     env.set_params(params)
 
-    upgrade_stack = stack_select._get_upgrade_stack()
-    if upgrade_stack is None:
-      raise Fail('Unable to determine the stack and stack version')
+    orchestration = stack_select.PACKAGE_SCOPE_STANDARD
+    summary = upgrade_summary.get_upgrade_summary()
 
-    stack_select.select_packages(params.version)
+    if summary is not None:
+      orchestration = summary.orchestration
+      if orchestration is None:
+        raise Fail("The upgrade summary does not contain an orchestration type")
+
+      if orchestration.upper() in stack_select._PARTIAL_ORCHESTRATION_SCOPES:
+        orchestration = stack_select.PACKAGE_SCOPE_PATCH
+
+    stack_select_packages = stack_select.get_packages(orchestration, service_name = "RANGER", component_name = "RANGER_TAGSYNC")
+    if stack_select_packages is None:
+      raise Fail("Unable to get packages for stack-select")
+
+    Logger.info("RANGER_TAGSYNC component will be stack-selected to version {0} using a {1} orchestration".format(params.version, orchestration.upper()))
+
+    for stack_select_package_name in stack_select_packages:
+      stack_select.select(stack_select_package_name, params.version)
 
     if params.stack_supports_ranger_tagsync_ssl_xml_support:
       Logger.info("Upgrading Tagsync, stack support Atlas user for Tagsync, creating keystore for same.")

http://git-wip-us.apache.org/repos/asf/ambari/blob/3acfa5c1/ambari-server/src/main/resources/common-services/RANGER/1.0.0.3.0/package/scripts/ranger_admin.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/RANGER/1.0.0.3.0/package/scripts/ranger_admin.py b/ambari-server/src/main/resources/common-services/RANGER/1.0.0.3.0/package/scripts/ranger_admin.py
index a9e2857..777e95d 100644
--- a/ambari-server/src/main/resources/common-services/RANGER/1.0.0.3.0/package/scripts/ranger_admin.py
+++ b/ambari-server/src/main/resources/common-services/RANGER/1.0.0.3.0/package/scripts/ranger_admin.py
@@ -20,6 +20,7 @@ limitations under the License.
 from resource_management.core.exceptions import Fail
 from resource_management.libraries.functions.check_process_status import check_process_status
 from resource_management.libraries.functions import stack_select
+from resource_management.libraries.functions import upgrade_summary
 from resource_management.libraries.functions.constants import Direction
 from resource_management.libraries.script import Script
 from resource_management.core.resources.system import Execute, File
@@ -184,14 +185,25 @@ class RangerAdmin(Script):
     import params
     env.set_params(params)
 
-    upgrade_stack = stack_select._get_upgrade_stack()
-    if upgrade_stack is None:
-      raise Fail('Unable to determine the stack and stack version')
+    orchestration = stack_select.PACKAGE_SCOPE_STANDARD
+    summary = upgrade_summary.get_upgrade_summary()
 
-    stack_name = upgrade_stack[0]
-    stack_version = upgrade_stack[1]
+    if summary is not None:
+      orchestration = summary.orchestration
+      if orchestration is None:
+        raise Fail("The upgrade summary does not contain an orchestration type")
+
+      if orchestration.upper() in stack_select._PARTIAL_ORCHESTRATION_SCOPES:
+        orchestration = stack_select.PACKAGE_SCOPE_PATCH
+
+    stack_select_packages = stack_select.get_packages(orchestration, service_name = "RANGER", component_name = "RANGER_ADMIN")
+    if stack_select_packages is None:
+      raise Fail("Unable to get packages for stack-select")
+
+    Logger.info("RANGER_ADMIN component will be stack-selected to version {0} using a {1} orchestration".format(params.version, orchestration.upper()))
 
-    stack_select.select_packages(params.version)
+    for stack_select_package_name in stack_select_packages:
+      stack_select.select(stack_select_package_name, params.version)
 
   def get_log_folder(self):
     import params

http://git-wip-us.apache.org/repos/asf/ambari/blob/3acfa5c1/ambari-server/src/main/resources/common-services/RANGER/1.0.0.3.0/package/scripts/ranger_tagsync.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/RANGER/1.0.0.3.0/package/scripts/ranger_tagsync.py b/ambari-server/src/main/resources/common-services/RANGER/1.0.0.3.0/package/scripts/ranger_tagsync.py
index 85963cf..92e0165 100644
--- a/ambari-server/src/main/resources/common-services/RANGER/1.0.0.3.0/package/scripts/ranger_tagsync.py
+++ b/ambari-server/src/main/resources/common-services/RANGER/1.0.0.3.0/package/scripts/ranger_tagsync.py
@@ -19,6 +19,7 @@ limitations under the License.
 """
 from resource_management.libraries.script import Script
 from resource_management.libraries.functions import stack_select
+from resource_management.libraries.functions import upgrade_summary
 from resource_management.core.resources.system import Execute, File
 from resource_management.libraries.functions.check_process_status import check_process_status
 from resource_management.core.exceptions import ComponentIsNotRunning
@@ -104,11 +105,25 @@ class RangerTagsync(Script):
     import params
     env.set_params(params)
 
-    upgrade_stack = stack_select._get_upgrade_stack()
-    if upgrade_stack is None:
-      raise Fail('Unable to determine the stack and stack version')
+    orchestration = stack_select.PACKAGE_SCOPE_STANDARD
+    summary = upgrade_summary.get_upgrade_summary()
 
-    stack_select.select_packages(params.version)
+    if summary is not None:
+      orchestration = summary.orchestration
+      if orchestration is None:
+        raise Fail("The upgrade summary does not contain an orchestration type")
+
+      if orchestration.upper() in stack_select._PARTIAL_ORCHESTRATION_SCOPES:
+        orchestration = stack_select.PACKAGE_SCOPE_PATCH
+
+    stack_select_packages = stack_select.get_packages(orchestration, service_name = "RANGER", component_name = "RANGER_TAGSYNC")
+    if stack_select_packages is None:
+      raise Fail("Unable to get packages for stack-select")
+
+    Logger.info("RANGER_TAGSYNC component will be stack-selected to version {0} using a {1} orchestration".format(params.version, orchestration.upper()))
+
+    for stack_select_package_name in stack_select_packages:
+      stack_select.select(stack_select_package_name, params.version)
 
     if params.stack_supports_ranger_tagsync_ssl_xml_support:
       Logger.info("Upgrading Tagsync, stack support Atlas user for Tagsync, creating keystore for same.")


[32/50] ambari git commit: AMBARI-22243. Apache Hive 2 LLAP cluster doesn't have the metastore warehouse directory. (stoader)

Posted by am...@apache.org.
AMBARI-22243. Apache Hive 2 LLAP cluster doesn't have the metastore warehouse directory. (stoader)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/43fb5976
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/43fb5976
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/43fb5976

Branch: refs/heads/branch-feature-AMBARI-22008
Commit: 43fb59761595431b2a8832bafe1bfcb2fa85a1fa
Parents: 8c017c1
Author: Toader, Sebastian <st...@hortonworks.com>
Authored: Sat Oct 14 07:45:22 2017 +0200
Committer: Toader, Sebastian <st...@hortonworks.com>
Committed: Sun Oct 15 07:43:51 2017 +0200

----------------------------------------------------------------------
 .../0.12.0.2.0/package/scripts/hive_interactive.py  | 13 +++++++++++++
 .../2.1.0.3.0/package/scripts/hive_interactive.py   | 13 +++++++++++++
 .../python/stacks/2.5/HIVE/test_hive_server_int.py  | 16 ++++++++++++++++
 3 files changed, 42 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/43fb5976/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_interactive.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_interactive.py b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_interactive.py
index 2ed3e3a..89060be 100644
--- a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_interactive.py
+++ b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_interactive.py
@@ -62,6 +62,19 @@ def hive_interactive(name=None):
   import params
   MB_TO_BYTES = 1048576
 
+  # if warehouse directory is in DFS
+  if not params.whs_dir_protocol or params.whs_dir_protocol == urlparse(params.default_fs).scheme:
+    # Create Hive Metastore Warehouse Dir
+    params.HdfsResource(params.hive_apps_whs_dir,
+                        type="directory",
+                        action="create_on_execute",
+                        owner=params.hive_user,
+                        group=params.user_group,
+                        mode=params.hive_apps_whs_mode
+                        )
+  else:
+    Logger.info(format("Not creating warehouse directory '{hive_apps_whs_dir}', as the location is not in DFS."))
+
   # Create Hive User Dir
   params.HdfsResource(params.hive_hdfs_user_dir,
                       type="directory",

http://git-wip-us.apache.org/repos/asf/ambari/blob/43fb5976/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/scripts/hive_interactive.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/scripts/hive_interactive.py b/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/scripts/hive_interactive.py
index 2ed3e3a..89060be 100644
--- a/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/scripts/hive_interactive.py
+++ b/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/scripts/hive_interactive.py
@@ -62,6 +62,19 @@ def hive_interactive(name=None):
   import params
   MB_TO_BYTES = 1048576
 
+  # if warehouse directory is in DFS
+  if not params.whs_dir_protocol or params.whs_dir_protocol == urlparse(params.default_fs).scheme:
+    # Create Hive Metastore Warehouse Dir
+    params.HdfsResource(params.hive_apps_whs_dir,
+                        type="directory",
+                        action="create_on_execute",
+                        owner=params.hive_user,
+                        group=params.user_group,
+                        mode=params.hive_apps_whs_mode
+                        )
+  else:
+    Logger.info(format("Not creating warehouse directory '{hive_apps_whs_dir}', as the location is not in DFS."))
+
   # Create Hive User Dir
   params.HdfsResource(params.hive_hdfs_user_dir,
                       type="directory",

http://git-wip-us.apache.org/repos/asf/ambari/blob/43fb5976/ambari-server/src/test/python/stacks/2.5/HIVE/test_hive_server_int.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.5/HIVE/test_hive_server_int.py b/ambari-server/src/test/python/stacks/2.5/HIVE/test_hive_server_int.py
index 3dc78ab..4951c7e 100644
--- a/ambari-server/src/test/python/stacks/2.5/HIVE/test_hive_server_int.py
+++ b/ambari-server/src/test/python/stacks/2.5/HIVE/test_hive_server_int.py
@@ -418,6 +418,22 @@ class TestHiveServerInteractive(RMFTestCase):
 
   def assert_configure_default(self, no_tmp=False, default_fs_default=u'hdfs://c6401.ambari.apache.org:8020', with_cs_enabled=False):
 
+    self.assertResourceCalled('HdfsResource', '/apps/hive/warehouse',
+                              immutable_paths = self.DEFAULT_IMMUTABLE_PATHS,
+                              security_enabled = False,
+                              hadoop_bin_dir = '/usr/hdp/current/hadoop-client/bin',
+                              keytab = UnknownConfigurationMock(),
+                              kinit_path_local = '/usr/bin/kinit',
+                              user = 'hdfs',
+                              dfs_type = '',
+                              owner = 'hive',
+                              group = 'hadoop',
+                              hadoop_conf_dir = '/usr/hdp/current/hadoop-client/conf',
+                              type = 'directory',
+                              action = ['create_on_execute'], hdfs_resource_ignore_file='/var/lib/ambari-agent/data/.hdfs_resource_ignore', hdfs_site=self.getConfig()['configurations']['hdfs-site'], principal_name='missing_principal', default_fs=default_fs_default,
+                              mode = 0777,
+    )
+
     self.assertResourceCalled('HdfsResource', '/user/hive',
                               immutable_paths = self.DEFAULT_IMMUTABLE_PATHS,
                               security_enabled = False,


[19/50] ambari git commit: AMBARI-22207. [Intermittent] While moving master, a manual commands wizard came in between (alexantonenko)

Posted by am...@apache.org.
AMBARI-22207. [Intermittent] While moving master, a manual commands wizard came in between (alexantonenko)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/68df85d4
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/68df85d4
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/68df85d4

Branch: refs/heads/branch-feature-AMBARI-22008
Commit: 68df85d402b047c54f9d0324e7f94b970c5282ee
Parents: be605cb
Author: Alex Antonenko <aa...@hortonworks.com>
Authored: Thu Oct 12 15:53:00 2017 +0300
Committer: Alex Antonenko <aa...@hortonworks.com>
Committed: Thu Oct 12 15:53:00 2017 +0300

----------------------------------------------------------------------
 .../main/service/reassign/step3_controller.js     | 18 ++++++++++++++----
 .../app/mixins/wizard/assign_master_components.js |  2 +-
 .../app/templates/main/service/reassign/step3.hbs |  6 +++---
 .../wizard/assign_master_components_test.js       |  2 +-
 4 files changed, 19 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/68df85d4/ambari-web/app/controllers/main/service/reassign/step3_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/reassign/step3_controller.js b/ambari-web/app/controllers/main/service/reassign/step3_controller.js
index c44c4f3..4898b75 100644
--- a/ambari-web/app/controllers/main/service/reassign/step3_controller.js
+++ b/ambari-web/app/controllers/main/service/reassign/step3_controller.js
@@ -268,9 +268,16 @@ App.ReassignMasterWizardStep3Controller = Em.Controller.extend({
 
   propertiesToChange: {},
 
-  isSubmitDisabled: Em.computed.and('wizardController.isComponentWithReconfiguration', '!isLoaded'),
+  isSubmitDisabled: Em.computed.or('!isLoaded', 'submitButtonClicked'),
+
+  /**
+   * Is Submit-click processing now
+   * @type {bool}
+   */
+  submitButtonClicked: false,
 
   loadStep: function () {
+    this.set('submitButtonClicked', false);
     if (this.get('wizardController.isComponentWithReconfiguration')) {
       this.set('isLoaded', false);
       App.ajax.send({
@@ -695,8 +702,11 @@ App.ReassignMasterWizardStep3Controller = Em.Controller.extend({
   },
 
   submit: function() {
-    App.get('router.mainAdminKerberosController').getKDCSessionState(function() {
-      App.router.send("next");
-    });
+    if (!this.get('submitButtonClicked')) {
+      this.set('submitButtonClicked', true);
+      App.get('router.mainAdminKerberosController').getKDCSessionState(function() {
+        App.router.send("next");
+      });
+    }
   }
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/68df85d4/ambari-web/app/mixins/wizard/assign_master_components.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/wizard/assign_master_components.js b/ambari-web/app/mixins/wizard/assign_master_components.js
index 84a56f1..c9577f8 100644
--- a/ambari-web/app/mixins/wizard/assign_master_components.js
+++ b/ambari-web/app/mixins/wizard/assign_master_components.js
@@ -1195,7 +1195,7 @@ App.AssignMasterComponents = Em.Mixin.create(App.HostComponentValidationMixin, A
     }
   },
 
-  nextButtonDisabled: Em.computed.or('App.router.btnClickInProgress', 'submitDisabled', 'validationInProgress'),
+  nextButtonDisabled: Em.computed.or('App.router.btnClickInProgress', 'submitDisabled', 'validationInProgress', '!isLoaded'),
 
   /**
    * Submit button click handler

http://git-wip-us.apache.org/repos/asf/ambari/blob/68df85d4/ambari-web/app/templates/main/service/reassign/step3.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/service/reassign/step3.hbs b/ambari-web/app/templates/main/service/reassign/step3.hbs
index 1f6a393..a6e42af 100644
--- a/ambari-web/app/templates/main/service/reassign/step3.hbs
+++ b/ambari-web/app/templates/main/service/reassign/step3.hbs
@@ -64,8 +64,8 @@
 </div>
 <div class="wizard-footer col-md-12">
   <div class="btn-area">
-    <a class="btn btn-default pull-left" {{action back href="true"}}>&larr; {{t common.back}}</a>
-    <a class="btn btn-success pull-right"
-       id="spinner" {{bindAttr disabled="controller.isSubmitDisabled"}} {{action submit target="controller"}}>{{t common.deploy}} &rarr;</a>
+      <button class="btn pull-left" {{action back href="true"}}>&larr; {{t common.back}}</button>
+      <button class="btn btn-success pull-right"
+              id="spinner" {{bindAttr disabled="controller.isSubmitDisabled"}} {{action submit target="controller"}}>{{t common.deploy}} &rarr;</button>
   </div>
 </div>

http://git-wip-us.apache.org/repos/asf/ambari/blob/68df85d4/ambari-web/test/mixins/wizard/assign_master_components_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mixins/wizard/assign_master_components_test.js b/ambari-web/test/mixins/wizard/assign_master_components_test.js
index 635143c..20efb8e 100644
--- a/ambari-web/test/mixins/wizard/assign_master_components_test.js
+++ b/ambari-web/test/mixins/wizard/assign_master_components_test.js
@@ -211,6 +211,6 @@ describe('App.AssignMasterComponents', function () {
   });
 
   App.TestAliases.testAsComputedOr(baseObject.create(),
-    'nextButtonDisabled', ['App.router.btnClickInProgress', 'submitDisabled', 'validationInProgress']);
+    'nextButtonDisabled', ['App.router.btnClickInProgress', 'submitDisabled', 'validationInProgress', '!isLoaded']);
 
 });
\ No newline at end of file


[08/50] ambari git commit: AMBARI-22208 Log Search UI: small fixes for top part of Service Logs page. (Istvan Tobias via ababiichuk)

Posted by am...@apache.org.
AMBARI-22208 Log Search UI: small fixes for top part of Service Logs page. (Istvan Tobias via ababiichuk)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/6f598067
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/6f598067
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/6f598067

Branch: refs/heads/branch-feature-AMBARI-22008
Commit: 6f598067f7f10b0543a3239884d380546fcdec56
Parents: 4a47e79
Author: Istvan Tobias <to...@gmail.com>
Authored: Wed Oct 11 19:27:37 2017 +0300
Committer: ababiichuk <ab...@hortonworks.com>
Committed: Wed Oct 11 20:07:35 2017 +0300

----------------------------------------------------------------------
 .../ambari-logsearch-web/src/app/app.module.ts  |   2 +
 .../accordion-panel.component.less              |   2 +-
 .../src/app/components/app.component.less       |   2 +-
 .../collapsible-panel.component.html            |  27 +++
 .../collapsible-panel.component.less            |  42 ++++
 .../collapsible-panel.component.spec.ts         | 129 ++++++++++++
 .../collapsible-panel.component.ts              |  89 +++++++++
 .../dropdown-button.component.less              |   2 +-
 .../dropdown-list/dropdown-list.component.less  |   2 +-
 .../filters-panel/filters-panel.component.html  |   2 +-
 .../filters-panel/filters-panel.component.less  |   6 +-
 .../log-file-entry.component.less               |   2 +-
 .../logs-container.component.html               |  14 +-
 .../logs-container.component.spec.ts            |   5 +
 .../logs-container/logs-container.component.ts  |  10 +
 .../logs-list/logs-list.component.less          |   2 +-
 .../main-container.component.less               |   2 +-
 .../src/app/components/main.less                |  20 ++
 .../menu-button/menu-button.component.less      |  18 +-
 .../menu-button/menu-button.component.ts        |   5 +-
 .../src/app/components/mixins.less              | 200 +++++++++++++++++++
 .../pagination-controls.component.less          |   2 +-
 .../pagination/pagination.component.less        |   4 +-
 .../search-box/search-box.component.less        |   2 +-
 .../time-histogram.component.less               |   2 +-
 .../time-range-picker.component.less            |   2 +-
 .../components/top-menu/top-menu.component.html |   2 +-
 .../components/top-menu/top-menu.component.less |   2 +-
 .../src/app/components/variables.less           | 123 +-----------
 .../src/assets/i18n/en.json                     |   9 +-
 30 files changed, 591 insertions(+), 140 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/6f598067/ambari-logsearch/ambari-logsearch-web/src/app/app.module.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/app.module.ts b/ambari-logsearch/ambari-logsearch-web/src/app/app.module.ts
index ff791fe..12b95a7 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/app.module.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/app.module.ts
@@ -65,6 +65,7 @@ import {FilterDropdownComponent} from '@app/components/filter-dropdown/filter-dr
 import {DropdownListComponent} from '@app/components/dropdown-list/dropdown-list.component';
 import {FilterButtonComponent} from '@app/components/filter-button/filter-button.component';
 import {AccordionPanelComponent} from '@app/components/accordion-panel/accordion-panel.component';
+import {CollapsiblePanelComponent} from '@app/components/collapsible-panel/collapsible-panel.component';
 import {LogsListComponent} from '@app/components/logs-list/logs-list.component';
 import {DropdownButtonComponent} from '@app/components/dropdown-button/dropdown-button.component';
 import {PaginationComponent} from '@app/components/pagination/pagination.component';
@@ -115,6 +116,7 @@ export function getXHRBackend(injector: Injector, browser: BrowserXhr, xsrf: XSR
     FilterDropdownComponent,
     FilterButtonComponent,
     AccordionPanelComponent,
+    CollapsiblePanelComponent,
     LogsListComponent,
     DropdownButtonComponent,
     PaginationComponent,

http://git-wip-us.apache.org/repos/asf/ambari/blob/6f598067/ambari-logsearch/ambari-logsearch-web/src/app/components/accordion-panel/accordion-panel.component.less
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/accordion-panel/accordion-panel.component.less b/ambari-logsearch/ambari-logsearch-web/src/app/components/accordion-panel/accordion-panel.component.less
index 8366952..3d083be 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/accordion-panel/accordion-panel.component.less
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/accordion-panel/accordion-panel.component.less
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-@import '../variables';
+@import '../mixins';
 
 .panel-body {
   position: relative;

http://git-wip-us.apache.org/repos/asf/ambari/blob/6f598067/ambari-logsearch/ambari-logsearch-web/src/app/components/app.component.less
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/app.component.less b/ambari-logsearch/ambari-logsearch-web/src/app/components/app.component.less
index d1aa7ff..8731582 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/app.component.less
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/app.component.less
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-@import 'variables';
+@import 'mixins';
 
 :host {
   .full-size;

http://git-wip-us.apache.org/repos/asf/ambari/blob/6f598067/ambari-logsearch/ambari-logsearch-web/src/app/components/collapsible-panel/collapsible-panel.component.html
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/collapsible-panel/collapsible-panel.component.html b/ambari-logsearch/ambari-logsearch-web/src/app/components/collapsible-panel/collapsible-panel.component.html
new file mode 100644
index 0000000..b73fa45
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/collapsible-panel/collapsible-panel.component.html
@@ -0,0 +1,27 @@
+<!--
+  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.
+-->
+<div [ngClass]="{'panel': true, 'panel-default': true, 'panel-collapsible': true, 'panel-collapsed': isCollapsed}">
+    <div [ngClass]="{'panel-heading': true}" (click)="handleCollapseBtnClick($event)">
+      <a [attr.aria-collapsed]="isCollapsed">
+        <i [ngClass]="{'fa': true, 'fa-caret-down': !isCollapsed, 'fa-caret-right': isCollapsed}"></i>
+        {{((isCollapsed ? collapsedTitle : openTitle) || title) | translate}}
+      </a>
+    </div>
+    <div [ngClass]="{'panel-body': true}" [attr.aria-collapsed]="isCollapsed">
+        <ng-content></ng-content>
+    </div>
+</div>

http://git-wip-us.apache.org/repos/asf/ambari/blob/6f598067/ambari-logsearch/ambari-logsearch-web/src/app/components/collapsible-panel/collapsible-panel.component.less
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/collapsible-panel/collapsible-panel.component.less b/ambari-logsearch/ambari-logsearch-web/src/app/components/collapsible-panel/collapsible-panel.component.less
new file mode 100644
index 0000000..40e8e8fd
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/collapsible-panel/collapsible-panel.component.less
@@ -0,0 +1,42 @@
+/**
+ * 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.
+ */
+
+@import '../mixins';
+
+.panel-collapsible {
+  position: relative;
+  .panel-heading {
+    .clickable-item;
+    background-color: @panel-heading;
+    border: 0 none;
+    color: @base-font-color;
+    font-size: 1.25rem;
+    a, a:hover, a:visited {
+      color: @base-font-color;
+      text-decoration: none;
+    }
+  }
+  .panel-body {
+    padding: 5px;
+  }
+  &.panel-collapsed {
+    .panel-body {
+      height: 0;
+      overflow: hidden;
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/6f598067/ambari-logsearch/ambari-logsearch-web/src/app/components/collapsible-panel/collapsible-panel.component.spec.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/collapsible-panel/collapsible-panel.component.spec.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/collapsible-panel/collapsible-panel.component.spec.ts
new file mode 100644
index 0000000..60b7d63
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/collapsible-panel/collapsible-panel.component.spec.ts
@@ -0,0 +1,129 @@
+/**
+ * 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.
+ */
+
+import {DebugElement} from '@angular/core';
+import {async, ComponentFixture, TestBed} from '@angular/core/testing';
+import {By} from '@angular/platform-browser';
+import {TranslationModules} from '@app/test-config.spec';
+import {HttpClientService} from '@app/services/http-client.service';
+
+//import {AppModule} from '@app/app.module';
+import {CollapsiblePanelComponent} from './collapsible-panel.component';
+
+describe('CollapsiblePanelComponent', () => {
+  let component: CollapsiblePanelComponent;
+  let fixture: ComponentFixture<CollapsiblePanelComponent>;
+  let de: DebugElement;
+  let el: HTMLElement;
+
+  beforeEach(async(() => {
+    TestBed.configureTestingModule({
+      declarations: [CollapsiblePanelComponent],
+      imports: TranslationModules,
+      providers: [
+        HttpClientService
+      ]
+    })
+    .compileComponents();
+  }));
+
+  beforeEach(() => {
+    fixture = TestBed.createComponent(CollapsiblePanelComponent);
+    component = fixture.componentInstance;
+    fixture.detectChanges();
+    de = fixture.debugElement.query(By.css('div.panel'));
+    el = de.nativeElement;
+  });
+
+  it('should create component', () => {
+    expect(component).toBeTruthy();
+  });
+
+  it('should call toggleCollapsed', () => {
+    let mockEvent: MouseEvent = document.createEvent('MouseEvent');
+    mockEvent.initEvent('click', true, true);
+    spyOn(component,'toggleCollapsed');
+    component.handleCollapseBtnClick(mockEvent);
+    expect(component.toggleCollapsed).toHaveBeenCalled();
+  });
+
+  it('should prevent default action on event after toggle button click',() => {
+    let mockEvent: MouseEvent = document.createEvent('MouseEvent');
+    mockEvent.initEvent('click', true, true);
+    spyOn(mockEvent,'preventDefault');
+    component.handleCollapseBtnClick(mockEvent);
+    expect(mockEvent.preventDefault).toHaveBeenCalled();
+  });
+
+  it('should negate the isCollapsed property', () => {
+    let valueBefore = component.isCollapsed;
+    component.toggleCollapsed();
+    fixture.detectChanges();
+    expect(component.isCollapsed).toEqual(!valueBefore);
+  });
+
+  it('should add `panel-collapsed` css class to the element when the isCollapsed is true', () => {
+    component.isCollapsed = true;
+    fixture.detectChanges();
+    expect(el.className).toContain('panel-collapsed');
+  });
+
+  it('should not have `panel-collapsed` css class on the element when the isCollapsed is false', () => {
+    component.isCollapsed = false;
+    fixture.detectChanges();
+    expect(el.className).not.toContain('panel-collapsed');
+  });
+
+  it('should display the openTitle if presented and the isCollapsed property is false', () => {
+    let title = 'Open title';
+    let headingEl = el.querySelector('.panel-heading');
+    component.openTitle = title;
+    component.isCollapsed = false;
+    fixture.detectChanges();
+    expect(headingEl.textContent).toContain(title);
+  });
+
+  it('should display the collapsedTitle if it presented and the isCollapsed property is true', () => {
+    let title = 'Collapsed title';
+    let headingEl = el.querySelector('.panel-heading');
+    component.collapsedTitle = title;
+    component.isCollapsed = true;
+    fixture.detectChanges();
+    expect(headingEl.textContent).toContain(title);
+  });
+
+  it('should display the title if openTitle is not presented and the isCollapsed property is false', () => {
+    let title = 'Title';
+    let headingEl = el.querySelector('.panel-heading');
+    component.openTitle = '';
+    component.title = title;
+    component.isCollapsed = false;
+    fixture.detectChanges();
+    expect(headingEl.textContent).toContain(title);
+  });
+
+  it('should display the title if collapsedTitle is not presented and the isCollapsed property is true', () => {
+    let title = 'Title';
+    let headingEl = el.querySelector('.panel-heading');
+    component.collapsedTitle = '';
+    component.title = title;
+    component.isCollapsed = true;
+    fixture.detectChanges();
+    expect(headingEl.textContent).toContain(title);
+  });
+
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/6f598067/ambari-logsearch/ambari-logsearch-web/src/app/components/collapsible-panel/collapsible-panel.component.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/collapsible-panel/collapsible-panel.component.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/collapsible-panel/collapsible-panel.component.ts
new file mode 100644
index 0000000..cbc0dd7
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/collapsible-panel/collapsible-panel.component.ts
@@ -0,0 +1,89 @@
+/**
+ * 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.
+ */
+
+import {Component, Input} from '@angular/core';
+
+enum Side {
+  LEFT = "left",
+  RIGHT = "right"
+}
+
+/**
+ * The goal of this component to have a simple BS panel with a collapse link in the panel heading. So that adding
+ * components/content into the body of the panel we can hide and show the its content.
+ * @class CollapsiblePanelComponent
+ */
+@Component({
+  selector: 'collapsible-panel',
+  templateUrl: './collapsible-panel.component.html',
+  styleUrls: ['./collapsible-panel.component.less']
+})
+export class CollapsiblePanelComponent {
+
+  /**
+   * This is for the common title of the panel. If the openTitle or the collapsedTitle not set this will be displayed.
+   * @type {string}
+   */
+  @Input()
+  title: string = '';
+
+  /**
+   * The panel's title for the opened state
+   * @type {string}
+   */
+  @Input()
+  openTitle: string = 'common.hide';
+
+  /**
+   * The panel's title fo the closed/collapsed state
+   * @type {string}
+   */
+  @Input()
+  collapsedTitle: string = 'common.show';
+
+  /**
+   * This property indicates the position of the caret. It can be 'left' or 'right'
+   * @type {Side}
+   */
+  @Input()
+  caretSide: Side = Side.LEFT;
+
+  /**
+   * The flag to indicate the collapsed state.
+   * @type {boolean}
+   */
+  @Input()
+  isCollapsed: boolean = false;
+
+  /**
+   * The goal is to handle the click event of the collapse link/button. It will simply call the inside logic to toggle
+   * the collapsed state. The goal is to separate the functions by responsibility.
+   * @param {MouseEvent} ev
+   */
+  handleCollapseBtnClick(ev: MouseEvent): void {
+    this.toggleCollapsed();
+    ev.preventDefault();
+  }
+
+  /**
+   * The goal is to simply negate the current collapse state.
+   */
+  toggleCollapsed():void {
+    this.isCollapsed = !this.isCollapsed;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/6f598067/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-button/dropdown-button.component.less
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-button/dropdown-button.component.less b/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-button/dropdown-button.component.less
index a5da7f5..d767e15 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-button/dropdown-button.component.less
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-button/dropdown-button.component.less
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-@import '../variables';
+@import '../mixins';
 
 :host {
   .default-flex;

http://git-wip-us.apache.org/repos/asf/ambari/blob/6f598067/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-list/dropdown-list.component.less
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-list/dropdown-list.component.less b/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-list/dropdown-list.component.less
index 6faa192..674b195 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-list/dropdown-list.component.less
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-list/dropdown-list.component.less
@@ -16,7 +16,7 @@
  * limitations under the License.
  */
 
-@import '../variables';
+@import '../mixins';
 
 :host {
   max-height: @dropdown-max-height;

http://git-wip-us.apache.org/repos/asf/ambari/blob/6f598067/ambari-logsearch/ambari-logsearch-web/src/app/components/filters-panel/filters-panel.component.html
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/filters-panel/filters-panel.component.html b/ambari-logsearch/ambari-logsearch-web/src/app/components/filters-panel/filters-panel.component.html
index e0db997..22ec8fe 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/filters-panel/filters-panel.component.html
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/filters-panel/filters-panel.component.html
@@ -30,7 +30,7 @@
       <span class="fa fa-search"></span>
     </button-->
   </div>
-  <div class="default-flex col-md-4">
+  <div class="filter-buttons col-md-4">
     <dropdown-button [options]="searchBoxItems" iconClass="fa fa-search-minus" label="filter.excluded"
                      [hideCaret]="true" [showSelectedValue]="false" action="proceedWithExclude"></dropdown-button>
     <filter-button formControlName="hosts" label="{{filters.hosts.label | translate}}"

http://git-wip-us.apache.org/repos/asf/ambari/blob/6f598067/ambari-logsearch/ambari-logsearch-web/src/app/components/filters-panel/filters-panel.component.less
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/filters-panel/filters-panel.component.less b/ambari-logsearch/ambari-logsearch-web/src/app/components/filters-panel/filters-panel.component.less
index aeb6911..962199b 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/filters-panel/filters-panel.component.less
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/filters-panel/filters-panel.component.less
@@ -16,7 +16,7 @@
  * limitations under the License.
  */
 
-@import '../variables';
+@import '../mixins';
 
 :host {
   display: block;
@@ -66,4 +66,8 @@
   /deep/ .stop-icon {
     color: @exclude-color;
   }
+
+  .filter-buttons {
+    .default-flex;
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/6f598067/ambari-logsearch/ambari-logsearch-web/src/app/components/log-file-entry/log-file-entry.component.less
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/log-file-entry/log-file-entry.component.less b/ambari-logsearch/ambari-logsearch-web/src/app/components/log-file-entry/log-file-entry.component.less
index d3523d3..630565b 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/log-file-entry/log-file-entry.component.less
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/log-file-entry/log-file-entry.component.less
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-@import '../variables';
+@import '../mixins';
 
 :host {
   display: block;

http://git-wip-us.apache.org/repos/asf/ambari/blob/6f598067/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-container/logs-container.component.html
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-container/logs-container.component.html b/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-container/logs-container.component.html
index 776bb9a..8b63278 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-container/logs-container.component.html
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-container/logs-container.component.html
@@ -20,9 +20,17 @@
     {{'filter.capture.triggeringRefresh' | translate: autoRefreshMessageParams}}
   </div>
 </div>
-<time-histogram class="col-md-12" [data]="histogramData" [customOptions]="histogramOptions"
-                svgId="service-logs-histogram"
-                (selectArea)="setCustomTimeRange($event[0], $event[1])"></time-histogram>
+<!-- TODO use plugin for singular/plural -->
+<div class="logs-header col-md-12">{{
+  (!totalEventsFoundMessageParams.totalCount ? 'logs.noEventFound' :
+    (totalEventsFoundMessageParams.totalCount === 1 ? 'logs.oneEventFound' : 'logs.totalEventFound'))
+        | translate: totalEventsFoundMessageParams
+}}</div>
+<collapsible-panel openTitle="logs.hideGraph" collapsedTitle="logs.showGraph" class="col-md-12">
+  <time-histogram class="col-md-12" [data]="histogramData" [customOptions]="histogramOptions"
+      svgId="service-logs-histogram"
+      (selectArea)="setCustomTimeRange($event[0], $event[1])"></time-histogram>
+</collapsible-panel>
 <dropdown-button *ngIf="!isServiceLogsFileView" class="pull-right" label="logs.columns"
                  [options]="availableColumns | async" [isRightAlign]="true" [isMultipleChoice]="true"
                  action="updateSelectedColumns" [additionalArgs]="logsTypeMapObject.fieldsModel"></dropdown-button>

http://git-wip-us.apache.org/repos/asf/ambari/blob/6f598067/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-container/logs-container.component.spec.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-container/logs-container.component.spec.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-container/logs-container.component.spec.ts
index f3b28d1..9b3a043 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-container/logs-container.component.spec.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-container/logs-container.component.spec.ts
@@ -104,4 +104,9 @@ describe('LogsContainerComponent', () => {
   it('should create component', () => {
     expect(component).toBeTruthy();
   });
+
+  it('totalEventsFoundMessageParams should provide total count number', () => {
+    expect(Object.keys(component.totalEventsFoundMessageParams)).toContain('totalCount');
+  });
+
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/6f598067/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-container/logs-container.component.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-container/logs-container.component.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-container/logs-container.component.ts
index 63fafb6..cdc023d 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-container/logs-container.component.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-container/logs-container.component.ts
@@ -113,6 +113,16 @@ export class LogsContainerComponent implements OnInit {
     };
   }
 
+  /**
+   * The goal is to provide the single source for the parameters of 'xyz events found' message.
+   * @returns {Object}
+   */
+  get totalEventsFoundMessageParams(): object {
+    return {
+      totalCount: this.totalCount
+    }
+  }
+
   isServiceLogContextView: boolean = false;
 
   get isServiceLogsFileView(): boolean {

http://git-wip-us.apache.org/repos/asf/ambari/blob/6f598067/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-list/logs-list.component.less
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-list/logs-list.component.less b/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-list/logs-list.component.less
index 0fded67..67d0615 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-list/logs-list.component.less
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-list/logs-list.component.less
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-@import '../variables';
+@import '../mixins';
 
 .logs-header {
   // TODO get rid of magic numbers, base on actual design

http://git-wip-us.apache.org/repos/asf/ambari/blob/6f598067/ambari-logsearch/ambari-logsearch-web/src/app/components/main-container/main-container.component.less
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/main-container/main-container.component.less b/ambari-logsearch/ambari-logsearch-web/src/app/components/main-container/main-container.component.less
index f7dcc05..b596a3d 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/main-container/main-container.component.less
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/main-container/main-container.component.less
@@ -16,7 +16,7 @@
  * limitations under the License.
  */
 
-@import '../variables';
+@import '../mixins';
 
 :host {
   .full-size;

http://git-wip-us.apache.org/repos/asf/ambari/blob/6f598067/ambari-logsearch/ambari-logsearch-web/src/app/components/main.less
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/main.less b/ambari-logsearch/ambari-logsearch-web/src/app/components/main.less
new file mode 100644
index 0000000..2580710
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/main.less
@@ -0,0 +1,20 @@
+/**
+ * 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.
+ */
+
+@import "variables";
+@import "mixins";

http://git-wip-us.apache.org/repos/asf/ambari/blob/6f598067/ambari-logsearch/ambari-logsearch-web/src/app/components/menu-button/menu-button.component.less
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/menu-button/menu-button.component.less b/ambari-logsearch/ambari-logsearch-web/src/app/components/menu-button/menu-button.component.less
index 6a3a43d..615db24 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/menu-button/menu-button.component.less
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/menu-button/menu-button.component.less
@@ -15,19 +15,31 @@
  * limitations under the License.
  */
 
+@import '../variables';
+
 :host {
-  display: inline-block;
   cursor: pointer;
-
+  display: inline-block;
+  position: relative;
   a:hover, a:focus {
     text-decoration: none;
   }
 
   .icon {
-    padding: 5px;
+    padding: @icon-padding;
   }
 
   .unstyled-link {
     color: inherit;
   }
+
+  .badge {
+    background: @badge-bg;
+    font-size: 1rem;
+    min-width: 1em;
+    padding: @badge-padding;
+    position: absolute;
+    top: 0;
+    right: -1em;
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/6f598067/ambari-logsearch/ambari-logsearch-web/src/app/components/menu-button/menu-button.component.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/menu-button/menu-button.component.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/menu-button/menu-button.component.ts
index 3bac984..0aa7c7e 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/menu-button/menu-button.component.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/menu-button/menu-button.component.ts
@@ -61,6 +61,9 @@ export class MenuButtonComponent {
   @Input()
   additionalLabelComponentSetter?: string;
 
+  @Input()
+  badge: string;
+
   get hasSubItems(): boolean {
     return Boolean(this.subItems && this.subItems.length);
   }
@@ -90,7 +93,7 @@ export class MenuButtonComponent {
       event.stopPropagation();
     }
   }
-  
+
   updateValue(options: ListItem) {
     // TODO implement value change behaviour
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/6f598067/ambari-logsearch/ambari-logsearch-web/src/app/components/mixins.less
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/mixins.less b/ambari-logsearch/ambari-logsearch-web/src/app/components/mixins.less
new file mode 100644
index 0000000..2e46213
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/mixins.less
@@ -0,0 +1,200 @@
+/**
+ * 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.
+ */
+@import 'variables';
+
+// Mixins
+.flex-vertical-align {
+  display: flex;
+  align-items: center;
+}
+
+.default-flex {
+  .flex-vertical-align;
+  justify-content: space-between;
+}
+
+.common-hexagon(@side, @color) {
+  display: block;
+  position: absolute;
+  margin: (@side / 3.464101615) 0;
+  width: @side;
+  height: @side / 1.732050808;
+  background-color: @color;
+
+  &:before, &:after {
+    display: block;
+    position: absolute;
+    width: 0;
+    border-left: (@side / 2) solid transparent;
+    border-right: (@side / 2) solid transparent;
+    content: '';
+  }
+
+  &:before {
+    bottom: 100%;
+    border-bottom: (@side / 3.464101615) solid @color;
+  }
+
+  &:after {
+    top: 100%;
+    border-top: (@side / 3.464101615) solid @color;
+  }
+}
+
+.clickable-item {
+  cursor: pointer;
+  color: @link-color;
+
+  &:hover {
+    color: @link-hover-color;
+  }
+}
+
+.full-size {
+  position: absolute;
+  top: 0;
+  right: 0;
+  bottom: 0;
+  left: 0;
+}
+
+.dropdown-list-default {
+  line-height: 1;
+  border-radius: 2px;
+  font-size: 14px;
+  min-width: @dropdown-min-width;
+  background: #FFF;
+  color: #666;
+  border: 1px solid #CFD3D7;
+  padding: 5px 0;
+  margin: 2px 0 0;
+  text-align: left;
+  list-style: none;
+  box-shadow: 0 6px 12px rgba(0, 0, 0, .175);
+}
+
+.dropdown-item-default {
+  display: block;
+  padding: 3px 20px;
+  clear: both;
+  font-weight: 400;
+  line-height: 1.42857143;
+  color: #333;
+  white-space: nowrap;
+  cursor: pointer;
+
+  &:hover {
+    color: #262626;
+    text-decoration: none;
+    background-color: #F5F5F5;
+  }
+}
+
+.log-colors {
+  &.fatal {
+    color: @fatal-color;
+  }
+
+  &.error {
+    color: @error-color;
+  }
+
+  &.warn {
+    color: @warning-color;
+  }
+
+  &.info {
+    color: @info-color;
+  }
+
+  &.debug {
+    color: @debug-color;
+  }
+
+  &.trace {
+    color: @trace-color;
+  }
+
+  &.unknown {
+    color: @unknown-color;
+  }
+}
+
+/**
+ * Caret mixin definition.
+ * The .caret mixin has two parameters: the width of the caret and the direction of the caret
+ * This is the Less implementation of the Bootstrap caret mixin:
+ * https://github.com/twbs/bootstrap/blob/v4-dev/scss/mixins/_caret.scss
+ */
+
+// This small mixin create the css of the down direction of a caret
+.caret-direction(@caret-width, @direction, @color) when (@direction = down) {
+  border-top: @caret-width solid @color;
+  border-right: @caret-width solid transparent;
+  border-bottom: 0;
+  border-left: @caret-width solid transparent;
+}
+// This small mixin to create the css for the up direction
+.caret-direction(@caret-width, @direction, @color) when (@direction = up) {
+  border-top: 0;
+  border-right: @caret-width solid transparent;
+  border-bottom: @caret-width solid @color;
+  border-left: @caret-width solid transparent;
+}
+// This small mixin to create the css for the right direction
+.caret-direction(@caret-width, @direction, @color) when (@direction = right) {
+  border-top: @caret-width solid transparent;
+  border-right: 0;
+  border-bottom: @caret-width solid transparent;
+  border-left: @caret-width solid @color;
+}
+// This small mixin to create the css for the left direction
+.caret-direction(@caret-width, @direction, @color) when (@direction = left) {
+  border-top: @caret-width solid transparent;
+  border-right: @caret-width solid @color;
+  border-bottom: @caret-width solid transparent;
+  border-left: 0;
+}
+// This is the content for the caret pseaudo element. It has been moved out from the .caret definition because
+// the property interpolation does not work so that we can use condition
+.caret-style(@caret-width, @direction, @color) {
+  display: inline-block;
+  width: 0;
+  height: 0;
+  margin-left: @caret-width * .85;
+  vertical-align: @caret-width * .85;
+  content: "";
+  .caret-direction(@caret-width, @direction, @color);
+}
+// This is the main caret mixin to create the common and the direction related css
+.caret(@caret-width; @direction: down; @color: @base-font-color; @position: before) {
+
+  &::before when (@position = before) {
+    .caret-style(@caret-width, @direction, @color);
+  }
+  &::after when (@position = after) {
+    .caret-style(@caret-width, @direction, @color);
+  }
+
+  &:empty::before when (@position = before) {
+    margin-left: 0;
+  }
+  &:empty::after when (@position = after) {
+    margin-left: 0;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/6f598067/ambari-logsearch/ambari-logsearch-web/src/app/components/pagination-controls/pagination-controls.component.less
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/pagination-controls/pagination-controls.component.less b/ambari-logsearch/ambari-logsearch-web/src/app/components/pagination-controls/pagination-controls.component.less
index 8238eaf..ab615f1 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/pagination-controls/pagination-controls.component.less
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/pagination-controls/pagination-controls.component.less
@@ -16,7 +16,7 @@
  * limitations under the License.
  */
 
-@import '../variables';
+@import '../mixins';
 
 .pagination-control {
   .clickable-item;

http://git-wip-us.apache.org/repos/asf/ambari/blob/6f598067/ambari-logsearch/ambari-logsearch-web/src/app/components/pagination/pagination.component.less
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/pagination/pagination.component.less b/ambari-logsearch/ambari-logsearch-web/src/app/components/pagination/pagination.component.less
index df8ad2d..f3f12f7 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/pagination/pagination.component.less
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/pagination/pagination.component.less
@@ -16,7 +16,7 @@
  * limitations under the License.
  */
 
-@import '../variables';
+@import '../mixins';
 
 :host {
   display: flex;
@@ -25,4 +25,4 @@
     .flex-vertical-align;
     justify-content: flex-end;
   }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/6f598067/ambari-logsearch/ambari-logsearch-web/src/app/components/search-box/search-box.component.less
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/search-box/search-box.component.less b/ambari-logsearch/ambari-logsearch-web/src/app/components/search-box/search-box.component.less
index 6d4378b..f0a5ce0 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/search-box/search-box.component.less
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/search-box/search-box.component.less
@@ -16,7 +16,7 @@
  * limitations under the License.
  */
 
-@import '../variables';
+@import '../mixins';
 
 @inactive-input-width: 1px;
 @label-margin: 2px;

http://git-wip-us.apache.org/repos/asf/ambari/blob/6f598067/ambari-logsearch/ambari-logsearch-web/src/app/components/time-histogram/time-histogram.component.less
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/time-histogram/time-histogram.component.less b/ambari-logsearch/ambari-logsearch-web/src/app/components/time-histogram/time-histogram.component.less
index 1d29c55..6fe6292 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/time-histogram/time-histogram.component.less
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/time-histogram/time-histogram.component.less
@@ -18,7 +18,7 @@
 
 :host {
   cursor: crosshair;
-
+  background: #ECECEC; // TODO add style according to actual design
   /deep/ .axis {
     .domain {
       display: none;

http://git-wip-us.apache.org/repos/asf/ambari/blob/6f598067/ambari-logsearch/ambari-logsearch-web/src/app/components/time-range-picker/time-range-picker.component.less
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/time-range-picker/time-range-picker.component.less b/ambari-logsearch/ambari-logsearch-web/src/app/components/time-range-picker/time-range-picker.component.less
index 7d45778..24b1efa 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/time-range-picker/time-range-picker.component.less
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/time-range-picker/time-range-picker.component.less
@@ -16,7 +16,7 @@
  * limitations under the License.
  */
 
-@import '../variables';
+@import '../mixins';
 
 .btn.dropdown-toggle {
   text-transform: none;

http://git-wip-us.apache.org/repos/asf/ambari/blob/6f598067/ambari-logsearch/ambari-logsearch-web/src/app/components/top-menu/top-menu.component.html
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/top-menu/top-menu.component.html b/ambari-logsearch/ambari-logsearch-web/src/app/components/top-menu/top-menu.component.html
index 3af1a69..a7858a5 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/top-menu/top-menu.component.html
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/top-menu/top-menu.component.html
@@ -17,5 +17,5 @@
 
 <menu-button *ngFor="let item of items" label="{{item.label | translate}}" [action]="item.action"
              [iconClass]="item.iconClass" [labelClass]="item.labelClass"
-             [subItems]="item.subItems" [hideCaret]="item.hideCaret">
+             [subItems]="item.subItems" [hideCaret]="item.hideCaret" [badge]="item.badge">
 </menu-button>

http://git-wip-us.apache.org/repos/asf/ambari/blob/6f598067/ambari-logsearch/ambari-logsearch-web/src/app/components/top-menu/top-menu.component.less
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/top-menu/top-menu.component.less b/ambari-logsearch/ambari-logsearch-web/src/app/components/top-menu/top-menu.component.less
index e5e85f4..4fe899a 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/top-menu/top-menu.component.less
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/top-menu/top-menu.component.less
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-@import '../variables';
+@import '../mixins';
 
 :host {
   .default-flex;

http://git-wip-us.apache.org/repos/asf/ambari/blob/6f598067/ambari-logsearch/ambari-logsearch-web/src/app/components/variables.less
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/variables.less b/ambari-logsearch/ambari-logsearch-web/src/app/components/variables.less
index 2dc6278..150ac56 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/variables.less
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/variables.less
@@ -17,6 +17,7 @@
  */
 
 // Variables
+@base-font-color: #666;
 @navbar-background-color: #323544;
 @h1-vertical-margin: 20px;
 @button-border-radius: 4px;
@@ -51,120 +52,12 @@
 @submit-hover-color: #449D44;
 @exclude-color: #EF6162;
 
-// Mixins
-.flex-vertical-align {
-  display: flex;
-  align-items: center;
-}
+// Panels
+@panel-heading: rgba(255, 255, 255, 1);
 
-.default-flex {
-  .flex-vertical-align;
-  justify-content: space-between;
-}
+// Badge
+@badge-bg: rgba(239, 97, 98, 1);
+@badge-padding: 2px 5px;
 
-.common-hexagon(@side, @color) {
-  display: block;
-  position: absolute;
-  margin: (@side / 3.464101615) 0;
-  width: @side;
-  height: @side / 1.732050808;
-  background-color: @color;
-
-  &:before, &:after {
-    display: block;
-    position: absolute;
-    width: 0;
-    border-left: (@side / 2) solid transparent;
-    border-right: (@side / 2) solid transparent;
-    content: '';
-  }
-
-  &:before {
-    bottom: 100%;
-    border-bottom: (@side / 3.464101615) solid @color;
-  }
-
-  &:after {
-    top: 100%;
-    border-top: (@side / 3.464101615) solid @color;
-  }
-}
-
-.clickable-item {
-  cursor: pointer;
-  color: @link-color;
-
-  &:hover {
-    color: @link-hover-color;
-  }
-}
-
-.full-size {
-  position: absolute;
-  top: 0;
-  right: 0;
-  bottom: 0;
-  left: 0;
-}
-
-.dropdown-list-default {
-  line-height: 1;
-  border-radius: 2px;
-  font-size: 14px;
-  min-width: @dropdown-min-width;
-  background: #FFF;
-  color: #666;
-  border: 1px solid #CFD3D7;
-  padding: 5px 0;
-  margin: 2px 0 0;
-  text-align: left;
-  list-style: none;
-  box-shadow: 0 6px 12px rgba(0, 0, 0, .175);
-}
-
-.dropdown-item-default {
-  display: block;
-  padding: 3px 20px;
-  clear: both;
-  font-weight: 400;
-  line-height: 1.42857143;
-  color: #333;
-  white-space: nowrap;
-  cursor: pointer;
-
-  &:hover {
-    color: #262626;
-    text-decoration: none;
-    background-color: #F5F5F5;
-  }
-}
-
-.log-colors {
-  &.fatal {
-    color: @fatal-color;
-  }
-
-  &.error {
-    color: @error-color;
-  }
-
-  &.warn {
-    color: @warning-color;
-  }
-
-  &.info {
-    color: @info-color;
-  }
-
-  &.debug {
-    color: @debug-color;
-  }
-
-  &.trace {
-    color: @trace-color;
-  }
-
-  &.unknown {
-    color: @unknown-color;
-  }
-}
+// Icon
+@icon-padding: 5px;

http://git-wip-us.apache.org/repos/asf/ambari/blob/6f598067/ambari-logsearch/ambari-logsearch-web/src/assets/i18n/en.json
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/assets/i18n/en.json b/ambari-logsearch/ambari-logsearch-web/src/assets/i18n/en.json
index 1dee559..99ddbe5 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/assets/i18n/en.json
+++ b/ambari-logsearch/ambari-logsearch-web/src/assets/i18n/en.json
@@ -1,5 +1,7 @@
 {
   "common.title": "Log Search",
+  "common.hide": "Hide",
+  "common.show": "Show",
 
   "modal.submit": "OK",
   "modal.cancel": "Cancel",
@@ -146,5 +148,10 @@
   "logs.copy": "Copy",
   "logs.open": "Open Log",
   "logs.context": "Context",
-  "logs.loadMore": "Load more"
+  "logs.loadMore": "Load more",
+  "logs.oneEventFound": "1 event found",
+  "logs.totalEventFound": "{{totalCount}} events found",
+  "logs.noEventFound": "No event found",
+  "logs.hideGraph": "Hide Graph",
+  "logs.showGraph": "Show Graph"
 }


[22/50] ambari git commit: AMBARI-22224. host and hostname built-in variables are not populated when performing Kerberos-related operations (rlevas)

Posted by am...@apache.org.
AMBARI-22224. host and hostname built-in variables are not populated when performing Kerberos-related operations (rlevas)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/0f76c7f9
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/0f76c7f9
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/0f76c7f9

Branch: refs/heads/branch-feature-AMBARI-22008
Commit: 0f76c7f9d642bced5c89e0a25986c12c89213912
Parents: d88d3cc
Author: Robert Levas <rl...@hortonworks.com>
Authored: Thu Oct 12 15:49:57 2017 -0400
Committer: Robert Levas <rl...@hortonworks.com>
Committed: Thu Oct 12 15:49:57 2017 -0400

----------------------------------------------------------------------
 .../ambari/server/controller/KerberosHelperImpl.java  |  2 +-
 .../kerberos/AbstractPrepareKerberosServerAction.java | 14 ++++++++++++++
 .../upgrades/PreconfigureKerberosAction.java          | 13 +++++++++++++
 .../AbstractPrepareKerberosServerActionTest.java      |  5 +++++
 4 files changed, 33 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/0f76c7f9/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelperImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelperImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelperImpl.java
index f8fe31a..4f14614 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelperImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelperImpl.java
@@ -1644,7 +1644,7 @@ public class KerberosHelperImpl implements KerberosHelper {
             // Calculate the current host-specific configurations. These will be used to replace
             // variables within the Kerberos descriptor data
             Map<String, Map<String, String>> configurations = calculateConfigurations(cluster,
-                hostname.equals(ambariServerHostname) ? null : hostname,
+                hostname,
                 kerberosDescriptor,
                 false,
                 false);

http://git-wip-us.apache.org/repos/asf/ambari/blob/0f76c7f9/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/AbstractPrepareKerberosServerAction.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/AbstractPrepareKerberosServerAction.java b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/AbstractPrepareKerberosServerAction.java
index 3db844a..7948a60 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/AbstractPrepareKerberosServerAction.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/AbstractPrepareKerberosServerAction.java
@@ -40,6 +40,7 @@ import org.apache.ambari.server.state.kerberos.KerberosDescriptor;
 import org.apache.ambari.server.state.kerberos.KerberosIdentityDescriptor;
 import org.apache.ambari.server.state.kerberos.KerberosServiceDescriptor;
 import org.apache.ambari.server.utils.StageUtils;
+import org.apache.commons.lang.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -141,6 +142,19 @@ public abstract class AbstractPrepareKerberosServerAction extends KerberosServer
           if (serviceDescriptor != null) {
             List<KerberosIdentityDescriptor> serviceIdentities = serviceDescriptor.getIdentities(true, filterContext);
 
+            if (!StringUtils.isEmpty(hostName)) {
+              // Update the configurations with the relevant hostname
+              Map<String, String> generalProperties = currentConfigurations.get("");
+              if (generalProperties == null) {
+                generalProperties = new HashMap<>();
+                currentConfigurations.put("", generalProperties);
+              }
+
+              // Add the current hostname under "host" and "hostname"
+              generalProperties.put("host", hostName);
+              generalProperties.put("hostname", hostName);
+            }
+
             // Add service-level principals (and keytabs)
             kerberosHelper.addIdentities(kerberosIdentityDataFileWriter, serviceIdentities,
                 identityFilter, hostName, serviceName, componentName, kerberosConfigurations, currentConfigurations, excludeHeadless);

http://git-wip-us.apache.org/repos/asf/ambari/blob/0f76c7f9/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/PreconfigureKerberosAction.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/PreconfigureKerberosAction.java b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/PreconfigureKerberosAction.java
index d18f333..5af7c6b 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/PreconfigureKerberosAction.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/PreconfigureKerberosAction.java
@@ -305,6 +305,19 @@ public class PreconfigureKerberosAction extends AbstractUpgradeServerAction {
 
             KerberosServiceDescriptor serviceDescriptor = kerberosDescriptor.getService(serviceName);
 
+            if (!StringUtils.isEmpty(hostName)) {
+              // Update the configurations with the relevant hostname
+              Map<String, String> generalProperties = currentConfigurations.get("");
+              if (generalProperties == null) {
+                generalProperties = new HashMap<>();
+                currentConfigurations.put("", generalProperties);
+              }
+
+              // Add the current hostname under "host" and "hostname"
+              generalProperties.put("host", hostName);
+              generalProperties.put("hostname", hostName);
+            }
+
             if (serviceDescriptor != null) {
               List<KerberosIdentityDescriptor> serviceIdentities = serviceDescriptor.getIdentities(true, filterContext);
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/0f76c7f9/ambari-server/src/test/java/org/apache/ambari/server/serveraction/kerberos/AbstractPrepareKerberosServerActionTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/kerberos/AbstractPrepareKerberosServerActionTest.java b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/kerberos/AbstractPrepareKerberosServerActionTest.java
index 8ff5ad2..5522132 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/kerberos/AbstractPrepareKerberosServerActionTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/kerberos/AbstractPrepareKerberosServerActionTest.java
@@ -45,6 +45,7 @@ import org.apache.ambari.server.state.kerberos.KerberosComponentDescriptor;
 import org.apache.ambari.server.state.kerberos.KerberosDescriptor;
 import org.apache.ambari.server.state.kerberos.KerberosServiceDescriptor;
 import org.easymock.EasyMock;
+import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -152,6 +153,10 @@ public class AbstractPrepareKerberosServerActionTest {
         false, propertiesToIgnore, false);
 
     verify(kerberosHelper);
+
+    // Ensure the host and hostname values were set in the configuration context
+    Assert.assertEquals("host1", configurations.get("").get("host"));
+    Assert.assertEquals("host1", configurations.get("").get("hostname"));
   }
 
 }


[42/50] ambari git commit: AMBARI-22238 : Maven cleanup of ambari utility, logsearch and ambari metrics modules. (Commit 2) (avijayan)

Posted by am...@apache.org.
AMBARI-22238 : Maven cleanup of ambari utility, logsearch and ambari metrics modules. (Commit 2) (avijayan)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/75102dc4
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/75102dc4
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/75102dc4

Branch: refs/heads/branch-feature-AMBARI-22008
Commit: 75102dc4c8eb08772568cfd085682fe30f8289c6
Parents: 4a22350
Author: Aravindan Vijayan <av...@hortonworks.com>
Authored: Mon Oct 16 15:58:47 2017 -0700
Committer: Aravindan Vijayan <av...@hortonworks.com>
Committed: Mon Oct 16 15:58:47 2017 -0700

----------------------------------------------------------------------
 ambari-infra/ambari-infra-assembly/pom.xml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/75102dc4/ambari-infra/ambari-infra-assembly/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-assembly/pom.xml b/ambari-infra/ambari-infra-assembly/pom.xml
index 2b4959b..bf0e679 100644
--- a/ambari-infra/ambari-infra-assembly/pom.xml
+++ b/ambari-infra/ambari-infra-assembly/pom.xml
@@ -120,9 +120,9 @@
                       <sources>
                         <source>
                           <location>${solr.client.dir}/target/package</location>
-                          <exclude>
+                          <excludes>
                             <exclude>libs/checkstyle*.jar</exclude>
-                          </exclude>
+                          </excludes>
                         </source>
                       </sources>
                     </mapping>


[09/50] ambari git commit: AMBARI-22205 - Install Version Fails On IOP Cluster Due To Missing stack_packages Structure (jonathanhurley)

Posted by am...@apache.org.
AMBARI-22205 - Install Version Fails On IOP Cluster Due To Missing stack_packages Structure  (jonathanhurley)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/323974e1
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/323974e1
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/323974e1

Branch: refs/heads/branch-feature-AMBARI-22008
Commit: 323974e19d469313c9bafa1bda3000ea62f85bc8
Parents: 6f59806
Author: Jonathan Hurley <jh...@hortonworks.com>
Authored: Wed Oct 11 10:41:38 2017 -0400
Committer: Jonathan Hurley <jh...@hortonworks.com>
Committed: Wed Oct 11 15:02:13 2017 -0400

----------------------------------------------------------------------
 .../internal/ClusterStackVersionResourceProvider.java           | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/323974e1/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterStackVersionResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterStackVersionResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterStackVersionResourceProvider.java
index 388551f..1a75559 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterStackVersionResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterStackVersionResourceProvider.java
@@ -874,10 +874,11 @@ public class ClusterStackVersionResourceProvider extends AbstractControllerResou
     Config clusterEnv = cluster.getDesiredConfigByType(ConfigHelper.CLUSTER_ENV);
     Map<String, String> clusterEnvProperties = clusterEnv.getProperties();
 
-    // the 3 properties we need to check and update
+    // the 4 properties we need to check and update
     Set<String> properties = Sets.newHashSet(ConfigHelper.CLUSTER_ENV_STACK_ROOT_PROPERTY,
         ConfigHelper.CLUSTER_ENV_STACK_TOOLS_PROPERTY,
-        ConfigHelper.CLUSTER_ENV_STACK_FEATURES_PROPERTY);
+        ConfigHelper.CLUSTER_ENV_STACK_FEATURES_PROPERTY,
+        ConfigHelper.CLUSTER_ENV_STACK_PACKAGES_PROPERTY);
 
     // any updates are stored here and merged into the existing config type
     Map<String, String> updatedProperties = new HashMap<>();


[43/50] ambari git commit: AMBARI-22245 - YARN Service Checks Fails Because of Old hadoop-client Classpath Entry (part2) (jonathanhurley)

Posted by am...@apache.org.
AMBARI-22245 - YARN Service Checks Fails Because of Old hadoop-client Classpath Entry (part2) (jonathanhurley)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/79d4ac22
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/79d4ac22
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/79d4ac22

Branch: refs/heads/branch-feature-AMBARI-22008
Commit: 79d4ac220d41a6bd7c5e77b34ecc230f439cd968
Parents: 75102dc
Author: Jonathan Hurley <jh...@hortonworks.com>
Authored: Mon Oct 16 20:06:40 2017 -0400
Committer: Jonathan Hurley <jh...@hortonworks.com>
Committed: Mon Oct 16 20:06:59 2017 -0400

----------------------------------------------------------------------
 .../YARN/3.0.0.3.0/package/scripts/status_params.py       | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/79d4ac22/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/status_params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/status_params.py b/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/status_params.py
index 6bb528f..d2d1307 100644
--- a/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/status_params.py
+++ b/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/status_params.py
@@ -33,11 +33,11 @@ mapred_pid_dir_prefix = config['configurations']['mapred-env']['mapred_pid_dir_p
 yarn_pid_dir = format("{yarn_pid_dir_prefix}/{yarn_user}")
 mapred_pid_dir = format("{mapred_pid_dir_prefix}/{mapred_user}")
 
-resourcemanager_pid_file = format("{yarn_pid_dir}/yarn-{yarn_user}-resourcemanager.pid")
-nodemanager_pid_file = format("{yarn_pid_dir}/yarn-{yarn_user}-nodemanager.pid")
-yarn_historyserver_pid_file_old = format("{yarn_pid_dir}/yarn-{yarn_user}-historyserver.pid")
-yarn_historyserver_pid_file = format("{yarn_pid_dir}/yarn-{yarn_user}-timelineserver.pid")  # *-historyserver.pid is deprecated
-mapred_historyserver_pid_file = format("{mapred_pid_dir}/mapred-{mapred_user}-historyserver.pid")
+resourcemanager_pid_file = format("{yarn_pid_dir}/hadoop-{yarn_user}-resourcemanager.pid")
+nodemanager_pid_file = format("{yarn_pid_dir}/hadoop-{yarn_user}-nodemanager.pid")
+yarn_historyserver_pid_file_old = format("{yarn_pid_dir}/hadoop-{yarn_user}-historyserver.pid")
+yarn_historyserver_pid_file = format("{yarn_pid_dir}/hadoop-{yarn_user}-timelineserver.pid")  # *-historyserver.pid is deprecated
+mapred_historyserver_pid_file = format("{mapred_pid_dir}/hadoop-{mapred_user}-historyserver.pid")
 
 hadoop_home = stack_select.get_hadoop_dir("home")
 hadoop_conf_dir = functions.conf_select.get_hadoop_conf_dir()


[14/50] ambari git commit: AMBARI-22147 Move stacks/HDP/3.0/kerberos.json to stacks/kerberos.json (dsen)

Posted by am...@apache.org.
AMBARI-22147 Move stacks/HDP/3.0/kerberos.json to stacks/kerberos.json (dsen)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/c3f6ba76
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/c3f6ba76
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/c3f6ba76

Branch: refs/heads/branch-feature-AMBARI-22008
Commit: c3f6ba7621963b1086b7d9754d49b8663c7892b5
Parents: 3acfa5c
Author: Dmytro Sen <ds...@apache.org>
Authored: Thu Oct 12 13:52:31 2017 +0300
Committer: Dmytro Sen <ds...@apache.org>
Committed: Thu Oct 12 13:52:31 2017 +0300

----------------------------------------------------------------------
 ambari-server/src/main/assemblies/server.xml | 5 +++++
 1 file changed, 5 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/c3f6ba76/ambari-server/src/main/assemblies/server.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/assemblies/server.xml b/ambari-server/src/main/assemblies/server.xml
index 3079d1b..37283fa 100644
--- a/ambari-server/src/main/assemblies/server.xml
+++ b/ambari-server/src/main/assemblies/server.xml
@@ -392,6 +392,11 @@
       <outputDirectory>/var/lib/ambari-server/resources</outputDirectory>
     </file>
     <file>
+      <fileMode>755</fileMode>
+      <source>src/main/resources/kerberos.json</source>
+      <outputDirectory>/var/lib/ambari-server/resources</outputDirectory>
+    </file>
+    <file>
       <fileMode>644</fileMode>
       <source>src/main/resources/slider_resources/README.txt</source>
       <outputDirectory>/var/lib/ambari-server/resources/apps</outputDirectory>


[44/50] ambari git commit: AMBARI-22248. HBase default.rootdir config results in deploy failure if value is not overriden. (swagle)

Posted by am...@apache.org.
AMBARI-22248. HBase default.rootdir config results in deploy failure if value is not overriden. (swagle)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/e19029cb
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/e19029cb
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/e19029cb

Branch: refs/heads/branch-feature-AMBARI-22008
Commit: e19029cbd419fc6512350c365e43faff60d4acc9
Parents: 79d4ac2
Author: Siddharth Wagle <sw...@hortonworks.com>
Authored: Mon Oct 16 17:57:42 2017 -0700
Committer: Siddharth Wagle <sw...@hortonworks.com>
Committed: Mon Oct 16 17:57:42 2017 -0700

----------------------------------------------------------------------
 .../HBASE/0.96.0.2.0/configuration/hbase-site.xml  | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/e19029cb/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/configuration/hbase-site.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/configuration/hbase-site.xml b/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/configuration/hbase-site.xml
index 54ab35d..a48aad4 100644
--- a/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/configuration/hbase-site.xml
+++ b/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/configuration/hbase-site.xml
@@ -22,15 +22,16 @@
 <configuration supports_final="true">
   <property>
     <name>hbase.rootdir</name>
-    <value>hdfs://localhost:8020/apps/hbase/data</value>
+    <value>/apps/hbase/data</value>
     <description>The directory shared by region servers and into
-    which HBase persists.  The URL should be 'fully-qualified'
-    to include the filesystem scheme.  For example, to specify the
-    HDFS directory '/hbase' where the HDFS instance's namenode is
-    running at namenode.example.org on port 9000, set this value to:
-    hdfs://namenode.example.org:9000/hbase.  By default HBase writes
-    into /tmp.  Change this configuration else all data will be lost
-    on machine restart.
+      which HBase persists.  The URL should be 'fully-qualified'
+      to include the filesystem scheme.  For example, to specify the
+      HDFS directory '/hbase' where the HDFS instance's namenode is
+      running at namenode.example.org on port 9000, set this value to:
+      hdfs://namenode.example.org:9000/hbase.  By default HBase writes
+      into /tmp.  Change this configuration else all data will be lost
+      on machine restart. Ambari sets this a scheme less value which defaults to
+      a HDFS relative path.
     </description>
     <on-ambari-upgrade add="false"/>
   </property>


[38/50] ambari git commit: AMBARI-22233.Zeppelin service check failed during EU from 2.5 to 2.6 as ZeppelinServer can not be instantiated(Prabhjyot Singh Via Venkata Sairam)

Posted by am...@apache.org.
AMBARI-22233.Zeppelin service check failed during EU from 2.5 to 2.6 as ZeppelinServer can not be instantiated(Prabhjyot Singh Via Venkata Sairam)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/0317cf71
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/0317cf71
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/0317cf71

Branch: refs/heads/branch-feature-AMBARI-22008
Commit: 0317cf7163165f4a6f90b2337bf97382679dfee4
Parents: 2a8ac0d
Author: Venkata Sairam <ve...@gmail.com>
Authored: Mon Oct 16 18:20:06 2017 +0530
Committer: Venkata Sairam <ve...@gmail.com>
Committed: Mon Oct 16 18:20:06 2017 +0530

----------------------------------------------------------------------
 .../ZEPPELIN/0.7.0/package/scripts/master.py    | 40 +++++++++++++++++---
 .../stacks/2.6/ZEPPELIN/test_zeppelin_070.py    |  3 ++
 2 files changed, 37 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/0317cf71/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/master.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/master.py b/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/master.py
index 9d179b8..6ccdfba 100644
--- a/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/master.py
+++ b/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/master.py
@@ -192,7 +192,7 @@ class Master(Script):
       notebook_directory = "/user/" + format("{zeppelin_user}") + "/" + \
                            params.config['configurations']['zeppelin-config']['zeppelin.notebook.dir']
 
-    if not self.is_path_exists_in_HDFS(notebook_directory, params.zeppelin_user):
+    if not self.is_directory_exists_in_HDFS(notebook_directory, params.zeppelin_user):
       # hdfs dfs -mkdir {notebook_directory}
       params.HdfsResource(format("{notebook_directory}"),
                           type="directory",
@@ -243,7 +243,7 @@ class Master(Script):
       self.create_zeppelin_dir(params)
 
     if params.conf_stored_in_hdfs:
-      if not self.is_path_exists_in_HDFS(self.get_zeppelin_conf_FS_directory(params), params.zeppelin_user):
+      if not self.is_directory_exists_in_HDFS(self.get_zeppelin_conf_FS_directory(params), params.zeppelin_user):
         # hdfs dfs -mkdir {zeppelin's conf directory}
         params.HdfsResource(self.get_zeppelin_conf_FS_directory(params),
                             type="directory",
@@ -314,15 +314,17 @@ class Master(Script):
   def get_zeppelin_conf_FS(self, params):
     return self.get_zeppelin_conf_FS_directory(params) + "/interpreter.json"
 
-  def is_path_exists_in_HDFS(self, path, as_user):
+  def is_directory_exists_in_HDFS(self, path, as_user):
     kinit_path_local = get_kinit_path(default('/configurations/kerberos-env/executable_search_paths', None))
     kinit_if_needed = format("{kinit_path_local} -kt {zeppelin_kerberos_keytab} {zeppelin_kerberos_principal};")
-    path_exists = shell.call(format("{kinit_if_needed} hdfs --config {hadoop_conf_dir} dfs -test -e {path};echo $?"),
+
+    #-d: if the path is a directory, return 0.
+    path_exists = shell.call(format("{kinit_if_needed} hdfs --config {hadoop_conf_dir} dfs -test -d {path};echo $?"),
                              user=as_user)[1]
 
     # if there is no kerberos setup then the string will contain "-bash: kinit: command not found"
     if "\n" in path_exists:
-      path_exists = path_exists.split("\n")[1]
+      path_exists = path_exists.split("\n").pop()
 
     # '1' means it does not exists
     if path_exists == '0':
@@ -330,6 +332,31 @@ class Master(Script):
     else:
       return False
 
+  def is_file_exists_in_HDFS(self, path, as_user):
+    kinit_path_local = get_kinit_path(default('/configurations/kerberos-env/executable_search_paths', None))
+    kinit_if_needed = format("{kinit_path_local} -kt {zeppelin_kerberos_keytab} {zeppelin_kerberos_principal};")
+
+    #-f: if the path is a file, return 0.
+    path_exists = shell.call(format("{kinit_if_needed} hdfs --config {hadoop_conf_dir} dfs -test -f {path};echo $?"),
+                             user=as_user)[1]
+
+    # if there is no kerberos setup then the string will contain "-bash: kinit: command not found"
+    if "\n" in path_exists:
+      path_exists = path_exists.split("\n").pop()
+
+    # '1' means it does not exists
+    if path_exists == '0':
+      #-z: if the file is zero length, return 0.
+      path_exists = shell.call(format("{kinit_if_needed} hdfs --config {hadoop_conf_dir} dfs -test -z {path};echo $?"),
+                               user=as_user)[1]
+
+      if "\n" in path_exists:
+        path_exists = path_exists.split("\n").pop()
+      if path_exists != '0':
+        return True
+
+    return False
+
   def get_interpreter_settings(self):
     import params
     import json
@@ -338,7 +365,7 @@ class Master(Script):
     if params.conf_stored_in_hdfs:
       zeppelin_conf_fs = self.get_zeppelin_conf_FS(params)
 
-      if self.is_path_exists_in_HDFS(zeppelin_conf_fs, params.zeppelin_user):
+      if self.is_file_exists_in_HDFS(zeppelin_conf_fs, params.zeppelin_user):
         # copy from hdfs to /etc/zeppelin/conf/interpreter.json
         kinit_path_local = get_kinit_path(default('/configurations/kerberos-env/executable_search_paths',None))
         kinit_if_needed = format("{kinit_path_local} -kt {zeppelin_kerberos_keytab} {zeppelin_kerberos_principal};")
@@ -358,6 +385,7 @@ class Master(Script):
     File(interpreter_config,
          group=params.zeppelin_group,
          owner=params.zeppelin_user,
+         mode=0644,
          content=json.dumps(config_data, indent=2))
 
     if params.conf_stored_in_hdfs:

http://git-wip-us.apache.org/repos/asf/ambari/blob/0317cf71/ambari-server/src/test/python/stacks/2.6/ZEPPELIN/test_zeppelin_070.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.6/ZEPPELIN/test_zeppelin_070.py b/ambari-server/src/test/python/stacks/2.6/ZEPPELIN/test_zeppelin_070.py
index 400350c..f5027b2 100644
--- a/ambari-server/src/test/python/stacks/2.6/ZEPPELIN/test_zeppelin_070.py
+++ b/ambari-server/src/test/python/stacks/2.6/ZEPPELIN/test_zeppelin_070.py
@@ -364,6 +364,7 @@ class TestZeppelin070(RMFTestCase):
                           content=interpreter_json_generated.template_after_base,
                           owner='zeppelin',
                           group='zeppelin',
+                          mode=0644
                           )
 
 
@@ -392,6 +393,7 @@ class TestZeppelin070(RMFTestCase):
                               content=interpreter_json_generated.template_after_without_spark_and_livy,
                               owner='zeppelin',
                               group='zeppelin',
+                              mode=0644
                               )
 
     self.assertResourceCalled('HdfsResource',
@@ -419,6 +421,7 @@ class TestZeppelin070(RMFTestCase):
                               content=interpreter_json_generated.template_after_kerberos,
                               owner='zeppelin',
                               group='zeppelin',
+                              mode=0644
                               )
 
     self.assertResourceCalled('HdfsResource', 'hdfs:///user/zeppelin/conf/interpreter.json',


[18/50] ambari git commit: AMBARI-22212.Alter logic for storing interpreter.json(Prabhjyot Singh via Venkata Sairam)

Posted by am...@apache.org.
AMBARI-22212.Alter logic for storing interpreter.json(Prabhjyot Singh via Venkata Sairam)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/be605cbf
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/be605cbf
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/be605cbf

Branch: refs/heads/branch-feature-AMBARI-22008
Commit: be605cbfdc977ff927df89fc772b8fbb1f589fce
Parents: 3c3b1b8
Author: Venkata Sairam <ve...@gmail.com>
Authored: Thu Oct 12 17:17:07 2017 +0530
Committer: Venkata Sairam <ve...@gmail.com>
Committed: Thu Oct 12 17:17:07 2017 +0530

----------------------------------------------------------------------
 .../ZEPPELIN/0.7.0/package/scripts/master.py    | 69 +++++++++-----------
 .../ZEPPELIN/0.7.0/package/scripts/params.py    |  5 ++
 .../stacks/2.6/ZEPPELIN/test_zeppelin_070.py    | 52 +++------------
 3 files changed, 44 insertions(+), 82 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/be605cbf/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/master.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/master.py b/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/master.py
index eaa2cb9..a8b1b32 100644
--- a/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/master.py
+++ b/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/master.py
@@ -242,6 +242,17 @@ class Master(Script):
     if zeppelin_spark_dependencies and os.path.exists(zeppelin_spark_dependencies[0]):
       self.create_zeppelin_dir(params)
 
+    if params.conf_stored_in_hdfs:
+      if not self.is_path_exists_in_HDFS(self.get_zeppelin_conf_FS_directory(params), params.zeppelin_user):
+        # hdfs dfs -mkdir {zeppelin's conf directory}
+        params.HdfsResource(self.get_zeppelin_conf_FS_directory(params),
+                            type="directory",
+                            action="create_on_execute",
+                            owner=params.zeppelin_user,
+                            recursive_chown=True,
+                            recursive_chmod=True
+                            )
+
     # if first_setup:
     if not glob.glob(params.conf_dir + "/interpreter.json") and \
       not os.path.exists(params.conf_dir + "/interpreter.json"):
@@ -323,21 +334,16 @@ class Master(Script):
     import json
 
     interpreter_config = os.path.join(params.conf_dir, "interpreter.json")
-    if 'zeppelin.notebook.storage' in params.config['configurations']['zeppelin-config'] \
-      and params.config['configurations']['zeppelin-config']['zeppelin.notebook.storage'] == 'org.apache.zeppelin.notebook.repo.FileSystemNotebookRepo':
-
-      if 'zeppelin.config.fs.dir' in params.config['configurations']['zeppelin-config']:
-        zeppelin_conf_fs = self.get_zeppelin_conf_FS(params)
-
-        if self.is_path_exists_in_HDFS(zeppelin_conf_fs, params.zeppelin_user):
-          # copy from hdfs to /etc/zeppelin/conf/interpreter.json
-          kinit_path_local = get_kinit_path(default('/configurations/kerberos-env/executable_search_paths',None))
-          kinit_if_needed = format("{kinit_path_local} -kt {zeppelin_kerberos_keytab} {zeppelin_kerberos_principal};")
-          shell.call(format("rm {interpreter_config};"
-                            "{kinit_if_needed} hdfs --config {hadoop_conf_dir} dfs -get {zeppelin_conf_fs} {interpreter_config}"),
-                     user=params.zeppelin_user)
-        else:
-          Logger.info(format("{zeppelin_conf_fs} does not exist. Skipping upload of DFS."))
+    if params.conf_stored_in_hdfs:
+      zeppelin_conf_fs = self.get_zeppelin_conf_FS(params)
+
+      if self.is_path_exists_in_HDFS(zeppelin_conf_fs, params.zeppelin_user):
+        # copy from hdfs to /etc/zeppelin/conf/interpreter.json
+        kinit_path_local = get_kinit_path(default('/configurations/kerberos-env/executable_search_paths',None))
+        kinit_if_needed = format("{kinit_path_local} -kt {zeppelin_kerberos_keytab} {zeppelin_kerberos_principal};")
+        shell.call(format("rm {interpreter_config};"
+                          "{kinit_if_needed} hdfs --config {hadoop_conf_dir} dfs -get {zeppelin_conf_fs} {interpreter_config}"),
+                   user=params.zeppelin_user)
 
     config_content = sudo.read_file(interpreter_config)
     config_data = json.loads(config_content)
@@ -353,28 +359,15 @@ class Master(Script):
          owner=params.zeppelin_user,
          content=json.dumps(config_data, indent=2))
 
-    if 'zeppelin.notebook.storage' in params.config['configurations']['zeppelin-config'] \
-      and params.config['configurations']['zeppelin-config']['zeppelin.notebook.storage'] == 'org.apache.zeppelin.notebook.repo.FileSystemNotebookRepo':
-
-      if 'zeppelin.config.fs.dir' in params.config['configurations']['zeppelin-config']:
-        if not self.is_path_exists_in_HDFS(self.get_zeppelin_conf_FS_directory(params), params.zeppelin_user):
-          # hdfs dfs -mkdir {zeppelin's conf directory}
-          params.HdfsResource(self.get_zeppelin_conf_FS_directory(params),
-                              type="directory",
-                              action="create_on_execute",
-                              owner=params.zeppelin_user,
-                              recursive_chown=True,
-                              recursive_chmod=True
-                          )
-
-        params.HdfsResource(self.get_zeppelin_conf_FS(params),
-                            type="file",
-                            action="create_on_execute",
-                            source=interpreter_config,
-                            owner=params.zeppelin_user,
-                            recursive_chown=True,
-                            recursive_chmod=True,
-                            replace_existing_files=True)
+    if params.conf_stored_in_hdfs:
+      params.HdfsResource(self.get_zeppelin_conf_FS(params),
+                          type="file",
+                          action="create_on_execute",
+                          source=interpreter_config,
+                          owner=params.zeppelin_user,
+                          recursive_chown=True,
+                          recursive_chmod=True,
+                          replace_existing_files=True)
 
   def update_kerberos_properties(self):
     import params
@@ -451,7 +444,7 @@ class Master(Script):
     hive_interactive_properties_key = 'hive_interactive'
     for setting_key in interpreter_settings.keys():
       interpreter = interpreter_settings[setting_key]
-      if interpreter['group'] == 'jdbc':
+      if interpreter['group'] == 'jdbc' and interpreter['name'] == 'jdbc':
         interpreter['dependencies'] = []
 
         if not params.hive_server_host and params.hive_server_interactive_hosts:

http://git-wip-us.apache.org/repos/asf/ambari/blob/be605cbf/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/params.py b/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/params.py
index b7d3df0..e69037c 100644
--- a/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/params.py
+++ b/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/params.py
@@ -104,6 +104,11 @@ conf_dir = "/etc/zeppelin/conf"
 external_dependency_conf = "/etc/zeppelin/conf/external-dependency-conf"
 notebook_dir = os.path.join(*[install_dir, zeppelin_dirname, 'notebook'])
 
+conf_stored_in_hdfs = False
+if 'zeppelin.config.fs.dir' in config['configurations']['zeppelin-config'] and \
+  not config['configurations']['zeppelin-config']['zeppelin.config.fs.dir'].startswith('file://'):
+  conf_stored_in_hdfs = True
+
 # zeppelin-env.sh
 zeppelin_env_content = config['configurations']['zeppelin-env']['zeppelin_env_content']
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/be605cbf/ambari-server/src/test/python/stacks/2.6/ZEPPELIN/test_zeppelin_070.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.6/ZEPPELIN/test_zeppelin_070.py b/ambari-server/src/test/python/stacks/2.6/ZEPPELIN/test_zeppelin_070.py
index 3adb94c..e5d0240 100644
--- a/ambari-server/src/test/python/stacks/2.6/ZEPPELIN/test_zeppelin_070.py
+++ b/ambari-server/src/test/python/stacks/2.6/ZEPPELIN/test_zeppelin_070.py
@@ -341,12 +341,6 @@ class TestZeppelin070(RMFTestCase):
                               security_enabled=False,
                               )
 
-    self.assertResourceCalled('File', '/etc/zeppelin/conf/interpreter.json',
-                          content=interpreter_json_generated.template_after_base,
-                          owner='zeppelin',
-                          group='zeppelin',
-                          )
-
     self.assertResourceCalled('HdfsResource',
                               '/user/zeppelin/hdfs:///user/zeppelin/conf',
                               security_enabled=False,
@@ -359,13 +353,20 @@ class TestZeppelin070(RMFTestCase):
                               principal_name=UnknownConfigurationMock(),
                               recursive_chown=True,
                               recursive_chmod=True,
-                              owner='zeppelin',
                               user='hdfs',
+                              owner='zeppelin',
                               hadoop_conf_dir='/usr/hdp/2.5.0.0-1235/hadoop/conf',
                               type='directory',
                               action=['create_on_execute'],
                               )
 
+    self.assertResourceCalled('File', '/etc/zeppelin/conf/interpreter.json',
+                          content=interpreter_json_generated.template_after_base,
+                          owner='zeppelin',
+                          group='zeppelin',
+                          )
+
+
     self.assertResourceCalled('HdfsResource',
                               '/user/zeppelin/hdfs:///user/zeppelin/conf/interpreter.json',
                               security_enabled=False,
@@ -394,25 +395,6 @@ class TestZeppelin070(RMFTestCase):
                               )
 
     self.assertResourceCalled('HdfsResource',
-                              '/user/zeppelin/hdfs:///user/zeppelin/conf',
-                              security_enabled=False,
-                              hadoop_bin_dir='/usr/hdp/2.5.0.0-1235/hadoop/bin',
-                              keytab=UnknownConfigurationMock(),
-                              default_fs='hdfs://c6401.ambari.apache.org:8020',
-                              recursive_chown=True,
-                              recursive_chmod=True,
-                              hdfs_resource_ignore_file='/var/lib/ambari-agent/data/.hdfs_resource_ignore',
-                              hdfs_site={u'a': u'b'},
-                              kinit_path_local='/usr/bin/kinit',
-                              principal_name=UnknownConfigurationMock(),
-                              user='hdfs',
-                              owner='zeppelin',
-                              hadoop_conf_dir='/usr/hdp/2.5.0.0-1235/hadoop/conf',
-                              type='directory',
-                              action=['create_on_execute'],
-                              )
-
-    self.assertResourceCalled('HdfsResource',
                               '/user/zeppelin/hdfs:///user/zeppelin/conf/interpreter.json',
                               security_enabled=False,
                               hadoop_bin_dir='/usr/hdp/2.5.0.0-1235/hadoop/bin',
@@ -439,24 +421,6 @@ class TestZeppelin070(RMFTestCase):
                               group='zeppelin',
                               )
 
-    self.assertResourceCalled('HdfsResource', '/user/zeppelin/hdfs:///user/zeppelin/conf',
-                              security_enabled = False,
-                              hadoop_bin_dir = '/usr/hdp/2.5.0.0-1235/hadoop/bin',
-                              keytab = UnknownConfigurationMock(),
-                              default_fs = 'hdfs://c6401.ambari.apache.org:8020',
-                              hdfs_resource_ignore_file = '/var/lib/ambari-agent/data/.hdfs_resource_ignore',
-                              hdfs_site = {u'a': u'b'},
-                              kinit_path_local = '/usr/bin/kinit',
-                              principal_name = UnknownConfigurationMock(),
-                              recursive_chown=True,
-                              recursive_chmod=True,
-                              user = 'hdfs',
-                              owner = 'zeppelin',
-                              hadoop_conf_dir = '/usr/hdp/2.5.0.0-1235/hadoop/conf',
-                              type = 'directory',
-                              action = ['create_on_execute'],
-                              )
-
     self.assertResourceCalled('HdfsResource', '/user/zeppelin/hdfs:///user/zeppelin/conf/interpreter.json',
         security_enabled = False,
         hadoop_bin_dir = '/usr/hdp/2.5.0.0-1235/hadoop/bin',


[26/50] ambari git commit: AMBARI-22226. RU: Downgrade is failed ZKFC (ncole)

Posted by am...@apache.org.
AMBARI-22226. RU: Downgrade is failed ZKFC (ncole)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/20faae7a
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/20faae7a
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/20faae7a

Branch: refs/heads/branch-feature-AMBARI-22008
Commit: 20faae7a3647943b61e46f41ce27da81e91dc519
Parents: 3a0d168
Author: Nate Cole <nc...@hortonworks.com>
Authored: Fri Oct 13 08:42:12 2017 -0400
Committer: Nate Cole <nc...@hortonworks.com>
Committed: Fri Oct 13 09:19:08 2017 -0400

----------------------------------------------------------------------
 .../upgrades/FinalizeUpgradeAction.java         | 21 ++++++++++----------
 1 file changed, 10 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/20faae7a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FinalizeUpgradeAction.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FinalizeUpgradeAction.java b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FinalizeUpgradeAction.java
index d6876d9..87ea1fc 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FinalizeUpgradeAction.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FinalizeUpgradeAction.java
@@ -271,7 +271,7 @@ public class FinalizeUpgradeAction extends AbstractUpgradeServerAction {
             errors.size())).append(System.lineSeparator());
 
         for (InfoTuple error : errors) {
-          messageBuff.append(String.format("%s: $s (current = %s, desired = %s ", error.hostName,
+          messageBuff.append(String.format("%s: %s (current = %s, desired = %s)", error.hostName,
               error.componentName, error.currentVersion, error.targetVersion));
 
           messageBuff.append(System.lineSeparator());
@@ -367,23 +367,22 @@ public class FinalizeUpgradeAction extends AbstractUpgradeServerAction {
     Set<InfoTuple> errors = new TreeSet<>();
 
     Cluster cluster = upgradeContext.getCluster();
-    RepositoryVersionEntity repositoryVersionEntity = upgradeContext.getRepositoryVersion();
-    StackId targetStackId = repositoryVersionEntity.getStackId();
-
     Set<String> servicesParticipating = upgradeContext.getSupportedServices();
     for (String serviceName : servicesParticipating) {
       Service service = cluster.getService(serviceName);
-      String targetVersion = upgradeContext.getTargetVersion(serviceName);
+      RepositoryVersionEntity repositoryVersionEntity = upgradeContext.getTargetRepositoryVersion(serviceName);
+      StackId targetStackId = repositoryVersionEntity.getStackId();
+      String targetVersion = repositoryVersionEntity.getVersion();
 
       for (ServiceComponent serviceComponent : service.getServiceComponents().values()) {
-        for (ServiceComponentHost serviceComponentHost : serviceComponent.getServiceComponentHosts().values()) {
-          ComponentInfo componentInfo = ambariMetaInfo.getComponent(targetStackId.getStackName(),
-                  targetStackId.getStackVersion(), service.getName(), serviceComponent.getName());
+        ComponentInfo componentInfo = ambariMetaInfo.getComponent(targetStackId.getStackName(),
+            targetStackId.getStackVersion(), service.getName(), serviceComponent.getName());
 
-          if (!componentInfo.isVersionAdvertised()) {
-            continue;
-          }
+        if (!componentInfo.isVersionAdvertised()) {
+          continue;
+        }
 
+        for (ServiceComponentHost serviceComponentHost : serviceComponent.getServiceComponentHosts().values()) {
           if (!StringUtils.equals(targetVersion, serviceComponentHost.getVersion())) {
             errors.add(new InfoTuple(service.getName(), serviceComponent.getName(),
                 serviceComponentHost.getHostName(), serviceComponentHost.getVersion(),


[25/50] ambari git commit: AMBARI-22231 Stopping and starting HDFS component in Ambari will result in Namenode to stay in SAFEMODE (dsen)

Posted by am...@apache.org.
AMBARI-22231 Stopping and starting HDFS component in Ambari will result in Namenode to stay in SAFEMODE (dsen)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/3a0d168c
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/3a0d168c
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/3a0d168c

Branch: refs/heads/branch-feature-AMBARI-22008
Commit: 3a0d168c08edf559bc91f3eb76485797f83a6e48
Parents: 8f53bc4
Author: Dmytro Sen <ds...@apache.org>
Authored: Fri Oct 13 15:53:09 2017 +0300
Committer: Dmytro Sen <ds...@apache.org>
Committed: Fri Oct 13 15:53:09 2017 +0300

----------------------------------------------------------------------
 .../src/main/resources/stacks/HDP/3.0/role_command_order.json      | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/3a0d168c/ambari-server/src/main/resources/stacks/HDP/3.0/role_command_order.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/3.0/role_command_order.json b/ambari-server/src/main/resources/stacks/HDP/3.0/role_command_order.json
index 576910f..223eee5 100644
--- a/ambari-server/src/main/resources/stacks/HDP/3.0/role_command_order.json
+++ b/ambari-server/src/main/resources/stacks/HDP/3.0/role_command_order.json
@@ -87,7 +87,7 @@
     "PXF_SERVICE_CHECK-SERVICE_CHECK" : ["PXF-START", "HDFS_SERVICE_CHECK-SERVICE_CHECK", "HBASE_SERVICE_CHECK-SERVICE_CHECK", "HIVE_SERVICE_CHECK-SERVICE_CHECK"],
 
     "RANGER_ADMIN-START": ["ZOOKEEPER_SERVER-START", "INFRA_SOLR-START"],
-    "RANGER_USERSYNC-START" : ["RANGER_ADMIN-START", "RANGER_KMS_SERVER-START"],
+    "RANGER_USERSYNC-START" : ["RANGER_ADMIN-START"],
     "RANGER_KMS_SERVER-START" : ["RANGER_ADMIN-START"],
     "RANGER_KMS_SERVICE_CHECK-SERVICE_CHECK" : ["RANGER_KMS_SERVER-START"],
     "RANGER_SERVICE_CHECK-SERVICE_CHECK" : ["RANGER_USERSYNC-START", "RANGER_ADMIN-START"],


[39/50] ambari git commit: AMBARI-22220 - Should be able to switch the extension version to which a stack version is linked

Posted by am...@apache.org.
AMBARI-22220 - Should be able to switch the extension version to which a stack version is linked


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/5f86f159
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/5f86f159
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/5f86f159

Branch: refs/heads/branch-feature-AMBARI-22008
Commit: 5f86f159fae5f65b25ef77b5c9eb9cb7d1179834
Parents: 0317cf7
Author: Tim Thorpe <tt...@apache.org>
Authored: Mon Oct 16 06:16:35 2017 -0700
Committer: Tim Thorpe <tt...@apache.org>
Committed: Mon Oct 16 06:16:35 2017 -0700

----------------------------------------------------------------------
 .../controller/AmbariManagementController.java  |   6 +-
 .../AmbariManagementControllerImpl.java         |  50 ++++----
 .../controller/AmbariManagementHelper.java      |  26 ++++
 .../internal/ExtensionLinkResourceProvider.java |  15 +++
 .../ambari/server/stack/ExtensionHelper.java    |  31 ++++-
 .../server/stack/StackManagerExtensionTest.java |  22 +++-
 .../resources/extensions/EXT/0.2/metainfo.xml   |   4 +-
 .../resources/extensions/EXT/0.4/metainfo.xml   |  32 +++++
 .../EXT/0.4/services/OOZIE2/metainfo.xml        | 118 +++++++++++++++++++
 .../services/OOZIE2/themes/broken_theme.json    |   3 +
 10 files changed, 273 insertions(+), 34 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/5f86f159/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementController.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementController.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementController.java
index f0f13e1..45f9b3a 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementController.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementController.java
@@ -369,18 +369,18 @@ public interface AmbariManagementController {
   void createExtensionLink(ExtensionLinkRequest request) throws AmbariException;
 
   /**
-   * Update a link between an extension and a stack
+   * Update a link - switch the link's extension version while keeping the same stack version and extension name
    *
    * @throws AmbariException if we fail to link the extension to the stack
    */
   void updateExtensionLink(ExtensionLinkRequest request) throws AmbariException;
 
   /**
-   * Update a link between an extension and a stack
+   * Update a link - switch the link's extension version while keeping the same stack version and extension name
    *
    * @throws AmbariException if we fail to link the extension to the stack
    */
-  void updateExtensionLink(ExtensionLinkEntity linkEntity) throws AmbariException;
+  void updateExtensionLink(ExtensionLinkEntity oldLinkEntity, ExtensionLinkRequest newLinkRequest) throws AmbariException;
 
   /**
    * Delete a link between an extension and a stack

http://git-wip-us.apache.org/repos/asf/ambari/blob/5f86f159/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 b0eb8ac..1b1f524 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.info(e.getMessage());
+      LOG.error("Cluster not found ", e);
       throw new ParentObjectNotFoundException("Parent Cluster resource doesn't exist", e);
     }
 
@@ -4795,9 +4795,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
       properties = ambariMetaInfo.getServiceProperties(stackName, stackVersion, serviceName);
     }
     for (PropertyInfo property: properties) {
-      if (property.shouldBeConfigured()) {
-        response.add(property.convertToResponse());
-      }
+      response.add(property.convertToResponse());
     }
 
     return response;
@@ -5622,12 +5620,9 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
   }
 
   /**
-   * This method will update a link between an extension version and a stack version (Extension Link).
-   * Updating will only force ambari server to reread the stack and extension directories.
+   * Update a link - switch the link's extension version while keeping the same stack version and extension name
    *
-   * An extension version is like a stack version but it contains custom services.  Linking an extension
-   * version to the current stack version allows the cluster to install the custom services contained in
-   * the extension version.
+   * @throws AmbariException if we fail to link the extension to the stack
    */
   @Override
   public void updateExtensionLink(ExtensionLinkRequest request) throws AmbariException {
@@ -5641,32 +5636,43 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
       throw new AmbariException("Unable to find extension link"
             + ", linkId=" + request.getLinkId(), e);
     }
-    updateExtensionLink(linkEntity);
+    updateExtensionLink(linkEntity, request);
   }
 
   /**
-   * This method will update a link between an extension version and a stack version (Extension Link).
-   * Updating will only force ambari server to reread the stack and extension directories.
+   * Update a link - switch the link's extension version while keeping the same stack version and extension name
    *
-   * An extension version is like a stack version but it contains custom services.  Linking an extension
-   * version to the current stack version allows the cluster to install the custom services contained in
-   * the extension version.
+   * @throws AmbariException if we fail to link the extension to the stack
    */
   @Override
-  public void updateExtensionLink(ExtensionLinkEntity linkEntity) throws AmbariException {
-    StackInfo stackInfo = ambariMetaInfo.getStack(linkEntity.getStack().getStackName(), linkEntity.getStack().getStackVersion());
+  public void updateExtensionLink(ExtensionLinkEntity oldLinkEntity, ExtensionLinkRequest newLinkRequest) throws AmbariException {
+    StackInfo stackInfo = ambariMetaInfo.getStack(oldLinkEntity.getStack().getStackName(), oldLinkEntity.getStack().getStackVersion());
 
     if (stackInfo == null) {
-      throw new StackAccessException("stackName=" + linkEntity.getStack().getStackName() + ", stackVersion=" + linkEntity.getStack().getStackVersion());
+      throw new StackAccessException(String.format("stackName=%s, stackVersion=%s", oldLinkEntity.getStack().getStackName(), oldLinkEntity.getStack().getStackVersion()));
     }
 
-    ExtensionInfo extensionInfo = ambariMetaInfo.getExtension(linkEntity.getExtension().getExtensionName(), linkEntity.getExtension().getExtensionVersion());
+    if (newLinkRequest.getExtensionName() == null || newLinkRequest.getExtensionVersion() == null) {
+      throw new AmbariException(String.format("Invalid extension name or version: %s/%s",
+		  newLinkRequest.getExtensionName(), newLinkRequest.getExtensionVersion()));
+    }
 
-    if (extensionInfo == null) {
-      throw new StackAccessException("extensionName=" + linkEntity.getExtension().getExtensionName() + ", extensionVersion=" + linkEntity.getExtension().getExtensionVersion());
+    if (!newLinkRequest.getExtensionName().equals(oldLinkEntity.getExtension().getExtensionName())) {
+      throw new AmbariException(String.format("Update is not allowed to switch the extension name, only the version.  Old name/new name: %s/%s",
+		  oldLinkEntity.getExtension().getExtensionName(), newLinkRequest.getExtensionName()));
+    }
+
+    ExtensionInfo oldExtensionInfo = ambariMetaInfo.getExtension(oldLinkEntity.getExtension().getExtensionName(), oldLinkEntity.getExtension().getExtensionVersion());
+    ExtensionInfo newExtensionInfo = ambariMetaInfo.getExtension(newLinkRequest.getExtensionName(), newLinkRequest.getExtensionVersion());
+
+    if (oldExtensionInfo == null) {
+      throw new StackAccessException(String.format("Old extensionName=%s, extensionVersion=%s", oldLinkEntity.getExtension().getExtensionName(), oldLinkEntity.getExtension().getExtensionVersion()));
+    }
+    if (newExtensionInfo == null) {
+      throw new StackAccessException(String.format("New extensionName=%s, extensionVersion=%s", newLinkRequest.getExtensionName(), newLinkRequest.getExtensionVersion()));
     }
 
-    ambariMetaInfo.getStackManager().linkStackToExtension(stackInfo, extensionInfo);
+    helper.updateExtensionLink(ambariMetaInfo.getStackManager(), oldLinkEntity, stackInfo, oldExtensionInfo, newExtensionInfo);
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/ambari/blob/5f86f159/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementHelper.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementHelper.java
index 0c8edfe..e98c2e9 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementHelper.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementHelper.java
@@ -162,6 +162,32 @@ public class AmbariManagementHelper {
     }
   }
 
+  /**
+   * Updates the extension version of the currently linked extension to the stack version
+   */
+  public void updateExtensionLink(StackManager stackManager, ExtensionLinkEntity linkEntity, StackInfo stackInfo,
+                                  ExtensionInfo oldExtensionInfo, ExtensionInfo newExtensionInfo) throws AmbariException {
+    //validateUpdateExtensionLinkRequest(stackInfo, extensionInfo);
+    ExtensionHelper.validateUpdateLink(stackManager, stackInfo, oldExtensionInfo, newExtensionInfo);
+
+    ExtensionEntity extension = extensionDAO.find(newExtensionInfo.getName(), newExtensionInfo.getVersion());
+    linkEntity.setExtension(extension);
+
+    try {
+      linkEntity = linkDAO.merge(linkEntity);
+    } catch (RollbackException e) {
+      String message = "Unable to update extension link";
+      LOG.debug(message, e);
+      String errorMessage = message
+              + ", stackName=" + stackInfo.getName()
+              + ", stackVersion=" + stackInfo.getVersion()
+              + ", extensionName=" + newExtensionInfo.getName()
+              + ", extensionVersion=" + newExtensionInfo.getVersion();
+      LOG.warn(errorMessage);
+      throw new AmbariException(errorMessage, e);
+    }
+  }
+
   private ExtensionLinkEntity createExtensionLinkEntity(StackInfo stackInfo, ExtensionInfo extensionInfo) throws AmbariException {
     StackEntity stack = stackDAO.find(stackInfo.getName(), stackInfo.getVersion());
     ExtensionEntity extension = extensionDAO.find(extensionInfo.getName(), extensionInfo.getVersion());

http://git-wip-us.apache.org/repos/asf/ambari/blob/5f86f159/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ExtensionLinkResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ExtensionLinkResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ExtensionLinkResourceProvider.java
index 9b894ff..db904bf 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ExtensionLinkResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ExtensionLinkResourceProvider.java
@@ -196,6 +196,21 @@ public class ExtensionLinkResourceProvider extends AbstractControllerResourcePro
         throws SystemException, UnsupportedPropertyException,
         NoSuchResourceException, NoSuchParentResourceException {
 
+    final Set<ExtensionLinkRequest> requests = new HashSet<>();
+    for (Map<String, Object> propertyMap : request.getProperties()) {
+      requests.add(getRequest(propertyMap));
+    }
+
+    RequestStatusResponse response = modifyResources(new Command<RequestStatusResponse>() {
+      @Override
+      public RequestStatusResponse invoke() throws AmbariException {
+        for (ExtensionLinkRequest extensionLinkRequest : requests) {
+          getManagementController().updateExtensionLink(extensionLinkRequest);
+        }
+        return null;
+      }
+    });
+
     //Need to reread the stacks/extensions directories so the latest information is available
     try {
       getManagementController().updateStacks();

http://git-wip-us.apache.org/repos/asf/ambari/blob/5f86f159/ambari-server/src/main/java/org/apache/ambari/server/stack/ExtensionHelper.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/stack/ExtensionHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/stack/ExtensionHelper.java
index 91dc870..3a143f4 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/stack/ExtensionHelper.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/stack/ExtensionHelper.java
@@ -18,6 +18,9 @@
 
 package org.apache.ambari.server.stack;
 
+import java.util.ArrayList;
+import java.util.Collection;
+
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.ServiceNotFoundException;
 import org.apache.ambari.server.state.Cluster;
@@ -72,6 +75,12 @@ public class ExtensionHelper {
     validateRequiredExtensions(stack, extension);
   }
 
+  public static void validateUpdateLink(StackManager stackManager, StackInfo stack, ExtensionInfo oldExtension, ExtensionInfo newExtension) throws AmbariException {
+    validateSupportedStackVersion(stack, newExtension);
+    validateServiceDuplication(stackManager, stack, oldExtension, newExtension);
+    validateRequiredExtensions(stack, newExtension);
+  }
+
   private static void validateSupportedStackVersion(StackInfo stack, ExtensionInfo extension) throws AmbariException {
     for (ExtensionMetainfoXml.Stack validStack : extension.getStacks()) {
       if (validStack.getName().equals(stack.getName())) {
@@ -93,8 +102,28 @@ public class ExtensionHelper {
   }
 
   private static void validateServiceDuplication(StackManager stackManager, StackInfo stack, ExtensionInfo extension) throws AmbariException {
+    validateServiceDuplication(stackManager, stack, extension, extension.getServices());
+  }
+
+  private static void validateServiceDuplication(StackManager stackManager, StackInfo stack, ExtensionInfo oldExtension, ExtensionInfo newExtension) throws AmbariException {
+    ArrayList<ServiceInfo> services = new ArrayList<>(newExtension.getServices().size());
+    for (ServiceInfo service : newExtension.getServices()) {
+      boolean found = false;
+      for (ServiceInfo current : oldExtension.getServices()) {
+        if (service.getName().equals(current.getName())) {
+          found = true;
+        }
+      }
+      if (!found) {
+        services.add(service);
+      }
+    }
+    validateServiceDuplication(stackManager, stack, newExtension, services);
+  }
+
+  private static void validateServiceDuplication(StackManager stackManager, StackInfo stack, ExtensionInfo extension, Collection<ServiceInfo> services) throws AmbariException {
     LOG.debug("Looking for duplicate services");
-    for (ServiceInfo service : extension.getServices()) {
+    for (ServiceInfo service : services) {
       LOG.debug("Looking for duplicate service " + service.getName());
       if (service != null) {
         ServiceInfo stackService = null;

http://git-wip-us.apache.org/repos/asf/ambari/blob/5f86f159/ambari-server/src/test/java/org/apache/ambari/server/stack/StackManagerExtensionTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/stack/StackManagerExtensionTest.java b/ambari-server/src/test/java/org/apache/ambari/server/stack/StackManagerExtensionTest.java
index cef30b5..6617b33 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/stack/StackManagerExtensionTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/stack/StackManagerExtensionTest.java
@@ -81,6 +81,9 @@ public class StackManagerExtensionTest  {
     ExtensionEntity extension3 = new ExtensionEntity();
     extension3.setExtensionName("EXT");
     extension3.setExtensionVersion("0.3");
+    ExtensionEntity extension4 = new ExtensionEntity();
+    extension4.setExtensionName("EXT");
+    extension4.setExtensionVersion("0.4");
     ExtensionLinkEntity link1 = new ExtensionLinkEntity();
     link1.setLinkId(new Long(-1));
     link1.setStack(stack1);
@@ -96,6 +99,7 @@ public class StackManagerExtensionTest  {
     expect(extensionDao.find("EXT", "0.1")).andReturn(extension1).atLeastOnce();
     expect(extensionDao.find("EXT", "0.2")).andReturn(extension2).atLeastOnce();
     expect(extensionDao.find("EXT", "0.3")).andReturn(extension3).atLeastOnce();
+    expect(extensionDao.find("EXT", "0.4")).andReturn(extension4).atLeastOnce();
 
     expect(linkDao.findByStack("HDP", "0.1")).andReturn(linkList).atLeastOnce();
     expect(linkDao.findByStack(EasyMock.anyObject(String.class),
@@ -104,6 +108,8 @@ public class StackManagerExtensionTest  {
     expect(linkDao.findByStackAndExtension("HDP", "0.2", "EXT", "0.2")).andReturn(null).atLeastOnce();
     expect(linkDao.findByStackAndExtension("HDP", "0.1", "EXT", "0.1")).andReturn(link1).atLeastOnce();
 
+    expect(linkDao.merge(link1)).andReturn(link1).atLeastOnce();
+
     replay(actionMetadata, stackDao, metaInfoDao, osFamily, extensionDao, linkDao); //linkEntity
 
     String stacks = ClassLoader.getSystemClassLoader().getResource("stacks_with_extensions").getPath();
@@ -144,7 +150,7 @@ public class StackManagerExtensionTest  {
     assertNotNull("EXT 0.2's parent: " + extension.getParentExtensionVersion(), extension.getParentExtensionVersion());
     assertEquals("EXT 0.2's parent: " + extension.getParentExtensionVersion(), "0.1", extension.getParentExtensionVersion());
     assertNotNull(extension.getService("OOZIE2"));
-    assertTrue("Extension is not set to auto link", extension.isAutoLink());
+    assertTrue("Extension is set to auto link", !extension.isAutoLink());
     oozie = extension.getService("OOZIE2");
     assertNotNull("Package dir is " + oozie.getServicePackageFolder(), oozie.getServicePackageFolder());
     assertTrue("Package dir is " + oozie.getServicePackageFolder(), oozie.getServicePackageFolder().contains("extensions/EXT/0.1/services/OOZIE2/package"));
@@ -156,18 +162,24 @@ public class StackManagerExtensionTest  {
     assertNotNull(themes);
     assertTrue("Number of themes is " + themes.size(), themes.size() == 0);
 
+    extension = stackManager.getExtension("EXT", "0.3");
+    assertTrue("Extension is not set to auto link", extension.isAutoLink());
+
     StackInfo stack = stackManager.getStack("HDP", "0.1");
     assertNotNull(stack.getService("OOZIE2"));
     oozie = stack.getService("OOZIE2");
     assertNotNull("Package dir is " + oozie.getServicePackageFolder(), oozie.getServicePackageFolder());
     assertTrue("Package dir is " + oozie.getServicePackageFolder(), oozie.getServicePackageFolder().contains("extensions/EXT/0.1/services/OOZIE2/package"));
     assertEquals(oozie.getVersion(), "3.2.0");
-
     assertTrue("Extensions found: " + stack.getExtensions().size(), stack.getExtensions().size() == 1);
     extension = stack.getExtensions().iterator().next();
     assertEquals("Extension name: " + extension.getName(), extension.getName(), "EXT");
     assertEquals("Extension version: " + extension.getVersion(), extension.getVersion(), "0.1");
 
+    ExtensionInfo extensionInfo2 = stackManager.getExtension("EXT", "0.2");
+    helper.updateExtensionLink(stackManager, link1, stack, extension, extensionInfo2);
+    assertEquals(link1.getExtension().getExtensionVersion(), link1.getExtension().getExtensionVersion(), "0.2");
+
     stack = stackManager.getStack("HDP", "0.2");
     assertTrue("Extensions found: " + stack.getExtensions().size(), stack.getExtensions().size() == 0);
 
@@ -177,15 +189,13 @@ public class StackManagerExtensionTest  {
     assertNotNull(extension.getService("OOZIE2"));
     oozie = extension.getService("OOZIE2");
     assertEquals(oozie.getVersion(), "4.0.0");
-
     assertEquals("Extension name: " + extension.getName(), extension.getName(), "EXT");
-    assertEquals("Extension version: " + extension.getVersion(), extension.getVersion(), "0.3");
+    assertEquals("Extension version: " + extension.getVersion(), extension.getVersion(), "0.4");
 
     stack = stackManager.getStack("HDP", "0.4");
     assertTrue("Extensions found: " + stack.getExtensions().size(), stack.getExtensions().size() == 1);
     extension = stack.getExtensions().iterator().next();
     assertEquals("Extension name: " + extension.getName(), extension.getName(), "EXT");
-    assertEquals("Extension version: " + extension.getVersion(), extension.getVersion(), "0.3");
+    assertEquals("Extension version: " + extension.getVersion(), extension.getVersion(), "0.4");
   }
-
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/5f86f159/ambari-server/src/test/resources/extensions/EXT/0.2/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/resources/extensions/EXT/0.2/metainfo.xml b/ambari-server/src/test/resources/extensions/EXT/0.2/metainfo.xml
index c95a20f..fa84c53 100644
--- a/ambari-server/src/test/resources/extensions/EXT/0.2/metainfo.xml
+++ b/ambari-server/src/test/resources/extensions/EXT/0.2/metainfo.xml
@@ -20,12 +20,12 @@
     <active>true</active>
   </versions>
   <extends>0.1</extends>
-  <auto-link>true</auto-link>
+  <auto-link>false</auto-link>
   <prerequisites>
     <min-stack-versions>
       <stack>
         <name>HDP</name>
-        <version>0.3</version>
+        <version>0.1</version>
       </stack>
     </min-stack-versions>
   </prerequisites>

http://git-wip-us.apache.org/repos/asf/ambari/blob/5f86f159/ambari-server/src/test/resources/extensions/EXT/0.4/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/resources/extensions/EXT/0.4/metainfo.xml b/ambari-server/src/test/resources/extensions/EXT/0.4/metainfo.xml
new file mode 100644
index 0000000..0e74813
--- /dev/null
+++ b/ambari-server/src/test/resources/extensions/EXT/0.4/metainfo.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0"?>
+<!--
+   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.
+-->
+<metainfo>
+  <versions>
+    <active>true</active>
+  </versions>
+  <extends>0.3</extends>
+  <auto-link>true</auto-link>
+  <prerequisites>
+    <min-stack-versions>
+      <stack>
+        <name>HDP</name>
+        <version>0.3</version>
+      </stack>
+    </min-stack-versions>
+  </prerequisites>
+</metainfo>

http://git-wip-us.apache.org/repos/asf/ambari/blob/5f86f159/ambari-server/src/test/resources/extensions/EXT/0.4/services/OOZIE2/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/resources/extensions/EXT/0.4/services/OOZIE2/metainfo.xml b/ambari-server/src/test/resources/extensions/EXT/0.4/services/OOZIE2/metainfo.xml
new file mode 100644
index 0000000..9176551
--- /dev/null
+++ b/ambari-server/src/test/resources/extensions/EXT/0.4/services/OOZIE2/metainfo.xml
@@ -0,0 +1,118 @@
+<?xml version="1.0"?>
+<!--
+   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.
+-->
+<metainfo>
+  <schemaVersion>2.0</schemaVersion>
+  <services>
+    <service>
+      <name>OOZIE2</name>
+      <comment>System for workflow coordination and execution of Apache Hadoop jobs</comment>
+      <version>4.0.0</version>
+
+      <components>
+        <component>
+          <name>OOZIE2_SERVER</name>
+          <category>MASTER</category>
+          <cardinality>1</cardinality>
+          <dependencies>
+            <dependency>
+              <name>HDFS/HDFS_CLIENT</name>
+              <scope>host</scope>
+              <auto-deploy>
+                <enabled>true</enabled>
+              </auto-deploy>
+            </dependency>
+            <dependency>
+              <name>MAPREDUCE/MAPREDUCE_CLIENT</name>
+              <scope>host</scope>
+              <auto-deploy>
+                <enabled>true</enabled>
+              </auto-deploy>
+            </dependency>
+          </dependencies>
+          <commandScript>
+            <script>scripts/oozie2_server.py</script>
+            <scriptType>PYTHON</scriptType>
+            <timeout>600</timeout>
+          </commandScript>
+        </component>
+
+        <component>
+          <name>OOZIE2_CLIENT</name>
+          <category>CLIENT</category>
+          <cardinality>0+</cardinality>
+          <dependencies>
+            <dependency>
+              <name>HDFS/HDFS_CLIENT</name>
+              <scope>host</scope>
+              <auto-deploy>
+                <enabled>true</enabled>
+              </auto-deploy>
+            </dependency>
+            <dependency>
+              <name>MAPREDUCE/MAPREDUCE_CLIENT</name>
+              <scope>host</scope>
+              <auto-deploy>
+                <enabled>true</enabled>
+              </auto-deploy>
+            </dependency>
+          </dependencies>
+          <commandScript>
+            <script>scripts/oozie2_client.py</script>
+            <scriptType>PYTHON</scriptType>
+          </commandScript>
+        </component>
+      </components>
+
+      <osSpecifics>
+        <osSpecific>
+          <osFamily>any</osFamily>
+          <packages>
+            <package>
+              <name>oozie2.noarch</name>
+            </package>
+            <package>
+              <name>oozie2-client.noarch</name>
+            </package>
+            <package>
+              <name>extjs-2.2-1</name>
+            </package>
+          </packages>
+        </osSpecific>
+      </osSpecifics>
+
+      <commandScript>
+        <script>scripts/service_check.py</script>
+        <scriptType>PYTHON</scriptType>
+        <timeout>300</timeout>
+      </commandScript>
+
+      <configuration-dependencies>
+        <config-type>global</config-type>
+        <config-type>oozie2-site</config-type>
+      </configuration-dependencies>
+
+      <themes>
+        <theme>
+          <fileName>broken_theme.json</fileName>
+          <default>true</default>
+        </theme>
+      </themes>
+
+    </service>
+  </services>
+</metainfo>

http://git-wip-us.apache.org/repos/asf/ambari/blob/5f86f159/ambari-server/src/test/resources/extensions/EXT/0.4/services/OOZIE2/themes/broken_theme.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/resources/extensions/EXT/0.4/services/OOZIE2/themes/broken_theme.json b/ambari-server/src/test/resources/extensions/EXT/0.4/services/OOZIE2/themes/broken_theme.json
new file mode 100644
index 0000000..6e8b5bf
--- /dev/null
+++ b/ambari-server/src/test/resources/extensions/EXT/0.4/services/OOZIE2/themes/broken_theme.json
@@ -0,0 +1,3 @@
+{
+  "configuration": {
+}


[29/50] ambari git commit: AMBARI-22242. Express Upgrade from IOP 4.2 to HDP 2.6.2 AMS failed to restart before finalizing. (swagle)

Posted by am...@apache.org.
AMBARI-22242. Express Upgrade from IOP 4.2 to HDP 2.6.2 AMS failed to restart before finalizing. (swagle)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/62a0a18c
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/62a0a18c
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/62a0a18c

Branch: refs/heads/branch-feature-AMBARI-22008
Commit: 62a0a18ce57c7290989ab3ff5ffb08e88225570e
Parents: 6e1cac8
Author: Siddharth Wagle <sw...@hortonworks.com>
Authored: Fri Oct 13 20:55:36 2017 -0700
Committer: Siddharth Wagle <sw...@hortonworks.com>
Committed: Fri Oct 13 20:55:36 2017 -0700

----------------------------------------------------------------------
 .../AMBARI_METRICS/0.1.0/package/scripts/metrics_collector.py    | 4 ++--
 .../AMBARI_METRICS/0.1.0/package/scripts/metrics_grafana.py      | 4 ++--
 .../AMBARI_METRICS/0.1.0/package/scripts/metrics_monitor.py      | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/62a0a18c/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/metrics_collector.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/metrics_collector.py b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/metrics_collector.py
index fc2576d..1c6f2a1 100644
--- a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/metrics_collector.py
+++ b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/metrics_collector.py
@@ -44,13 +44,13 @@ class AmsCollector(Script):
     hbase('regionserver', action)
     ams(name='collector')
 
-  def start(self, env):
+  def start(self, env, upgrade_type=None):
     self.configure(env, action = 'start') # for security
     # stop hanging components before start
     ams_service('collector', action = 'stop')
     ams_service('collector', action = 'start')
 
-  def stop(self, env):
+  def stop(self, env, upgrade_type=None):
     import params
     env.set_params(params)
     # Sometimes, stop() may be called before start(), in case restart() is initiated right after installation

http://git-wip-us.apache.org/repos/asf/ambari/blob/62a0a18c/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/metrics_grafana.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/metrics_grafana.py b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/metrics_grafana.py
index 1f0e049..387b018 100644
--- a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/metrics_grafana.py
+++ b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/metrics_grafana.py
@@ -38,7 +38,7 @@ class AmsGrafana(Script):
     env.set_params(params)
     ams(name='grafana', action=action)
 
-  def start(self, env):
+  def start(self, env, upgrade_type=None):
     import params
     env.set_params(params)
     self.configure(env, action = 'start')
@@ -61,7 +61,7 @@ class AmsGrafana(Script):
     # Create pre-built dashboards
     create_ams_dashboards()
 
-  def stop(self, env):
+  def stop(self, env, upgrade_type=None):
     import params
     env.set_params(params)
     self.configure(env, action = 'stop')

http://git-wip-us.apache.org/repos/asf/ambari/blob/62a0a18c/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/metrics_monitor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/metrics_monitor.py b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/metrics_monitor.py
index a377f6d..16c7997 100644
--- a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/metrics_monitor.py
+++ b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/metrics_monitor.py
@@ -35,14 +35,14 @@ class AmsMonitor(Script):
     env.set_params(params)
     ams(name='monitor')
 
-  def start(self, env):
+  def start(self, env, upgrade_type=None):
     self.configure(env) # for security
 
     ams_service( 'monitor',
                  action = 'start'
     )
 
-  def stop(self, env):
+  def stop(self, env, upgrade_type=None):
     import params
     env.set_params(params)
 


[35/50] ambari git commit: AMBARI-22216. Ambari Schema Upgrade Failed during Ambari Upgrade - workaround (dlysnichenko)

Posted by am...@apache.org.
AMBARI-22216. Ambari Schema Upgrade Failed during Ambari Upgrade - workaround (dlysnichenko)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/e219186e
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/e219186e
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/e219186e

Branch: refs/heads/branch-feature-AMBARI-22008
Commit: e219186ea68a869ee0b7929dfd6c5322cf8c1e7b
Parents: df10813
Author: Lisnichenko Dmitro <dl...@hortonworks.com>
Authored: Mon Oct 16 12:13:01 2017 +0300
Committer: Lisnichenko Dmitro <dl...@hortonworks.com>
Committed: Mon Oct 16 12:13:47 2017 +0300

----------------------------------------------------------------------
 .../ambari/server/upgrade/UpgradeCatalog260.java | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/e219186e/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog260.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog260.java b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog260.java
index 866a501..71a0ff3 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog260.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog260.java
@@ -81,6 +81,7 @@ public class UpgradeCatalog260 extends AbstractUpgradeCatalog {
   public static final String DESIRED_REPO_VERSION_ID_COLUMN = "desired_repo_version_id";
   public static final String REPO_STATE_COLUMN = "repo_state";
   public static final String FK_SCDS_DESIRED_STACK_ID = "FK_scds_desired_stack_id";
+  public static final String FK_SERVICECOMPONENTDESIREDSTATE_DESIRED_STACK_ID = "FK_servicecomponentdesiredstate_desired_stack_id";
   public static final String FK_SCDS_DESIRED_REPO_ID = "FK_scds_desired_repo_id";
 
   public static final String REPO_VERSION_TABLE = "repo_version";
@@ -152,6 +153,9 @@ public class UpgradeCatalog260 extends AbstractUpgradeCatalog {
   public static final String STALE_POSTGRESS_USERS_LDAP_USER_KEY = "users_ldap_user_key";
   public static final String SHORT_URL_COLUMN = "short_url";
   public static final String FK_INSTANCE_URL_ID = "FK_instance_url_id";
+  public static final String FK_SERVICEDESIREDSTATE_DESIRED_STACK_ID = "FK_servicedesiredstate_desired_stack_id";
+  public static final String FK_HOSTCOMPONENTDESIREDSTATE_DESIRED_STACK_ID = "FK_hostcomponentdesiredstate_desired_stack_id";
+  public static final String FK_HOSTCOMPONENTSTATE_CURRENT_STACK_ID = "FK_hostcomponentstate_current_stack_id";
 
 
   /**
@@ -187,6 +191,7 @@ public class UpgradeCatalog260 extends AbstractUpgradeCatalog {
   @Override
   protected void executeDDLUpdates() throws AmbariException, SQLException {
     int currentVersionID = getCurrentVersionID();
+    dropBrokenFK();
     updateServiceComponentDesiredStateTable(currentVersionID);
     updateServiceDesiredStateTable(currentVersionID);
     addSelectedCollumsToClusterconfigTable();
@@ -202,6 +207,20 @@ public class UpgradeCatalog260 extends AbstractUpgradeCatalog {
     removeStaleConstraints();
   }
 
+  /**
+   * Drop broken FK
+   * {@value #FK_SERVICECOMPONENTDESIREDSTATE_DESIRED_STACK_ID}
+   * {@value #FK_SERVICEDESIREDSTATE_DESIRED_STACK_ID}
+   * {@value #FK_HOSTCOMPONENTDESIREDSTATE_DESIRED_STACK_ID}
+   * {@value #FK_HOSTCOMPONENTSTATE_CURRENT_STACK_ID}
+   */
+  private void dropBrokenFK() throws SQLException {
+    dbAccessor.dropFKConstraint(SERVICE_COMPONENT_DESIRED_STATE_TABLE, FK_SERVICECOMPONENTDESIREDSTATE_DESIRED_STACK_ID);
+    dbAccessor.dropFKConstraint(SERVICE_DESIRED_STATE_TABLE, FK_SERVICEDESIREDSTATE_DESIRED_STACK_ID);
+    dbAccessor.dropFKConstraint(HOST_COMPONENT_DESIRED_STATE_TABLE, FK_HOSTCOMPONENTDESIREDSTATE_DESIRED_STACK_ID);
+    dbAccessor.dropFKConstraint(HOST_COMPONENT_STATE_TABLE, FK_HOSTCOMPONENTSTATE_CURRENT_STACK_ID);
+  }
+
 
   /**
    * Updates {@value #VIEWURL_TABLE} table.


[41/50] ambari git commit: AMBARI-22245 - YARN Service Checks Fails Because of Old hadoop-client Classpath Entry (jonathanhurley)

Posted by am...@apache.org.
AMBARI-22245 - YARN Service Checks Fails Because of Old hadoop-client Classpath Entry (jonathanhurley)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/4a223503
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/4a223503
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/4a223503

Branch: refs/heads/branch-feature-AMBARI-22008
Commit: 4a2235037e2306ac8197f8d1bf917f5402f248bb
Parents: 523f505
Author: Jonathan Hurley <jh...@hortonworks.com>
Authored: Mon Oct 16 15:33:17 2017 -0400
Committer: Jonathan Hurley <jh...@hortonworks.com>
Committed: Mon Oct 16 16:13:00 2017 -0400

----------------------------------------------------------------------
 .../2.1.0.2.0/package/scripts/params_linux.py   | 34 +++++++++++--
 .../2.1.0.2.0/package/scripts/status_params.py  | 52 ++++++++-----------
 .../YARN/3.0.0.3.0/configuration/yarn-site.xml  |  2 +-
 .../3.0.0.3.0/package/scripts/params_linux.py   | 53 +++++++++++++++-----
 .../3.0.0.3.0/package/scripts/status_params.py  | 52 ++++++++-----------
 .../services/YARN/configuration/yarn-site.xml   |  2 +-
 .../stacks/HDP/2.6/upgrades/config-upgrade.xml  |  7 +++
 .../HDP/2.6/upgrades/nonrolling-upgrade-2.6.xml |  7 ++-
 .../stacks/HDP/2.6/upgrades/upgrade-2.6.xml     |  1 +
 9 files changed, 124 insertions(+), 86 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/4a223503/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/params_linux.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/params_linux.py b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/params_linux.py
index 2ab779f..620408b 100644
--- a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/params_linux.py
+++ b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/params_linux.py
@@ -20,8 +20,10 @@ Ambari Agent
 """
 import os
 
+from resource_management.core import sudo
 from resource_management.libraries.script.script import Script
 from resource_management.libraries.resources.hdfs_resource import HdfsResource
+from resource_management.libraries.functions import component_version
 from resource_management.libraries.functions import conf_select
 from resource_management.libraries.functions import stack_select
 from resource_management.libraries.functions import format
@@ -88,6 +90,7 @@ stack_supports_ranger_audit_db = check_stack_feature(StackFeature.RANGER_AUDIT_D
 hostname = config['hostname']
 
 # hadoop default parameters
+hadoop_home = status_params.hadoop_home
 hadoop_libexec_dir = stack_select.get_hadoop_dir("libexec")
 hadoop_bin = stack_select.get_hadoop_dir("sbin")
 hadoop_bin_dir = stack_select.get_hadoop_dir("bin")
@@ -113,12 +116,33 @@ if stack_supports_ru:
   if command_role in YARN_SERVER_ROLE_DIRECTORY_MAP:
     yarn_role_root = YARN_SERVER_ROLE_DIRECTORY_MAP[command_role]
 
-  hadoop_mapred2_jar_location = format("{stack_root}/current/{mapred_role_root}")
-  mapred_bin = format("{stack_root}/current/{mapred_role_root}/sbin")
-
+  # defaults set to current based on role
+  hadoop_mapr_home = format("{stack_root}/current/{mapred_role_root}")
   hadoop_yarn_home = format("{stack_root}/current/{yarn_role_root}")
-  yarn_bin = format("{stack_root}/current/{yarn_role_root}/sbin")
-  yarn_container_bin = format("{stack_root}/current/{yarn_role_root}/bin")
+
+  # try to render the specific version
+  version = component_version.get_component_repository_version()
+  if version is None:
+    version = default("/commandParams/version", None)
+
+
+  if version is not None:
+    hadoop_mapr_versioned_home = format("{stack_root}/{version}/hadoop-mapreduce")
+    hadoop_yarn_versioned_home = format("{stack_root}/{version}/hadoop-yarn")
+
+    if sudo.path_isdir(hadoop_mapr_versioned_home):
+      hadoop_mapr_home = hadoop_mapr_versioned_home
+
+    if sudo.path_isdir(hadoop_yarn_versioned_home):
+      hadoop_yarn_home = hadoop_yarn_versioned_home
+
+
+  hadoop_mapred2_jar_location = hadoop_mapr_home
+  mapred_bin = format("{hadoop_mapr_home}/sbin")
+
+  yarn_bin = format("{hadoop_yarn_home}/sbin")
+  yarn_container_bin = format("{hadoop_yarn_home}/bin")
+
 
 if stack_supports_timeline_state_store:
   # Timeline Service property that was added timeline_state_store stack feature

http://git-wip-us.apache.org/repos/asf/ambari/blob/4a223503/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/status_params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/status_params.py b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/status_params.py
index c2e9d92..6bb528f 100644
--- a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/status_params.py
+++ b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/status_params.py
@@ -19,43 +19,31 @@ limitations under the License.
 """
 from resource_management.libraries.script.script import Script
 from resource_management.libraries import functions
+from resource_management.libraries.functions import stack_select
 from resource_management.libraries.functions import format
 from resource_management.libraries.functions.default import default
-from ambari_commons import OSCheck
 
 config = Script.get_config()
 tmp_dir = Script.get_tmp_dir()
 
-if OSCheck.is_windows_family():
-  resourcemanager_win_service_name = 'resourcemanager'
-  nodemanager_win_service_name = 'nodemanager'
-  historyserver_win_service_name = 'historyserver'
-  timelineserver_win_service_name = 'timelineserver'
-
-  service_map = {
-    'resourcemanager' : resourcemanager_win_service_name,
-    'nodemanager' : nodemanager_win_service_name,
-    'historyserver' : historyserver_win_service_name,
-    'timelineserver' : timelineserver_win_service_name
-  }
-else:
-  mapred_user = config['configurations']['mapred-env']['mapred_user']
-  yarn_user = config['configurations']['yarn-env']['yarn_user']
-  yarn_pid_dir_prefix = config['configurations']['yarn-env']['yarn_pid_dir_prefix']
-  mapred_pid_dir_prefix = config['configurations']['mapred-env']['mapred_pid_dir_prefix']
-  yarn_pid_dir = format("{yarn_pid_dir_prefix}/{yarn_user}")
-  mapred_pid_dir = format("{mapred_pid_dir_prefix}/{mapred_user}")
-
-  resourcemanager_pid_file = format("{yarn_pid_dir}/yarn-{yarn_user}-resourcemanager.pid")
-  nodemanager_pid_file = format("{yarn_pid_dir}/yarn-{yarn_user}-nodemanager.pid")
-  yarn_historyserver_pid_file_old = format("{yarn_pid_dir}/yarn-{yarn_user}-historyserver.pid")
-  yarn_historyserver_pid_file = format("{yarn_pid_dir}/yarn-{yarn_user}-timelineserver.pid")  # *-historyserver.pid is deprecated
-  mapred_historyserver_pid_file = format("{mapred_pid_dir}/mapred-{mapred_user}-historyserver.pid")
-
-  hadoop_conf_dir = functions.conf_select.get_hadoop_conf_dir()
-
-  hostname = config['hostname']
-  kinit_path_local = functions.get_kinit_path(default('/configurations/kerberos-env/executable_search_paths', None))
-  security_enabled = config['configurations']['cluster-env']['security_enabled']
+mapred_user = config['configurations']['mapred-env']['mapred_user']
+yarn_user = config['configurations']['yarn-env']['yarn_user']
+yarn_pid_dir_prefix = config['configurations']['yarn-env']['yarn_pid_dir_prefix']
+mapred_pid_dir_prefix = config['configurations']['mapred-env']['mapred_pid_dir_prefix']
+yarn_pid_dir = format("{yarn_pid_dir_prefix}/{yarn_user}")
+mapred_pid_dir = format("{mapred_pid_dir_prefix}/{mapred_user}")
+
+resourcemanager_pid_file = format("{yarn_pid_dir}/yarn-{yarn_user}-resourcemanager.pid")
+nodemanager_pid_file = format("{yarn_pid_dir}/yarn-{yarn_user}-nodemanager.pid")
+yarn_historyserver_pid_file_old = format("{yarn_pid_dir}/yarn-{yarn_user}-historyserver.pid")
+yarn_historyserver_pid_file = format("{yarn_pid_dir}/yarn-{yarn_user}-timelineserver.pid")  # *-historyserver.pid is deprecated
+mapred_historyserver_pid_file = format("{mapred_pid_dir}/mapred-{mapred_user}-historyserver.pid")
+
+hadoop_home = stack_select.get_hadoop_dir("home")
+hadoop_conf_dir = functions.conf_select.get_hadoop_conf_dir()
+
+hostname = config['hostname']
+kinit_path_local = functions.get_kinit_path(default('/configurations/kerberos-env/executable_search_paths', None))
+security_enabled = config['configurations']['cluster-env']['security_enabled']
 
 stack_name = default("/hostLevelParams/stack_name", None)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/4a223503/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/configuration/yarn-site.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/configuration/yarn-site.xml b/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/configuration/yarn-site.xml
index 2a69d35..6f571e4 100644
--- a/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/configuration/yarn-site.xml
+++ b/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/configuration/yarn-site.xml
@@ -151,7 +151,7 @@
   </property>
   <property>
     <name>yarn.application.classpath</name>
-    <value>$HADOOP_CONF_DIR,{{stack_root}}/current/hadoop-client/*,{{stack_root}}/current/hadoop-client/lib/*,{{stack_root}}/current/hadoop-hdfs-client/*,{{stack_root}}/current/hadoop-hdfs-client/lib/*,{{stack_root}}/current/hadoop-yarn-client/*,{{stack_root}}/current/hadoop-yarn-client/lib/*</value>
+    <value>$HADOOP_CONF_DIR,{{hadoop_home}}/*,{{hadoop_home}}/lib/*,{{stack_root}}/current/hadoop-hdfs-client/*,{{stack_root}}/current/hadoop-hdfs-client/lib/*,{{stack_root}}/current/hadoop-yarn-client/*,{{stack_root}}/current/hadoop-yarn-client/lib/*</value>
     <description>Classpath for typical applications.</description>
     <on-ambari-upgrade add="false"/>
   </property>

http://git-wip-us.apache.org/repos/asf/ambari/blob/4a223503/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/params_linux.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/params_linux.py b/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/params_linux.py
index e66ec3c..e4dbe2c 100644
--- a/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/params_linux.py
+++ b/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/params_linux.py
@@ -20,8 +20,10 @@ Ambari Agent
 """
 import os
 
+from resource_management.core import sudo
 from resource_management.libraries.script.script import Script
 from resource_management.libraries.resources.hdfs_resource import HdfsResource
+from resource_management.libraries.functions import component_version
 from resource_management.libraries.functions import conf_select
 from resource_management.libraries.functions import stack_select
 from resource_management.libraries.functions import format
@@ -30,12 +32,13 @@ from resource_management.libraries.functions.stack_features import check_stack_f
 from resource_management.libraries.functions.stack_features import get_stack_feature_version
 from resource_management.libraries.functions import get_kinit_path
 from resource_management.libraries.functions.get_not_managed_resources import get_not_managed_resources
-from resource_management.libraries.functions.version import format_stack_version
+from resource_management.libraries.functions.version import format_stack_version, get_major_version
 from resource_management.libraries.functions.default import default
 from resource_management.libraries import functions
 from resource_management.libraries.functions import is_empty
 from resource_management.libraries.functions.get_architecture import get_architecture
 from resource_management.libraries.functions.setup_ranger_plugin_xml import get_audit_configs, generate_ranger_service_config
+
 import status_params
 
 # a map of the Ambari role to the component name
@@ -65,30 +68,33 @@ tarball_map = default("/configurations/cluster-env/tarball_map", None)
 config_path = os.path.join(stack_root, "current/hadoop-client/conf")
 config_dir = os.path.realpath(config_path)
 
+# get the correct version to use for checking stack features
+version_for_stack_feature_checks = get_stack_feature_version(config)
+
 # This is expected to be of the form #.#.#.#
 stack_version_unformatted = config['hostLevelParams']['stack_version']
 stack_version_formatted_major = format_stack_version(stack_version_unformatted)
 stack_version_formatted = functions.get_stack_version('hadoop-yarn-resourcemanager')
+major_stack_version = get_major_version(stack_version_formatted_major)
 
-stack_supports_ru = stack_version_formatted_major and check_stack_feature(StackFeature.ROLLING_UPGRADE, stack_version_formatted_major)
-stack_supports_timeline_state_store = stack_version_formatted_major and check_stack_feature(StackFeature.TIMELINE_STATE_STORE, stack_version_formatted_major)
+stack_supports_ru = check_stack_feature(StackFeature.ROLLING_UPGRADE, version_for_stack_feature_checks)
+stack_supports_timeline_state_store = check_stack_feature(StackFeature.TIMELINE_STATE_STORE, version_for_stack_feature_checks)
 
 # New Cluster Stack Version that is defined during the RESTART of a Stack Upgrade.
 # It cannot be used during the initial Cluser Install because the version is not yet known.
 version = default("/commandParams/version", None)
 
-# get the correct version to use for checking stack features
-version_for_stack_feature_checks = get_stack_feature_version(config)
-
 stack_supports_ranger_kerberos = check_stack_feature(StackFeature.RANGER_KERBEROS_SUPPORT, version_for_stack_feature_checks)
 stack_supports_ranger_audit_db = check_stack_feature(StackFeature.RANGER_AUDIT_DB_SUPPORT, version_for_stack_feature_checks)
 
 hostname = config['hostname']
 
 # hadoop default parameters
+hadoop_home = status_params.hadoop_home
 hadoop_libexec_dir = stack_select.get_hadoop_dir("libexec")
 hadoop_bin = stack_select.get_hadoop_dir("sbin")
 hadoop_bin_dir = stack_select.get_hadoop_dir("bin")
+hadoop_lib_home = stack_select.get_hadoop_dir("lib")
 hadoop_conf_dir = conf_select.get_hadoop_conf_dir()
 hadoop_yarn_home = '/usr/lib/hadoop-yarn'
 hadoop_mapred2_jar_location = "/usr/lib/hadoop-mapreduce"
@@ -110,12 +116,33 @@ if stack_supports_ru:
   if command_role in YARN_SERVER_ROLE_DIRECTORY_MAP:
     yarn_role_root = YARN_SERVER_ROLE_DIRECTORY_MAP[command_role]
 
-  hadoop_mapred2_jar_location = format("{stack_root}/current/{mapred_role_root}")
-  mapred_bin = format("{stack_root}/current/{mapred_role_root}/sbin")
-
+  # defaults set to current based on role
+  hadoop_mapr_home = format("{stack_root}/current/{mapred_role_root}")
   hadoop_yarn_home = format("{stack_root}/current/{yarn_role_root}")
-  yarn_bin = format("{stack_root}/current/{yarn_role_root}/sbin")
-  yarn_container_bin = format("{stack_root}/current/{yarn_role_root}/bin")
+
+  # try to render the specific version
+  version = component_version.get_component_repository_version()
+  if version is None:
+    version = default("/commandParams/version", None)
+
+
+  if version is not None:
+    hadoop_mapr_versioned_home = format("{stack_root}/{version}/hadoop-mapreduce")
+    hadoop_yarn_versioned_home = format("{stack_root}/{version}/hadoop-yarn")
+
+    if sudo.path_isdir(hadoop_mapr_versioned_home):
+      hadoop_mapr_home = hadoop_mapr_versioned_home
+
+    if sudo.path_isdir(hadoop_yarn_versioned_home):
+      hadoop_yarn_home = hadoop_yarn_versioned_home
+
+
+  hadoop_mapred2_jar_location = hadoop_mapr_home
+  mapred_bin = format("{hadoop_mapr_home}/sbin")
+
+  yarn_bin = format("{hadoop_yarn_home}/sbin")
+  yarn_container_bin = format("{hadoop_yarn_home}/bin")
+
 
 if stack_supports_timeline_state_store:
   # Timeline Service property that was added timeline_state_store stack feature
@@ -347,7 +374,7 @@ HdfsResource = functools.partial(
   immutable_paths = get_not_managed_resources(),
   dfs_type = dfs_type
  )
-update_files_only = default("/commandParams/update_files_only", False)
+update_files_only = default("/commandParams/update_files_only",False)
 
 mapred_tt_group = default("/configurations/mapred-site/mapreduce.tasktracker.group", user_group)
 
@@ -365,7 +392,7 @@ cgroups_dir = "/cgroups_test/cpu"
 
 # hostname of the active HDFS HA Namenode (only used when HA is enabled)
 dfs_ha_namenode_active = default("/configurations/hadoop-env/dfs_ha_initial_namenode_active", None)
-if dfs_ha_namenode_active is not None: 
+if dfs_ha_namenode_active is not None:
   namenode_hostname = dfs_ha_namenode_active
 else:
   namenode_hostname = config['clusterHostInfo']['namenode_host'][0]

http://git-wip-us.apache.org/repos/asf/ambari/blob/4a223503/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/status_params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/status_params.py b/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/status_params.py
index 7c1b2c7..6bb528f 100644
--- a/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/status_params.py
+++ b/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/status_params.py
@@ -19,43 +19,31 @@ limitations under the License.
 """
 from resource_management.libraries.script.script import Script
 from resource_management.libraries import functions
+from resource_management.libraries.functions import stack_select
 from resource_management.libraries.functions import format
 from resource_management.libraries.functions.default import default
-from ambari_commons import OSCheck
 
 config = Script.get_config()
 tmp_dir = Script.get_tmp_dir()
 
-if OSCheck.is_windows_family():
-  resourcemanager_win_service_name = 'resourcemanager'
-  nodemanager_win_service_name = 'nodemanager'
-  historyserver_win_service_name = 'historyserver'
-  timelineserver_win_service_name = 'timelineserver'
-
-  service_map = {
-    'resourcemanager' : resourcemanager_win_service_name,
-    'nodemanager' : nodemanager_win_service_name,
-    'historyserver' : historyserver_win_service_name,
-    'timelineserver' : timelineserver_win_service_name
-  }
-else:
-  mapred_user = config['configurations']['mapred-env']['mapred_user']
-  yarn_user = config['configurations']['yarn-env']['yarn_user']
-  yarn_pid_dir_prefix = config['configurations']['yarn-env']['yarn_pid_dir_prefix']
-  mapred_pid_dir_prefix = config['configurations']['mapred-env']['mapred_pid_dir_prefix']
-  yarn_pid_dir = format("{yarn_pid_dir_prefix}/{yarn_user}")
-  mapred_pid_dir = format("{mapred_pid_dir_prefix}/{mapred_user}")
-
-  resourcemanager_pid_file = format("{yarn_pid_dir}/hadoop-{yarn_user}-resourcemanager.pid")
-  nodemanager_pid_file = format("{yarn_pid_dir}/hadoop-{yarn_user}-nodemanager.pid")
-  yarn_historyserver_pid_file_old = format("{yarn_pid_dir}/hadoop-{yarn_user}-historyserver.pid")
-  yarn_historyserver_pid_file = format("{yarn_pid_dir}/hadoop-{yarn_user}-timelineserver.pid")  # *-historyserver.pid is deprecated
-  mapred_historyserver_pid_file = format("{mapred_pid_dir}/hadoop-{mapred_user}-historyserver.pid")
-
-  hadoop_conf_dir = functions.conf_select.get_hadoop_conf_dir()
-
-  hostname = config['hostname']
-  kinit_path_local = functions.get_kinit_path(default('/configurations/kerberos-env/executable_search_paths', None))
-  security_enabled = config['configurations']['cluster-env']['security_enabled']
+mapred_user = config['configurations']['mapred-env']['mapred_user']
+yarn_user = config['configurations']['yarn-env']['yarn_user']
+yarn_pid_dir_prefix = config['configurations']['yarn-env']['yarn_pid_dir_prefix']
+mapred_pid_dir_prefix = config['configurations']['mapred-env']['mapred_pid_dir_prefix']
+yarn_pid_dir = format("{yarn_pid_dir_prefix}/{yarn_user}")
+mapred_pid_dir = format("{mapred_pid_dir_prefix}/{mapred_user}")
+
+resourcemanager_pid_file = format("{yarn_pid_dir}/yarn-{yarn_user}-resourcemanager.pid")
+nodemanager_pid_file = format("{yarn_pid_dir}/yarn-{yarn_user}-nodemanager.pid")
+yarn_historyserver_pid_file_old = format("{yarn_pid_dir}/yarn-{yarn_user}-historyserver.pid")
+yarn_historyserver_pid_file = format("{yarn_pid_dir}/yarn-{yarn_user}-timelineserver.pid")  # *-historyserver.pid is deprecated
+mapred_historyserver_pid_file = format("{mapred_pid_dir}/mapred-{mapred_user}-historyserver.pid")
+
+hadoop_home = stack_select.get_hadoop_dir("home")
+hadoop_conf_dir = functions.conf_select.get_hadoop_conf_dir()
+
+hostname = config['hostname']
+kinit_path_local = functions.get_kinit_path(default('/configurations/kerberos-env/executable_search_paths', None))
+security_enabled = config['configurations']['cluster-env']['security_enabled']
 
 stack_name = default("/hostLevelParams/stack_name", None)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/4a223503/ambari-server/src/main/resources/stacks/HDP/2.6/services/YARN/configuration/yarn-site.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/services/YARN/configuration/yarn-site.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/services/YARN/configuration/yarn-site.xml
index b5eedea..71c63c1 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.6/services/YARN/configuration/yarn-site.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/services/YARN/configuration/yarn-site.xml
@@ -19,7 +19,7 @@
 <configuration supports_final="true">
   <property>
     <name>yarn.application.classpath</name>
-    <value>/etc/hadoop/conf,/usr/hdp/current/hadoop-client/*,/usr/hdp/current/hadoop-client/lib/*,/usr/hdp/current/hadoop-hdfs-client/*,/usr/hdp/current/hadoop-hdfs-client/lib/*,/usr/hdp/current/hadoop-yarn-client/*,/usr/hdp/current/hadoop-yarn-client/lib/*,/usr/hdp/current/ext/hadoop/*</value>
+    <value>{{hadoop_home}}/conf,{{hadoop_home}}/*,{{hadoop_home}}/lib/*,/usr/hdp/current/hadoop-hdfs-client/*,/usr/hdp/current/hadoop-hdfs-client/lib/*,/usr/hdp/current/hadoop-yarn-client/*,/usr/hdp/current/hadoop-yarn-client/lib/*,/usr/hdp/current/ext/hadoop/*</value>
     <description>Classpath for typical applications.</description>
     <on-ambari-upgrade add="true"/>
   </property>

http://git-wip-us.apache.org/repos/asf/ambari/blob/4a223503/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/config-upgrade.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/config-upgrade.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/config-upgrade.xml
index fd7e438..91044d8 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/config-upgrade.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/config-upgrade.xml
@@ -155,6 +155,13 @@
               if-key="yarn.resourcemanager.monitor.capacity.preemption.natural_termination_factor"
               if-key-state="absent" />
           </definition>
+
+
+          <definition xsi:type="configure" id="hdp_2_6_yarn_app_classpath_parameterization" summary="Application Classpath Parameterization">
+            <type>yarn-site</type>
+            <replace key="yarn.application.classpath" find="/usr/hdp/current/hadoop-client" replace-with="{{hadoop_home}}"/>
+          </definition>
+
         </changes>
       </component>
       <component name="NODEMANAGER">

http://git-wip-us.apache.org/repos/asf/ambari/blob/4a223503/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/nonrolling-upgrade-2.6.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/nonrolling-upgrade-2.6.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/nonrolling-upgrade-2.6.xml
index 832c505..0b5e8c1 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/nonrolling-upgrade-2.6.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/nonrolling-upgrade-2.6.xml
@@ -279,8 +279,7 @@
     <!-- After processing this group, will change the effective Stack of the UpgradeContext object. -->
     <group xsi:type="update-stack" name="UPDATE_DESIRED_REPOSITORY_ID" title="Update Target Repositories">
       <execute-stage title="Update Target Repositories">
-        <task xsi:type="server_action" class="org.apache.ambari.server.serveraction.upgrades.UpdateDesiredRepositoryAction">
-        </task>
+        <task xsi:type="server_action" class="org.apache.ambari.server.serveraction.upgrades.UpdateDesiredRepositoryAction"/>
       </execute-stage>
     </group>
 
@@ -343,6 +342,10 @@
         <task xsi:type="configure" id="hdp_2_6_yarn_preemption"/>
       </execute-stage>
 
+      <execute-stage service="YARN" component="RESOURCEMANAGER" title="Application Classpath Parameterization">
+        <task xsi:type="configure" id="hdp_2_6_yarn_app_classpath_parameterization" supports-patch="true"/>
+      </execute-stage>
+
       <!-- YARN -->
       <execute-stage service="YARN" component="NODEMANAGER" title="Apply config changes for YARN NM">
         <task xsi:type="configure" id="hdp_2_6_0_0_yarn_nodemanager_llap_mem">

http://git-wip-us.apache.org/repos/asf/ambari/blob/4a223503/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/upgrade-2.6.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/upgrade-2.6.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/upgrade-2.6.xml
index d0e11a1..00597c6 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/upgrade-2.6.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/upgrade-2.6.xml
@@ -696,6 +696,7 @@
         <pre-upgrade>
           <task xsi:type="configure" id="hdp_2_6_maint_ranger_yarn_plugin_cluster_name"/>
           <task xsi:type="configure" id="hdp_2_6_yarn_preemption" />
+          <task xsi:type="configure" id="hdp_2_6_yarn_app_classpath_parameterization" supports-patch="true"/>
         </pre-upgrade>
         <pre-downgrade/> <!--  no-op to prevent config changes on downgrade -->
         <upgrade>


[46/50] ambari git commit: AMBARI-22246 Restart HDFS/JOURNALNODE failed on revert patch upgrade(dgrinenko)

Posted by am...@apache.org.
AMBARI-22246 Restart HDFS/JOURNALNODE failed on revert patch upgrade(dgrinenko)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/ce29f8ce
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/ce29f8ce
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/ce29f8ce

Branch: refs/heads/branch-feature-AMBARI-22008
Commit: ce29f8ce7762ed6c6d5c2f50d882b6e03b23acfc
Parents: d6cd303
Author: Dmytro Grinenko <ha...@apache.org>
Authored: Tue Oct 17 16:53:47 2017 +0300
Committer: Dmytro Grinenko <ha...@apache.org>
Committed: Tue Oct 17 16:53:47 2017 +0300

----------------------------------------------------------------------
 .../ambari/server/state/UpgradeContext.java     | 55 ++++++++++++++------
 .../ambari/server/state/UpgradeContextTest.java | 38 +++++++++++++-
 2 files changed, 75 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/ce29f8ce/ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeContext.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeContext.java b/ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeContext.java
index de0f868..cb44adb 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeContext.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeContext.java
@@ -261,6 +261,38 @@ public class UpgradeContext {
    */
   private RepositoryType m_orchestration = RepositoryType.STANDARD;
 
+  /**
+   * Reading upgrade type from provided request  or if nothing were provided,
+   * from previous upgrade for downgrade direction.
+   *
+   * @param upgradeRequestMap arguments provided for current upgrade request
+   * @param upgradeEntity previous upgrade entity, should be passed only for downgrade direction
+   *
+   * @return
+   * @throws AmbariException
+   */
+  private UpgradeType calculateUpgradeType(Map<String, Object> upgradeRequestMap,
+                                           UpgradeEntity upgradeEntity) throws AmbariException{
+
+    UpgradeType upgradeType = UpgradeType.ROLLING;
+
+    String upgradeTypeProperty = (String) upgradeRequestMap.get(UPGRADE_TYPE);
+    boolean upgradeTypePassed = StringUtils.isNotBlank(upgradeTypeProperty);
+
+    if (upgradeTypePassed){
+      try {
+        upgradeType = UpgradeType.valueOf(upgradeRequestMap.get(UPGRADE_TYPE).toString());
+      } catch (Exception e) {
+        throw new AmbariException(String.format("Property %s has an incorrect value of %s.",
+          UPGRADE_TYPE, upgradeTypeProperty));
+      }
+    } else if (upgradeEntity != null){
+      upgradeType = upgradeEntity.getUpgradeType();
+    }
+
+    return upgradeType;
+  }
+
   @AssistedInject
   public UpgradeContext(@Assisted Cluster cluster,
       @Assisted Map<String, Object> upgradeRequestMap, Gson gson, UpgradeHelper upgradeHelper,
@@ -271,23 +303,7 @@ public class UpgradeContext {
     m_upgradeHelper = upgradeHelper;
     m_upgradeDAO = upgradeDAO;
     m_repoVersionDAO = repoVersionDAO;
-
     m_cluster = cluster;
-
-    // determine upgrade type (default is ROLLING)
-    String upgradeTypeProperty = (String) upgradeRequestMap.get(UPGRADE_TYPE);
-    if (StringUtils.isNotBlank(upgradeTypeProperty)) {
-      try {
-        m_type = UpgradeType.valueOf(upgradeRequestMap.get(UPGRADE_TYPE).toString());
-      } catch (Exception e) {
-        throw new AmbariException(String.format("Property %s has an incorrect value of %s.",
-            UPGRADE_TYPE, upgradeTypeProperty));
-      }
-    } else {
-      // default type
-      m_type= UpgradeType.ROLLING;
-    }
-
     m_isRevert = upgradeRequestMap.containsKey(UPGRADE_REVERT_UPGRADE_ID);
 
     if (m_isRevert) {
@@ -316,13 +332,15 @@ public class UpgradeContext {
             "Only successfully completed upgrades can be reverted. Downgrades cannot be reverted.");
       }
 
-      if (revertableUpgrade.getId() != revertUpgrade.getId()) {
+      if (!revertableUpgrade.getId().equals(revertUpgrade.getId())) {
         throw new AmbariException(String.format(
             "The only upgrade which is currently allowed to be reverted for cluster %s is upgrade ID %s which was an upgrade to %s",
             cluster.getClusterName(), revertableUpgrade.getId(),
             revertableUpgrade.getRepositoryVersion().getVersion()));
       }
 
+      m_type = calculateUpgradeType(upgradeRequestMap, revertUpgrade);
+
       // !!! build all service-specific reversions
       Set<RepositoryVersionEntity> priors = new HashSet<>();
       Map<String, Service> clusterServices = cluster.getServices();
@@ -382,6 +400,8 @@ public class UpgradeContext {
                     UPGRADE_REPO_VERSION_ID, m_direction));
           }
 
+          m_type = calculateUpgradeType(upgradeRequestMap, null);
+
           // depending on the repository, add services
           m_repositoryVersion = m_repoVersionDAO.findByPK(Long.valueOf(repositoryVersionId));
           m_orchestration = m_repositoryVersion.getType();
@@ -396,6 +416,7 @@ public class UpgradeContext {
 
           m_repositoryVersion = upgrade.getRepositoryVersion();
           m_orchestration = upgrade.getOrchestration();
+          m_type = calculateUpgradeType(upgradeRequestMap, upgrade);
 
           // populate the repository maps for all services in the upgrade
           for (UpgradeHistoryEntity history : upgrade.getHistory()) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/ce29f8ce/ambari-server/src/test/java/org/apache/ambari/server/state/UpgradeContextTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/UpgradeContextTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/UpgradeContextTest.java
index 5176ffe..b38b272 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/state/UpgradeContextTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/state/UpgradeContextTest.java
@@ -317,7 +317,6 @@ public class UpgradeContextTest extends EasyMockSupport {
         EasyMock.anyObject(StackId.class), EasyMock.anyObject(Direction.class),
         EasyMock.anyObject(UpgradeType.class), EasyMock.anyString())).andReturn(upgradePack).once();
 
-
     expect(m_upgradeDAO.findRevertable(1L)).andReturn(m_completedRevertableUpgrade).once();
 
     Map<String, Object> requestMap = new HashMap<>();
@@ -337,6 +336,43 @@ public class UpgradeContextTest extends EasyMockSupport {
     verifyAll();
   }
 
+
+  /**
+   * Tests that the {@link UpgradeContext} for a EU reversion has the correct
+   * parameters set.
+   *
+   * @throws Exception
+   */
+  @Test
+  public void testRevertEU() throws Exception {
+    ConfigHelper configHelper = createNiceMock(ConfigHelper.class);
+    UpgradeHelper upgradeHelper = createNiceMock(UpgradeHelper.class);
+    UpgradePack upgradePack = createNiceMock(UpgradePack.class);
+
+    expect(upgradeHelper.suggestUpgradePack(EasyMock.anyString(), EasyMock.anyObject(StackId.class),
+      EasyMock.anyObject(StackId.class), EasyMock.anyObject(Direction.class),
+      EasyMock.anyObject(UpgradeType.class), EasyMock.anyString())).andReturn(upgradePack).once();
+
+    expect(m_upgradeDAO.findRevertable(1L)).andReturn(m_completedRevertableUpgrade).once();
+    expect(m_completedRevertableUpgrade.getUpgradeType()).andReturn(UpgradeType.NON_ROLLING);
+
+    Map<String, Object> requestMap = new HashMap<>();
+    requestMap.put(UpgradeResourceProvider.UPGRADE_REVERT_UPGRADE_ID, "1");
+
+    replayAll();
+
+    UpgradeContext context = new UpgradeContext(m_cluster, requestMap, null, upgradeHelper,
+      m_upgradeDAO, m_repositoryVersionDAO, configHelper);
+
+    assertEquals(Direction.DOWNGRADE, context.getDirection());
+    assertEquals(RepositoryType.PATCH, context.getOrchestrationType());
+    assertEquals(UpgradeType.NON_ROLLING, context.getType());
+    assertEquals(1, context.getSupportedServices().size());
+    assertTrue(context.isPatchRevert());
+
+    verifyAll();
+  }
+
   /**
    * Tests that the {@link UpgradeContext} for a reversion has the correct
    * services included in the reversion if one of the services in the original


[33/50] ambari git commit: AMBARI-22238 : Maven cleanup of ambari utility, logsearch and ambari metrics modules. (avijayan)

Posted by am...@apache.org.
AMBARI-22238 : Maven cleanup of ambari utility, logsearch and ambari metrics modules. (avijayan)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/499fec3c
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/499fec3c
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/499fec3c

Branch: refs/heads/branch-feature-AMBARI-22008
Commit: 499fec3c1ec7ddd18fae3a415da7e4d5de82d63b
Parents: 43fb597
Author: Aravindan Vijayan <av...@hortonworks.com>
Authored: Sun Oct 15 09:41:13 2017 -0700
Committer: Aravindan Vijayan <av...@hortonworks.com>
Committed: Sun Oct 15 09:41:13 2017 -0700

----------------------------------------------------------------------
 ambari-infra/ambari-infra-assembly/pom.xml            |  4 ++++
 ambari-logsearch/ambari-logsearch-assembly/pom.xml    |  4 +++-
 ambari-logsearch/ambari-logsearch-logfeeder/pom.xml   |  4 ++++
 ambari-logsearch/ambari-logsearch-server/pom.xml      |  4 ++++
 ambari-metrics/ambari-metrics-assembly/pom.xml        |  2 ++
 ambari-metrics/ambari-metrics-common/pom.xml          |  6 ++++++
 ambari-metrics/ambari-metrics-timelineservice/pom.xml | 10 ++++++++++
 ambari-utility/pom.xml                                |  6 ++++++
 8 files changed, 39 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/499fec3c/ambari-infra/ambari-infra-assembly/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-assembly/pom.xml b/ambari-infra/ambari-infra-assembly/pom.xml
index dfb5c01..2b4959b 100644
--- a/ambari-infra/ambari-infra-assembly/pom.xml
+++ b/ambari-infra/ambari-infra-assembly/pom.xml
@@ -120,6 +120,9 @@
                       <sources>
                         <source>
                           <location>${solr.client.dir}/target/package</location>
+                          <exclude>
+                            <exclude>libs/checkstyle*.jar</exclude>
+                          </exclude>
                         </source>
                       </sources>
                     </mapping>
@@ -324,6 +327,7 @@
                         <group>root</group>
                         <prefix>${solr.client.mapping.path}</prefix>
                       </mapper>
+                      <excludes>libs/checkstyle*.jar</excludes>
                     </data>
                   </dataSet>
                 </configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/499fec3c/ambari-logsearch/ambari-logsearch-assembly/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-assembly/pom.xml b/ambari-logsearch/ambari-logsearch-assembly/pom.xml
index e8a9426..cbc62ce 100644
--- a/ambari-logsearch/ambari-logsearch-assembly/pom.xml
+++ b/ambari-logsearch/ambari-logsearch-assembly/pom.xml
@@ -94,6 +94,7 @@
                             <exclude>classes/user_pass.json</exclude>
                             <exclude>classes/HadoopServiceConfig.json</exclude>
                             <exclude>solr_configsets/**</exclude>
+                            <exclude>libs/checkstyle*.jar</exclude>
                           </excludes>
                         </source>
                       </sources>
@@ -241,7 +242,7 @@
                         <group>root</group>
                       </mapper>
                       <excludes>
-                        classes/log4j.xml,classes/logsearch.properties,classes/user_pass.json,classes/HadoopServiceConfig.json,solr_configsets/**
+                        classes/log4j.xml,classes/logsearch.properties,classes/user_pass.json,classes/HadoopServiceConfig.json,solr_configsets/**,libs/checkstyle*.jar
                       </excludes>
                     </data>
                     <data>
@@ -267,6 +268,7 @@
                         <user>root</user>
                         <group>root</group>
                       </mapper>
+                      <excludes>libs/checkstyle*.jar</excludes>
                     </data>
                   </dataSet>
                 </configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/499fec3c/ambari-logsearch/ambari-logsearch-logfeeder/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/pom.xml b/ambari-logsearch/ambari-logsearch-logfeeder/pom.xml
index 091f957..b1b6ece 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/pom.xml
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/pom.xml
@@ -163,6 +163,10 @@
           <groupId>org.apache.curator</groupId>
           <artifactId>curator-recipes</artifactId>
         </exclusion>
+        <exclusion>
+          <groupId>jdk.tools</groupId>
+          <artifactId>jdk.tools</artifactId>
+        </exclusion>
       </exclusions>
     </dependency>
     <dependency>

http://git-wip-us.apache.org/repos/asf/ambari/blob/499fec3c/ambari-logsearch/ambari-logsearch-server/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-server/pom.xml b/ambari-logsearch/ambari-logsearch-server/pom.xml
index e90c58d..2ad35f5 100755
--- a/ambari-logsearch/ambari-logsearch-server/pom.xml
+++ b/ambari-logsearch/ambari-logsearch-server/pom.xml
@@ -380,6 +380,10 @@
           <artifactId>guava</artifactId>
           <groupId>com.google.guava</groupId>
         </exclusion>
+        <exclusion>
+          <groupId>jdk.tools</groupId>
+          <artifactId>jdk.tools</artifactId>
+        </exclusion>
       </exclusions>
     </dependency>
     <dependency>

http://git-wip-us.apache.org/repos/asf/ambari/blob/499fec3c/ambari-metrics/ambari-metrics-assembly/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-assembly/pom.xml b/ambari-metrics/ambari-metrics-assembly/pom.xml
index d9875ce..9925947 100644
--- a/ambari-metrics/ambari-metrics-assembly/pom.xml
+++ b/ambari-metrics/ambari-metrics-assembly/pom.xml
@@ -245,6 +245,7 @@
                           <excludes>
                             <exclude>*tests.jar</exclude>
                             <exclude>findbugs*.jar</exclude>
+                            <exclude>jdk.tools*.jar</exclude>
                           </excludes>
                         </source>
                         <source>
@@ -265,6 +266,7 @@
                             <exclude>bin/*</exclude>
                             <exclude>lib/*tests.jar</exclude>
                             <exclude>lib/findbugs*.jar</exclude>
+                            <exclude>lib/jdk.tools*.jar</exclude>
                           </excludes>
                         </source>
                       </sources>

http://git-wip-us.apache.org/repos/asf/ambari/blob/499fec3c/ambari-metrics/ambari-metrics-common/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-common/pom.xml b/ambari-metrics/ambari-metrics-common/pom.xml
index cae9734..aa16ba9 100644
--- a/ambari-metrics/ambari-metrics-common/pom.xml
+++ b/ambari-metrics/ambari-metrics-common/pom.xml
@@ -155,6 +155,12 @@
       <groupId>org.apache.hadoop</groupId>
       <artifactId>hadoop-annotations</artifactId>
       <version>2.6.0</version>
+      <exclusions>
+        <exclusion>
+          <groupId>jdk.tools</groupId>
+          <artifactId>jdk.tools</artifactId>
+        </exclusion>
+      </exclusions>
     </dependency>
     <dependency>
       <groupId>org.codehaus.jackson</groupId>

http://git-wip-us.apache.org/repos/asf/ambari/blob/499fec3c/ambari-metrics/ambari-metrics-timelineservice/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-timelineservice/pom.xml b/ambari-metrics/ambari-metrics-timelineservice/pom.xml
index a5eb572..ca72bc7 100644
--- a/ambari-metrics/ambari-metrics-timelineservice/pom.xml
+++ b/ambari-metrics/ambari-metrics-timelineservice/pom.xml
@@ -326,6 +326,10 @@
           <groupId>org.apache.hadoop</groupId>
           <artifactId>hadoop-annotations</artifactId>
         </exclusion>
+        <exclusion>
+          <groupId>net.sourceforge.findbugs</groupId>
+          <artifactId>annotations</artifactId>
+        </exclusion>
       </exclusions>
     </dependency>
 
@@ -377,6 +381,12 @@
       <groupId>org.apache.hadoop</groupId>
       <artifactId>hadoop-annotations</artifactId>
       <version>${hadoop.version}</version>
+      <exclusions>
+        <exclusion>
+          <groupId>jdk.tools</groupId>
+          <artifactId>jdk.tools</artifactId>
+        </exclusion>
+      </exclusions>
     </dependency>
     <dependency>
       <groupId>org.mockito</groupId>

http://git-wip-us.apache.org/repos/asf/ambari/blob/499fec3c/ambari-utility/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-utility/pom.xml b/ambari-utility/pom.xml
index 1e86d40..4a32872 100644
--- a/ambari-utility/pom.xml
+++ b/ambari-utility/pom.xml
@@ -55,6 +55,12 @@
     <dependency>
       <groupId>com.puppycrawl.tools</groupId>
       <artifactId>checkstyle</artifactId>
+      <exclusions>
+        <exclusion>
+          <groupId>com.sun</groupId>
+          <artifactId>tools</artifactId>
+        </exclusion>
+      </exclusions>
     </dependency>
     <dependency>
       <groupId>com.puppycrawl.tools</groupId>


[50/50] ambari git commit: Merge branch 'branch-feature-AMBARI-22008' of https://git-wip-us.apache.org/repos/asf/ambari into branch-feature-AMBARI-22008

Posted by am...@apache.org.
Merge branch 'branch-feature-AMBARI-22008' of https://git-wip-us.apache.org/repos/asf/ambari into branch-feature-AMBARI-22008


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/560b437b
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/560b437b
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/560b437b

Branch: refs/heads/branch-feature-AMBARI-22008
Commit: 560b437b2d8016b83ccb9e7ba439724c0825910b
Parents: 166e500 7649329
Author: Attila Magyar <am...@hortonworks.com>
Authored: Tue Oct 17 16:57:16 2017 +0200
Committer: Attila Magyar <am...@hortonworks.com>
Committed: Tue Oct 17 16:57:16 2017 +0200

----------------------------------------------------------------------

----------------------------------------------------------------------



[37/50] ambari git commit: AMBARI-22223.jdbc(spark[2]) URLs not configured correctly for secure clusters(Prabhjyot Singh via Venkata Sairam)

Posted by am...@apache.org.
AMBARI-22223.jdbc(spark[2]) URLs not configured correctly for secure clusters(Prabhjyot Singh via Venkata Sairam)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/2a8ac0de
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/2a8ac0de
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/2a8ac0de

Branch: refs/heads/branch-feature-AMBARI-22008
Commit: 2a8ac0ded9a9916dd71b84ac21a2a6165db60284
Parents: d4458da
Author: Venkata Sairam <ve...@gmail.com>
Authored: Mon Oct 16 18:15:58 2017 +0530
Committer: Venkata Sairam <ve...@gmail.com>
Committed: Mon Oct 16 18:15:58 2017 +0530

----------------------------------------------------------------------
 .../ZEPPELIN/0.7.0/package/scripts/master.py         | 12 ++++++++----
 .../ZEPPELIN/0.7.0/package/scripts/params.py         | 15 +++++++++------
 2 files changed, 17 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/2a8ac0de/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/master.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/master.py b/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/master.py
index 6a84d79..9d179b8 100644
--- a/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/master.py
+++ b/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/master.py
@@ -492,8 +492,10 @@ class Master(Script):
           interpreter['properties']['spark.proxy.user.property'] = 'hive.server2.proxy.user'
           interpreter['properties']['spark.url'] = 'jdbc:hive2://' + \
               params.spark_thrift_server_hosts + ':' + params.spark_hive_thrift_port + '/'
-          if params.spark_hive_principal:
-            interpreter['properties']['spark.url'] += ';principal=' + params.spark_hive_principal
+          if params.hive_principal:
+            interpreter['properties']['spark.url'] += ';principal=' + params.hive_principal
+          if params.hive_transport_mode:
+            interpreter['properties']['spark.url'] += ';transportMode=' + params.hive_transport_mode
           if 'spark.splitQueries' not in interpreter['properties']:
             interpreter['properties']['spark.splitQueries'] = "true"
 
@@ -504,8 +506,10 @@ class Master(Script):
           interpreter['properties']['spark2.proxy.user.property'] = 'hive.server2.proxy.user'
           interpreter['properties']['spark2.url'] = 'jdbc:hive2://' + \
               params.spark2_thrift_server_hosts + ':' + params.spark2_hive_thrift_port + '/'
-          if params.spark_hive_principal:
-            interpreter['properties']['spark2.url'] += ';principal=' + params.spark2_hive_principal
+          if params.hive_principal:
+            interpreter['properties']['spark2.url'] += ';principal=' + params.hive_principal
+          if params.hive_transport_mode:
+            interpreter['properties']['spark2.url'] += ';transportMode=' + params.hive_transport_mode
           if 'spark2.splitQueries' not in interpreter['properties']:
             interpreter['properties']['spark2.splitQueries'] = "true"
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/2a8ac0de/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/params.py b/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/params.py
index e69037c..2290a7f 100644
--- a/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/params.py
+++ b/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/params.py
@@ -162,13 +162,19 @@ if 'hive_server_interactive_hosts' in master_configs and len(master_configs['hiv
 spark_thrift_server_hosts = None
 spark_hive_thrift_port = None
 spark_hive_principal = None
+hive_principal = None
+hive_transport_mode = None
+
+if 'hive-site' in config['configurations']:
+  if 'hive.server2.authentication.kerberos.principal' in config['configurations']['hive-site']:
+    hive_principal = config['configurations']['hive-site']['hive.server2.authentication.kerberos.principal']
+  if 'hive.server2.transport.mode' in config['configurations']['hive-site']:
+    hive_transport_mode = config['configurations']['hive-site']['hive.server2.transport.mode']
+
 if 'spark_thriftserver_hosts' in master_configs and len(master_configs['spark_thriftserver_hosts']) != 0:
   spark_thrift_server_hosts = str(master_configs['spark_thriftserver_hosts'][0])
   if config['configurations']['spark-hive-site-override']:
     spark_hive_thrift_port = config['configurations']['spark-hive-site-override']['hive.server2.thrift.port']
-  if config['configurations']['spark-thrift-sparkconf'] and \
-      'spark.sql.hive.hiveserver2.jdbc.url.principal' in config['configurations']['spark-thrift-sparkconf']:
-    spark_hive_principal = config['configurations']['spark-thrift-sparkconf']['spark.sql.hive.hiveserver2.jdbc.url.principal']
 
 spark2_thrift_server_hosts = None
 spark2_hive_thrift_port = None
@@ -177,9 +183,6 @@ if 'spark2_thriftserver_hosts' in master_configs and len(master_configs['spark2_
   spark2_thrift_server_hosts = str(master_configs['spark2_thriftserver_hosts'][0])
   if config['configurations']['spark2-hive-site-override']:
     spark2_hive_thrift_port = config['configurations']['spark2-hive-site-override']['hive.server2.thrift.port']
-  if config['configurations']['spark2-thrift-sparkconf'] and \
-      'spark.sql.hive.hiveserver2.jdbc.url.principal' in config['configurations']['spark2-thrift-sparkconf']:
-    spark2_hive_principal = config['configurations']['spark2-thrift-sparkconf']['spark.sql.hive.hiveserver2.jdbc.url.principal']
 
 
 # detect hbase details if installed


[07/50] ambari git commit: AMBARI-22188. Make hive server create directories related to replication (echekanskiy)

Posted by am...@apache.org.
AMBARI-22188. Make hive server create directories related to replication (echekanskiy)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/4a47e792
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/4a47e792
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/4a47e792

Branch: refs/heads/branch-feature-AMBARI-22008
Commit: 4a47e792ae6e4fe4fb67ca80c96c5e2054f7a9cd
Parents: 7341567
Author: Eugene Chekanskiy <ec...@hortonworks.com>
Authored: Wed Oct 11 19:38:41 2017 +0300
Committer: Eugene Chekanskiy <ec...@hortonworks.com>
Committed: Wed Oct 11 19:38:41 2017 +0300

----------------------------------------------------------------------
 .../HIVE/0.12.0.2.0/configuration/hive-site.xml | 47 +++++++++++++++++++
 .../HIVE/0.12.0.2.0/package/scripts/hive.py     | 34 +++++++++++++-
 .../0.12.0.2.0/package/scripts/params_linux.py  |  4 ++
 .../HIVE/2.1.0.3.0/configuration/hive-site.xml  | 48 ++++++++++++++++++++
 .../HIVE/2.1.0.3.0/package/scripts/hive.py      | 32 +++++++++++++
 .../2.1.0.3.0/package/scripts/params_linux.py   |  4 ++
 6 files changed, 168 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/4a47e792/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/configuration/hive-site.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/configuration/hive-site.xml b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/configuration/hive-site.xml
index 69d1c69..762530b 100644
--- a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/configuration/hive-site.xml
+++ b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/configuration/hive-site.xml
@@ -471,4 +471,51 @@ limitations under the License.
     </depends-on>
     <on-ambari-upgrade add="false"/>
   </property>
+
+  <!-- Hive replication properties -->
+  <property>
+    <name>hive.metastore.dml.events</name>
+    <value/>
+    <description>If true, the metastore will be asked to fire events for DML operations</description>
+    <value-attributes>
+      <empty-value-valid>true</empty-value-valid>
+    </value-attributes>
+    <on-ambari-upgrade add="false"/>
+  </property>
+  <property>
+    <name>hive.repl.cm.enabled</name>
+    <value/>
+    <description>Turn on ChangeManager, so delete files will go to cmrootdir.</description>
+    <value-attributes>
+      <empty-value-valid>true</empty-value-valid>
+    </value-attributes>
+    <on-ambari-upgrade add="false"/>
+  </property>
+  <property>
+    <name>hive.metastore.transactional.event.listeners</name>
+    <value/>
+    <description>A comma separated list of Java classes that implement the org.apache.hadoop.hive.metastore.MetaStoreEventListener interface. Both the metastore event and corresponding listener method will be invoked in the same JDO transaction.</description>
+    <value-attributes>
+      <empty-value-valid>true</empty-value-valid>
+    </value-attributes>
+    <on-ambari-upgrade add="false"/>
+  </property>
+  <property>
+    <name>hive.repl.cmrootdir</name>
+    <value/>
+    <description>Root dir for ChangeManager, used for deleted files.</description>
+    <value-attributes>
+      <empty-value-valid>true</empty-value-valid>
+    </value-attributes>
+    <on-ambari-upgrade add="false"/>
+  </property>
+  <property>
+    <name>hive.repl.rootdir</name>
+    <value/>
+    <description>HDFS root dir for all replication dumps.</description>
+    <value-attributes>
+      <empty-value-valid>true</empty-value-valid>
+    </value-attributes>
+    <on-ambari-upgrade add="false"/>
+  </property>
 </configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/4a47e792/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive.py b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive.py
index 8e176b6..c4b34a5 100644
--- a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive.py
+++ b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive.py
@@ -245,7 +245,22 @@ def setup_hiveserver2():
                          owner=params.hive_user,
                          group=params.hdfs_user,
                          mode=0777) # Hive expects this dir to be writeable by everyone as it is used as a temp dir
-    
+
+  if params.hive_repl_cmrootdir is not None:
+    params.HdfsResource(params.hive_repl_cmrootdir,
+                        type = "directory",
+                        action = "create_on_execute",
+                        owner = params.hive_user,
+                        group=params.user_group,
+                        mode = 01777)
+  if params.hive_repl_rootdir is not None:
+    params.HdfsResource(params.hive_repl_rootdir,
+                        type = "directory",
+                        action = "create_on_execute",
+                        owner = params.hive_user,
+                        group=params.user_group,
+                        mode = 0700)
+
   params.HdfsResource(None, action="execute")
   
 def setup_non_client():
@@ -310,6 +325,23 @@ def setup_metastore():
                  create_parents = True,
                  mode=0777)
 
+  if params.hive_repl_cmrootdir is not None:
+    params.HdfsResource(params.hive_repl_cmrootdir,
+                        type = "directory",
+                        action = "create_on_execute",
+                        owner = params.hive_user,
+                        group=params.user_group,
+                        mode = 01777)
+  if params.hive_repl_rootdir is not None:
+    params.HdfsResource(params.hive_repl_rootdir,
+                        type = "directory",
+                        action = "create_on_execute",
+                        owner = params.hive_user,
+                        group=params.user_group,
+                        mode = 0700)
+  if params.hive_repl_cmrootdir is not None or params.hive_repl_rootdir is not None:
+    params.HdfsResource(None, action="execute")
+
 def create_metastore_schema():
   import params
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/4a47e792/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params_linux.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params_linux.py b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params_linux.py
index 1d68ef4..16e1a71 100644
--- a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params_linux.py
+++ b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params_linux.py
@@ -871,3 +871,7 @@ if 'druid-common' in config['configurations'] \
 
 
 manage_hive_fsroot = default('/configurations/cluster-env/manage_hive_fsroot', True)
+
+# replication directories
+hive_repl_cmrootdir = default('/configurations/hive-site/hive.repl.cmrootdir', None)
+hive_repl_rootdir = default('/configurations/hive-site/hive.repl.rootdir', None)

http://git-wip-us.apache.org/repos/asf/ambari/blob/4a47e792/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/configuration/hive-site.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/configuration/hive-site.xml b/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/configuration/hive-site.xml
index edbbc9d..3c153b6 100644
--- a/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/configuration/hive-site.xml
+++ b/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/configuration/hive-site.xml
@@ -2001,4 +2001,52 @@ limitations under the License.
     </description>
     <on-ambari-upgrade add="false"/>
   </property>
+
+  <!-- Hive replication properties -->
+  <property>
+    <name>hive.metastore.dml.events</name>
+    <value/>
+    <description>If true, the metastore will be asked to fire events for DML operations</description>
+    <value-attributes>
+      <empty-value-valid>true</empty-value-valid>
+    </value-attributes>
+    <on-ambari-upgrade add="false"/>
+  </property>
+  <property>
+    <name>hive.repl.cm.enabled</name>
+    <value/>
+    <description>Turn on ChangeManager, so delete files will go to cmrootdir.</description>
+    <value-attributes>
+      <empty-value-valid>true</empty-value-valid>
+    </value-attributes>
+    <on-ambari-upgrade add="false"/>
+  </property>
+  <property>
+    <name>hive.metastore.transactional.event.listeners</name>
+    <value/>
+    <description>A comma separated list of Java classes that implement the org.apache.hadoop.hive.metastore.MetaStoreEventListener interface. Both the metastore event and corresponding listener method will be invoked in the same JDO transaction.</description>
+    <value-attributes>
+      <empty-value-valid>true</empty-value-valid>
+    </value-attributes>
+    <on-ambari-upgrade add="false"/>
+  </property>
+  <property>
+    <name>hive.repl.cmrootdir</name>
+    <value/>
+    <description>Root dir for ChangeManager, used for deleted files.</description>
+    <value-attributes>
+      <empty-value-valid>true</empty-value-valid>
+    </value-attributes>
+    <on-ambari-upgrade add="false"/>
+  </property>
+  <property>
+    <name>hive.repl.rootdir</name>
+    <value/>
+    <description>HDFS root dir for all replication dumps.</description>
+    <value-attributes>
+      <empty-value-valid>true</empty-value-valid>
+    </value-attributes>
+    <on-ambari-upgrade add="false"/>
+  </property>
+
 </configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/4a47e792/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/scripts/hive.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/scripts/hive.py b/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/scripts/hive.py
index e7e92ec..22ff9fd 100644
--- a/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/scripts/hive.py
+++ b/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/scripts/hive.py
@@ -245,6 +245,21 @@ def setup_hiveserver2():
                          group=params.hdfs_user,
                          mode=0777) # Hive expects this dir to be writeable by everyone as it is used as a temp dir
 
+  if params.hive_repl_cmrootdir is not None:
+    params.HdfsResource(params.hive_repl_cmrootdir,
+                        type = "directory",
+                        action = "create_on_execute",
+                        owner = params.hive_user,
+                        group=params.user_group,
+                        mode = 01777)
+  if params.hive_repl_rootdir is not None:
+    params.HdfsResource(params.hive_repl_rootdir,
+                        type = "directory",
+                        action = "create_on_execute",
+                        owner = params.hive_user,
+                        group=params.user_group,
+                        mode = 0700)
+
   params.HdfsResource(None, action="execute")
 
 def setup_non_client():
@@ -300,6 +315,23 @@ def setup_metastore():
        content=StaticFile('startMetastore.sh')
   )
 
+  if params.hive_repl_cmrootdir is not None:
+    params.HdfsResource(params.hive_repl_cmrootdir,
+                        type = "directory",
+                        action = "create_on_execute",
+                        owner = params.hive_user,
+                        group=params.user_group,
+                        mode = 01777)
+  if params.hive_repl_rootdir is not None:
+    params.HdfsResource(params.hive_repl_rootdir,
+                        type = "directory",
+                        action = "create_on_execute",
+                        owner = params.hive_user,
+                        group=params.user_group,
+                        mode = 0700)
+  if params.hive_repl_cmrootdir is not None or params.hive_repl_rootdir is not None:
+    params.HdfsResource(None, action="execute")
+
 def create_metastore_schema():
   import params
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/4a47e792/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/scripts/params_linux.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/scripts/params_linux.py b/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/scripts/params_linux.py
index f6b676b..fb2c84a 100644
--- a/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/scripts/params_linux.py
+++ b/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/scripts/params_linux.py
@@ -848,3 +848,7 @@ ranger_hive_metastore_lookup = default('/configurations/ranger-hive-plugin-prope
 
 if security_enabled:
   hive_metastore_principal_with_host = hive_metastore_principal.replace('_HOST', hostname.lower())
+
+# replication directories
+hive_repl_cmrootdir = default('/configurations/hive-site/hive.repl.cmrootdir', None)
+hive_repl_rootdir = default('/configurations/hive-site/hive.repl.rootdir', None)