You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by vb...@apache.org on 2015/12/04 18:22:13 UTC

ambari git commit: AMBARI-14216. WireEncryption service check fails for tez.(vbrodetskyi)

Repository: ambari
Updated Branches:
  refs/heads/branch-2.2 2c51d1b7c -> 4c7ce4837


AMBARI-14216. WireEncryption service check fails for tez.(vbrodetskyi)


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

Branch: refs/heads/branch-2.2
Commit: 4c7ce483795afe420774f173feb4159e942b8963
Parents: 2c51d1b
Author: Vitaly Brodetskyi <vb...@hortonworks.com>
Authored: Fri Dec 4 16:21:38 2015 +0200
Committer: Vitaly Brodetskyi <vb...@hortonworks.com>
Committed: Fri Dec 4 16:21:38 2015 +0200

----------------------------------------------------------------------
 .../0.4.0.2.1/package/scripts/service_check.py  |  6 ++
 .../python/stacks/2.1/TEZ/test_service_check.py | 86 ++++++++++++++++++++
 2 files changed, 92 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/4c7ce483/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/package/scripts/service_check.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/package/scripts/service_check.py b/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/package/scripts/service_check.py
index efa16e7..1747cf3 100644
--- a/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/package/scripts/service_check.py
+++ b/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/package/scripts/service_check.py
@@ -72,6 +72,12 @@ class TezServiceCheckLinux(TezServiceCheck):
 
     params.HdfsResource(None, action = "execute")
 
+    if params.security_enabled:
+      kinit_cmd = format("{kinit_path_local} -kt {smoke_user_keytab} {smokeuser_principal};")
+      Execute(kinit_cmd,
+              user=params.smokeuser
+      )
+
     ExecuteHadoop(wordcount_command,
       tries = 3,
       try_sleep = 5,

http://git-wip-us.apache.org/repos/asf/ambari/blob/4c7ce483/ambari-server/src/test/python/stacks/2.1/TEZ/test_service_check.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.1/TEZ/test_service_check.py b/ambari-server/src/test/python/stacks/2.1/TEZ/test_service_check.py
index a7bba23..22b4ef8 100644
--- a/ambari-server/src/test/python/stacks/2.1/TEZ/test_service_check.py
+++ b/ambari-server/src/test/python/stacks/2.1/TEZ/test_service_check.py
@@ -98,3 +98,89 @@ class TestTezServiceCheck(RMFTestCase):
     self.assertNoMoreResources()
 
 
+  def test_service_check_secured(self):
+    self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + "/scripts/service_check.py",
+                       classname="TezServiceCheck",
+                       command="service_check",
+                       config_file="secured.json",
+                       hdp_stack_version = self.STACK_VERSION,
+                       target = RMFTestCase.TARGET_COMMON_SERVICES
+    )
+
+    self.assertResourceCalled('File', '/tmp/sample-tez-test',
+                              content = 'foo\nbar\nfoo\nbar\nfoo',
+                              mode = 0755,
+                              )
+    self.assertResourceCalled('HdfsResource', '/tmp/tezsmokeoutput',
+                              security_enabled = True,
+                              hadoop_bin_dir = '/usr/bin',
+                              keytab = '/etc/security/keytabs/hdfs.headless.keytab',
+                              default_fs = 'hdfs://c6401.ambari.apache.org:8020',
+                              hdfs_site=self.getConfig()['configurations']['hdfs-site'],
+                              kinit_path_local = '/usr/bin/kinit',
+                              principal_name = 'hdfs',
+                              user = 'hdfs',
+                              action = ['delete_on_execute'],
+                              hadoop_conf_dir = '/etc/hadoop/conf',
+                              type = 'directory',
+                              )
+    self.assertResourceCalled('HdfsResource', '/tmp/tezsmokeinput',
+                              security_enabled = True,
+                              hadoop_bin_dir = '/usr/bin',
+                              keytab = '/etc/security/keytabs/hdfs.headless.keytab',
+                              default_fs = 'hdfs://c6401.ambari.apache.org:8020',
+                              hdfs_site=self.getConfig()['configurations']['hdfs-site'],
+                              kinit_path_local = '/usr/bin/kinit',
+                              principal_name = 'hdfs',
+                              user = 'hdfs',
+                              owner = 'ambari-qa',
+                              hadoop_conf_dir = '/etc/hadoop/conf',
+                              type = 'directory',
+                              action = ['create_on_execute'],
+                              )
+    self.assertResourceCalled('HdfsResource', '/tmp/tezsmokeinput/sample-tez-test',
+                              security_enabled = True,
+                              hadoop_bin_dir = '/usr/bin',
+                              keytab = '/etc/security/keytabs/hdfs.headless.keytab',
+                              source = '/tmp/sample-tez-test',
+                              default_fs = 'hdfs://c6401.ambari.apache.org:8020',
+                              hdfs_site=self.getConfig()['configurations']['hdfs-site'],
+                              kinit_path_local = '/usr/bin/kinit',
+                              principal_name = 'hdfs',
+                              user = 'hdfs',
+                              owner = 'ambari-qa',
+                              hadoop_conf_dir = '/etc/hadoop/conf',
+                              type = 'file',
+                              action = ['create_on_execute'],
+                              )
+    self.assertResourceCalled('HdfsResource', None,
+                              security_enabled = True,
+                              hadoop_bin_dir = '/usr/bin',
+                              keytab = '/etc/security/keytabs/hdfs.headless.keytab',
+                              default_fs = 'hdfs://c6401.ambari.apache.org:8020',
+                              hdfs_site=self.getConfig()['configurations']['hdfs-site'],
+                              kinit_path_local = '/usr/bin/kinit',
+                              principal_name = 'hdfs',
+                              user = 'hdfs',
+                              action = ['execute'],
+                              hadoop_conf_dir = '/etc/hadoop/conf',
+                              )
+    self.assertResourceCalled('Execute', '/usr/bin/kinit -kt /etc/security/keytabs/smokeuser.headless.keytab ambari-qa@EXAMPLE.COM;',
+                              user = 'ambari-qa',
+                              )
+    self.assertResourceCalled('ExecuteHadoop', 'jar /usr/lib/tez/tez-mapreduce-examples*.jar orderedwordcount /tmp/tezsmokeinput/sample-tez-test /tmp/tezsmokeoutput/',
+                              try_sleep = 5,
+                              tries = 3,
+                              bin_dir = '/usr/bin',
+                              user = 'ambari-qa',
+                              conf_dir = '/etc/hadoop/conf',
+                              )
+    self.assertResourceCalled('ExecuteHadoop', 'fs -test -e /tmp/tezsmokeoutput/_SUCCESS',
+                              try_sleep = 6,
+                              tries = 10,
+                              bin_dir = '/usr/bin',
+                              user = 'ambari-qa',
+                              conf_dir = '/etc/hadoop/conf',
+                              )
+    self.assertNoMoreResources()
+