Browse Source

AMBARI-9895. security_status test cases sporadically fail due to import of status_params module (rlevas)

Robert Levas 10 years ago
parent
commit
ef25e4de84
31 changed files with 325 additions and 308 deletions
  1. 1 2
      ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/hbase_master.py
  2. 1 2
      ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/hbase_regionserver.py
  3. 1 2
      ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/drpc_server.py
  4. 1 2
      ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/nimbus.py
  5. 1 2
      ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/ui_server.py
  6. 2 4
      ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/application_timeline_server.py
  7. 2 4
      ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/nodemanager.py
  8. 2 4
      ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/resourcemanager.py
  9. 1 2
      ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/package/scripts/zookeeper_server.py
  10. 19 10
      ambari-server/src/test/python/stacks/2.0.6/HBASE/test_hbase_master.py
  11. 15 14
      ambari-server/src/test/python/stacks/2.0.6/HBASE/test_hbase_regionserver.py
  12. 13 11
      ambari-server/src/test/python/stacks/2.0.6/HDFS/test_datanode.py
  13. 14 12
      ambari-server/src/test/python/stacks/2.0.6/HDFS/test_hdfs_client.py
  14. 21 17
      ambari-server/src/test/python/stacks/2.0.6/HDFS/test_journalnode.py
  15. 21 17
      ambari-server/src/test/python/stacks/2.0.6/HDFS/test_namenode.py
  16. 22 18
      ambari-server/src/test/python/stacks/2.0.6/HDFS/test_snamenode.py
  17. 16 13
      ambari-server/src/test/python/stacks/2.0.6/HDFS/test_zkfc.py
  18. 5 6
      ambari-server/src/test/python/stacks/2.0.6/HIVE/test_hive_server.py
  19. 8 8
      ambari-server/src/test/python/stacks/2.0.6/HIVE/test_webhcat_server.py
  20. 8 9
      ambari-server/src/test/python/stacks/2.0.6/OOZIE/test_oozie_server.py
  21. 5 7
      ambari-server/src/test/python/stacks/2.0.6/YARN/test_historyserver.py
  22. 18 17
      ambari-server/src/test/python/stacks/2.0.6/YARN/test_nodemanager.py
  23. 18 17
      ambari-server/src/test/python/stacks/2.0.6/YARN/test_resourcemanager.py
  24. 17 15
      ambari-server/src/test/python/stacks/2.0.6/ZOOKEEPER/test_zookeeper_server.py
  25. 17 15
      ambari-server/src/test/python/stacks/2.1/FALCON/test_falcon_server.py
  26. 8 8
      ambari-server/src/test/python/stacks/2.1/HIVE/test_hive_metastore.py
  27. 18 17
      ambari-server/src/test/python/stacks/2.1/STORM/test_storm_drpc_server.py
  28. 18 18
      ambari-server/src/test/python/stacks/2.1/STORM/test_storm_nimbus.py
  29. 12 14
      ambari-server/src/test/python/stacks/2.1/STORM/test_storm_ui_server.py
  30. 16 15
      ambari-server/src/test/python/stacks/2.1/YARN/test_apptimelineserver.py
  31. 4 6
      ambari-server/src/test/python/stacks/2.2/KNOX/test_knox_gateway.py

+ 1 - 2
ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/hbase_master.py

@@ -106,8 +106,7 @@ class HbaseMaster(Script):
                                 security_params['hbase-site']['hbase.master.keytab.file'],
                                 security_params['hbase-site']['hbase.master.kerberos.principal'],
                                 status_params.hostname,
-                                status_params.tmp_dir,
-                                30)
+                                status_params.tmp_dir)
           self.put_structured_out({"securityState": "SECURED_KERBEROS"})
         except Exception as e:
           self.put_structured_out({"securityState": "ERROR"})

+ 1 - 2
ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/hbase_regionserver.py

@@ -111,8 +111,7 @@ class HbaseRegionServer(Script):
                                 security_params['hbase-site']['hbase.regionserver.keytab.file'],
                                 security_params['hbase-site']['hbase.regionserver.kerberos.principal'],
                                 status_params.hostname,
-                                status_params.tmp_dir,
-                                30)
+                                status_params.tmp_dir)
           self.put_structured_out({"securityState": "SECURED_KERBEROS"})
         except Exception as e:
           self.put_structured_out({"securityState": "ERROR"})

+ 1 - 2
ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/drpc_server.py

@@ -110,8 +110,7 @@ class DrpcServer(Script):
                                 security_params['storm_jaas']['StormServer']['keyTab'],
                                 security_params['storm_jaas']['StormServer']['principal'],
                                 status_params.hostname,
-                                status_params.tmp_dir,
-                                30)
+                                status_params.tmp_dir)
           self.put_structured_out({"securityState": "SECURED_KERBEROS"})
         else:
           issues = []

+ 1 - 2
ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/nimbus.py

@@ -110,8 +110,7 @@ class Nimbus(Script):
                                 security_params['storm_jaas']['StormServer']['keyTab'],
                                 security_params['storm_jaas']['StormServer']['principal'],
                                 status_params.hostname,
-                                status_params.tmp_dir,
-                                30)
+                                status_params.tmp_dir)
           self.put_structured_out({"securityState": "SECURED_KERBEROS"})
         else:
           issues = []

+ 1 - 2
ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/ui_server.py

@@ -111,8 +111,7 @@ class UiServer(Script):
                                 security_params['storm_ui']['storm_ui_keytab'],
                                 security_params['storm_ui']['storm_ui_principal_name'],
                                 status_params.hostname,
-                                status_params.tmp_dir,
-                                30)
+                                status_params.tmp_dir)
           self.put_structured_out({"securityState": "SECURED_KERBEROS"})
         else:
           issues = []

+ 2 - 4
ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/application_timeline_server.py

@@ -110,15 +110,13 @@ class ApplicationTimelineServer(Script):
                                 security_params['yarn-site']['yarn.timeline-service.keytab'],
                                 security_params['yarn-site']['yarn.timeline-service.principal'],
                                 status_params.hostname,
-                                status_params.tmp_dir,
-                                30)
+                                status_params.tmp_dir)
           cached_kinit_executor(status_params.kinit_path_local,
                                 status_params.yarn_user,
                                 security_params['yarn-site']['yarn.timeline-service.http-authentication.kerberos.keytab'],
                                 security_params['yarn-site']['yarn.timeline-service.http-authentication.kerberos.principal'],
                                 status_params.hostname,
-                                status_params.tmp_dir,
-                                30)
+                                status_params.tmp_dir)
           self.put_structured_out({"securityState": "SECURED_KERBEROS"})
         except Exception as e:
           self.put_structured_out({"securityState": "ERROR"})

+ 2 - 4
ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/nodemanager.py

@@ -116,15 +116,13 @@ class Nodemanager(Script):
                                 security_params['yarn-site']['yarn.nodemanager.keytab'],
                                 security_params['yarn-site']['yarn.nodemanager.principal'],
                                 status_params.hostname,
-                                status_params.tmp_dir,
-                                30)
+                                status_params.tmp_dir)
           cached_kinit_executor(status_params.kinit_path_local,
                                 status_params.yarn_user,
                                 security_params['yarn-site']['yarn.nodemanager.webapp.spnego-keytab-file'],
                                 security_params['yarn-site']['yarn.nodemanager.webapp.spnego-principal'],
                                 status_params.hostname,
-                                status_params.tmp_dir,
-                                30)
+                                status_params.tmp_dir)
           self.put_structured_out({"securityState": "SECURED_KERBEROS"})
         except Exception as e:
           self.put_structured_out({"securityState": "ERROR"})

+ 2 - 4
ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/resourcemanager.py

@@ -116,15 +116,13 @@ class Resourcemanager(Script):
                                 security_params['yarn-site']['yarn.resourcemanager.keytab'],
                                 security_params['yarn-site']['yarn.resourcemanager.principal'],
                                 status_params.hostname,
-                                status_params.tmp_dir,
-                                30)
+                                status_params.tmp_dir)
           cached_kinit_executor(status_params.kinit_path_local,
                                 status_params.yarn_user,
                                 security_params['yarn-site']['yarn.resourcemanager.webapp.spnego-keytab-file'],
                                 security_params['yarn-site']['yarn.resourcemanager.webapp.spnego-principal'],
                                 status_params.hostname,
-                                status_params.tmp_dir,
-                                30)
+                                status_params.tmp_dir)
           self.put_structured_out({"securityState": "SECURED_KERBEROS"})
         except Exception as e:
           self.put_structured_out({"securityState": "ERROR"})

+ 1 - 2
ambari-server/src/main/resources/common-services/ZOOKEEPER/3.4.5.2.0/package/scripts/zookeeper_server.py

@@ -135,8 +135,7 @@ class ZookeeperServer(Script):
                                 security_params['zookeeper_jaas']['Server']['keyTab'],
                                 security_params['zookeeper_jaas']['Server']['principal'],
                                 status_params.hostname,
-                                status_params.tmp_dir,
-                                30)
+                                status_params.tmp_dir)
           self.put_structured_out({"securityState": "SECURED_KERBEROS"})
         else:
           issues = []

+ 19 - 10
ambari-server/src/test/python/stacks/2.0.6/HBASE/test_hbase_master.py

@@ -567,12 +567,21 @@ class TestHBaseMaster(RMFTestCase):
   @patch("resource_management.libraries.script.Script.put_structured_out")
   def test_security_status(self, put_structured_out_mock, cached_kinit_executor_mock, validate_security_config_mock, get_params_mock, build_exp_mock):
     # Test that function works when is called with correct parameters
-    import status_params
-
-    security_params = {}
-    security_params['hbase-site'] = {}
-    security_params['hbase-site']['hbase.master.kerberos.principal'] = '/path/to/hbase_keytab'
-    security_params['hbase-site']['hbase.master.keytab.file'] = 'hbase_principal'
+    import collections
+
+    security_params = {
+      'hbase-site': {
+        'hbase.master.kerberos.principal': '/path/to/hbase_keytab',
+        'hbase.master.keytab.file': 'hbase_principal'
+      }
+    }
+
+    status_params = {
+      'kinit_path_local' : '/bin/kinit',
+      'hbase_user' : 'hbase',
+      'hostname' : 'localhost',
+      'tmp_dir' : '/thisdoesmotexost'
+    }
 
     result_issues = []
     props_value_check = {"hbase.security.authentication": "kerberos",
@@ -595,12 +604,12 @@ class TestHBaseMaster(RMFTestCase):
 
     build_exp_mock.assert_called_with('hbase-site', props_value_check, props_empty_check, props_read_check)
     put_structured_out_mock.assert_called_with({"securityState": "SECURED_KERBEROS"})
-    cached_kinit_executor_mock.called_with(status_params.kinit_path_local,
-                              status_params.hbase_user,
+    cached_kinit_executor_mock.called_with(status_params['kinit_path_local'],
+                              status_params['hbase_user'],
                               security_params['hbase-site']['hbase.master.keytab.file'],
                               security_params['hbase-site']['hbase.master.kerberos.principal'],
-                              status_params.hostname,
-                              status_params.tmp_dir,
+                              status_params['hostname'],
+                              status_params['tmp_dir'],
                               30)
 
      # Testing that the exception throw by cached_executor is caught

+ 15 - 14
ambari-server/src/test/python/stacks/2.0.6/HBASE/test_hbase_regionserver.py

@@ -495,12 +495,13 @@ class TestHbaseRegionServer(RMFTestCase):
   @patch("resource_management.libraries.script.Script.put_structured_out")
   def test_security_status(self, put_structured_out_mock, cached_kinit_executor_mock, validate_security_config_mock, get_params_mock, build_exp_mock):
     # Test that function works when is called with correct parameters
-    import status_params
 
-    security_params = {}
-    security_params['hbase-site'] = {}
-    security_params['hbase-site']['hbase.regionserver.keytab.file'] = '/path/to/hbase_keytab'
-    security_params['hbase-site']['hbase.regionserver.kerberos.principal'] = 'hbase_principal'
+    security_params = {
+      'hbase-site': {
+        'hbase.regionserver.keytab.file': '/path/to/hbase_keytab',
+        'hbase.regionserver.kerberos.principal': 'hbase_principal'
+      }
+    }
 
     result_issues = []
     props_value_check = {"hbase.security.authentication": "kerberos",
@@ -523,13 +524,12 @@ class TestHbaseRegionServer(RMFTestCase):
 
     build_exp_mock.assert_called_with('hbase-site', props_value_check, props_empty_check, props_read_check)
     put_structured_out_mock.assert_called_with({"securityState": "SECURED_KERBEROS"})
-    cached_kinit_executor_mock.called_with(status_params.kinit_path_local,
-                              status_params.hbase_user,
-                              security_params['hbase-site']['hbase.regionserver.keytab.file'],
-                              security_params['hbase-site']['hbase.regionserver.kerberos.principal'],
-                              status_params.hostname,
-                              status_params.tmp_dir,
-                              30)
+    cached_kinit_executor_mock.called_with('/usr/bin/kinit',
+                                           self.config_dict['configurations']['hbase-env']['hbase_user'],
+                                           security_params['hbase-site']['hbase.regionserver.keytab.file'],
+                                           security_params['hbase-site']['hbase.regionserver.kerberos.principal'],
+                                           self.config_dict['hostname'],
+                                           '/tmp')
 
      # Testing that the exception throw by cached_executor is caught
     cached_kinit_executor_mock.reset_mock()
@@ -563,8 +563,9 @@ class TestHbaseRegionServer(RMFTestCase):
     put_structured_out_mock.assert_called_with({"securityIssuesFound": "Keytab file or principal are not set property."})
 
     # Testing with not empty result_issues
-    result_issues_with_params = {}
-    result_issues_with_params['hbase-site']="Something bad happened"
+    result_issues_with_params = {
+      'hbase-site' : "Something bad happened"
+    }
 
     validate_security_config_mock.reset_mock()
     get_params_mock.reset_mock()

+ 13 - 11
ambari-server/src/test/python/stacks/2.0.6/HDFS/test_datanode.py

@@ -523,14 +523,16 @@ class TestDatanode(RMFTestCase):
   @patch("resource_management.libraries.script.Script.put_structured_out")
   def test_security_status(self, put_structured_out_mock, cached_kinit_executor_mock, validate_security_config_mock, get_params_mock, build_exp_mock):
     # Test that function works when is called with correct parameters
-    import status_params
 
-    security_params = {}
-    security_params['core-site'] = {}
-    security_params['core-site']['hadoop.security.authentication'] = 'kerberos'
-    security_params['hdfs-site'] = {}
-    security_params['hdfs-site']['dfs.datanode.keytab.file'] = 'path/to/datanode/keytab/file'
-    security_params['hdfs-site']['dfs.datanode.kerberos.principal'] = 'datanode_principal'
+    security_params = {
+      'core-site': {
+        'hadoop.security.authentication': 'kerberos'
+      },
+      'hdfs-site': {
+        'dfs.datanode.keytab.file': 'path/to/datanode/keytab/file',
+        'dfs.datanode.kerberos.principal': 'datanode_principal'
+      }
+    }
 
     props_value_check = None
     props_empty_check = ['dfs.datanode.keytab.file',
@@ -552,12 +554,12 @@ class TestDatanode(RMFTestCase):
 
     build_exp_mock.assert_called_with('hdfs-site', props_value_check, props_empty_check, props_read_check)
     put_structured_out_mock.assert_called_with({"securityState": "SECURED_KERBEROS"})
-    cached_kinit_executor_mock.called_with(status_params.kinit_path_local,
-                                           status_params.hdfs_user,
+    cached_kinit_executor_mock.called_with('/usr/bin/kinit',
+                                           self.config_dict['configurations']['hadoop-env']['hdfs_user'],
                                            security_params['hdfs-site']['dfs.datanode.keytab.file'],
                                            security_params['hdfs-site']['dfs.datanode.kerberos.principal'],
-                                           status_params.hostname,
-                                           status_params.tmp_dir)
+                                           self.config_dict['hostname'],
+                                           '/tmp')
 
     # Testing when hadoop.security.authentication is simple
     security_params['core-site']['hadoop.security.authentication'] = 'simple'

+ 14 - 12
ambari-server/src/test/python/stacks/2.0.6/HDFS/test_hdfs_client.py

@@ -86,11 +86,12 @@ class Test(RMFTestCase):
   @patch("resource_management.libraries.script.Script.put_structured_out")
   def test_security_status(self, put_structured_out_mock, cached_kinit_executor_mock, validate_security_config_mock, get_params_mock, build_exp_mock):
     # Test that function works when is called with correct parameters
-    import status_params
 
-    security_params = {}
-    security_params['core-site'] = {}
-    security_params['core-site']['hadoop.security.authentication'] = 'kerberos'
+    security_params = {
+      'core-site': {
+        'hadoop.security.authentication': 'kerberos'
+      }
+    }
 
     props_value_check = {"hadoop.security.authentication": "kerberos",
                          "hadoop.security.authorization": "true"}
@@ -112,12 +113,12 @@ class Test(RMFTestCase):
 
     build_exp_mock.assert_called_with('core-site', props_value_check, props_empty_check, props_read_check)
     put_structured_out_mock.assert_called_with({"securityState": "SECURED_KERBEROS"})
-    cached_kinit_executor_mock.called_with(status_params.kinit_path_local,
-                                           status_params.hdfs_user,
-                                           status_params.hdfs_user_keytab,
-                                           status_params.hdfs_user_principal,
-                                           status_params.hostname,
-                                           status_params.tmp_dir)
+    cached_kinit_executor_mock.called_with('/usr/bin/kinit',
+                                           self.config_dict['configurations']['hadoop-env']['hdfs_user'],
+                                           self.config_dict['configurations']['hadoop-env']['hdfs_user_keytab'],
+                                           self.config_dict['configurations']['hadoop-env']['hdfs_user_principal_name'],
+                                           self.config_dict['hostname'],
+                                           '/tmp')
 
     # Testing that the exception throw by cached_executor is caught
     cached_kinit_executor_mock.reset_mock()
@@ -149,8 +150,9 @@ class Test(RMFTestCase):
     security_params['core-site']['hadoop.security.authentication'] = 'kerberos'
 
     # Testing with not empty result_issues
-    result_issues_with_params = {}
-    result_issues_with_params['hdfs-site']="Something bad happened"
+    result_issues_with_params = {
+      'hdfs-site': "Something bad happened"
+    }
 
     validate_security_config_mock.reset_mock()
     get_params_mock.reset_mock()

+ 21 - 17
ambari-server/src/test/python/stacks/2.0.6/HDFS/test_journalnode.py

@@ -332,14 +332,15 @@ class TestJournalnode(RMFTestCase):
   @patch("resource_management.libraries.script.Script.put_structured_out")
   def test_security_status(self, put_structured_out_mock, cached_kinit_executor_mock, validate_security_config_mock, get_params_mock, build_exp_mock):
     # Test that function works when is called with correct parameters
-    import status_params
-
-    security_params = {}
-    security_params['core-site'] = {}
-    security_params['core-site']['hadoop.security.authentication'] = 'kerberos'
-    security_params['hdfs-site'] = {}
-    security_params['hdfs-site']['dfs.journalnode.kerberos.keytab.file'] = 'path/to/journalnode/keytab/file'
-    security_params['hdfs-site']['dfs.journalnode.kerberos.principal'] = 'journalnode_principal'
+    security_params = {
+      'core-site': {
+        'hadoop.security.authentication': 'kerberos'
+      },
+      'hdfs-site': {
+        'dfs.journalnode.kerberos.keytab.file': 'path/to/journalnode/keytab/file',
+        'dfs.journalnode.kerberos.principal': 'journalnode_principal'
+      }
+    }
 
     props_value_check = None
     props_empty_check = ['dfs.journalnode.keytab.file',
@@ -361,12 +362,12 @@ class TestJournalnode(RMFTestCase):
 
     build_exp_mock.assert_called_with('hdfs-site', props_value_check, props_empty_check, props_read_check)
     put_structured_out_mock.assert_called_with({"securityState": "SECURED_KERBEROS"})
-    cached_kinit_executor_mock.called_with(status_params.kinit_path_local,
-                                           status_params.hdfs_user,
+    cached_kinit_executor_mock.called_with('/usr/bin/kinit',
+                                           self.config_dict['configurations']['hadoop-env']['hdfs_user'],
                                            security_params['hdfs-site']['dfs.journalnode.kerberos.keytab.file'],
                                            security_params['hdfs-site']['dfs.journalnode.kerberos.principal'],
-                                           status_params.hostname,
-                                           status_params.tmp_dir)
+                                           self.config_dict['hostname'],
+                                           '/tmp')
 
     # Testing when hadoop.security.authentication is simple
     security_params['core-site']['hadoop.security.authentication'] = 'simple'
@@ -398,9 +399,11 @@ class TestJournalnode(RMFTestCase):
       self.assertTrue(True)
 
     # Testing with a security_params which doesn't contains hdfs-site
-    empty_security_params = {}
-    empty_security_params['core-site'] = {}
-    empty_security_params['core-site']['hadoop.security.authentication'] = 'kerberos'
+    empty_security_params = {
+      'core-site': {
+        'hadoop.security.authentication': 'kerberos'
+      }
+    }
     cached_kinit_executor_mock.reset_mock()
     get_params_mock.reset_mock()
     put_structured_out_mock.reset_mock()
@@ -417,8 +420,9 @@ class TestJournalnode(RMFTestCase):
     put_structured_out_mock.assert_called_with({"securityIssuesFound": "Keytab file or principal are not set property."})
 
     # Testing with not empty result_issues
-    result_issues_with_params = {}
-    result_issues_with_params['hdfs-site']="Something bad happened"
+    result_issues_with_params = {
+      'hdfs-site': "Something bad happened"
+    }
 
     validate_security_config_mock.reset_mock()
     get_params_mock.reset_mock()

+ 21 - 17
ambari-server/src/test/python/stacks/2.0.6/HDFS/test_namenode.py

@@ -804,15 +804,16 @@ class TestNamenode(RMFTestCase):
   @patch("resource_management.libraries.script.Script.put_structured_out")
   def test_security_status(self, put_structured_out_mock, cached_kinit_executor_mock, validate_security_config_mock, get_params_mock, build_exp_mock):
     # Test that function works when is called with correct parameters
-    import status_params
-
-    security_params = {}
-    security_params['core-site'] = {}
-    security_params['core-site']['hadoop.security.authentication'] = 'kerberos'
-    security_params['hdfs-site'] = {}
-    security_params['hdfs-site']['dfs.namenode.keytab.file'] = 'path/to/namenode/keytab/file'
-    security_params['hdfs-site']['dfs.namenode.kerberos.principal'] = 'namenode_principal'
 
+    security_params = {
+      'core-site': {
+        'hadoop.security.authentication': 'kerberos'
+      },
+      'hdfs-site': {
+        'dfs.namenode.keytab.file': 'path/to/namenode/keytab/file',
+        'dfs.namenode.kerberos.principal': 'namenode_principal'
+      }
+    }
     props_value_check = None
     props_empty_check = ['dfs.namenode.kerberos.internal.spnego.principal',
                        'dfs.namenode.keytab.file',
@@ -834,12 +835,12 @@ class TestNamenode(RMFTestCase):
 
     build_exp_mock.assert_called_with('hdfs-site', props_value_check, props_empty_check, props_read_check)
     put_structured_out_mock.assert_called_with({"securityState": "SECURED_KERBEROS"})
-    cached_kinit_executor_mock.called_with(status_params.kinit_path_local,
-                                           status_params.hdfs_user,
+    cached_kinit_executor_mock.called_with('/usr/bin/kinit',
+                                           self.config_dict['configurations']['hadoop-env']['hdfs_user'],
                                            security_params['hdfs-site']['dfs.namenode.keytab.file'],
                                            security_params['hdfs-site']['dfs.namenode.kerberos.principal'],
-                                           status_params.hostname,
-                                           status_params.tmp_dir)
+                                           self.config_dict['hostname'],
+                                           '/tmp')
 
     # Testing when hadoop.security.authentication is simple
     security_params['core-site']['hadoop.security.authentication'] = 'simple'
@@ -871,9 +872,11 @@ class TestNamenode(RMFTestCase):
       self.assertTrue(True)
 
     # Testing with a security_params which doesn't contains hdfs-site
-    empty_security_params = {}
-    empty_security_params['core-site'] = {}
-    empty_security_params['core-site']['hadoop.security.authentication'] = 'kerberos'
+    empty_security_params = {
+      'core-site': {
+        'hadoop.security.authentication': 'kerberos'
+      }
+    }
     cached_kinit_executor_mock.reset_mock()
     get_params_mock.reset_mock()
     put_structured_out_mock.reset_mock()
@@ -890,8 +893,9 @@ class TestNamenode(RMFTestCase):
     put_structured_out_mock.assert_called_with({"securityIssuesFound": "Keytab file or principal are not set property."})
 
     # Testing with not empty result_issues
-    result_issues_with_params = {}
-    result_issues_with_params['hdfs-site']="Something bad happened"
+    result_issues_with_params = {
+      'hdfs-site': "Something bad happened"
+    }
 
     validate_security_config_mock.reset_mock()
     get_params_mock.reset_mock()

+ 22 - 18
ambari-server/src/test/python/stacks/2.0.6/HDFS/test_snamenode.py

@@ -291,14 +291,16 @@ class TestSNamenode(RMFTestCase):
   @patch("resource_management.libraries.script.Script.put_structured_out")
   def test_security_status(self, put_structured_out_mock, cached_kinit_executor_mock, validate_security_config_mock, get_params_mock, build_exp_mock):
     # Test that function works when is called with correct parameters
-    import status_params
 
-    security_params = {}
-    security_params['core-site'] = {}
-    security_params['core-site']['hadoop.security.authentication'] = 'kerberos'
-    security_params['hdfs-site'] = {}
-    security_params['hdfs-site']['dfs.secondary.namenode.keytab.file'] = 'path/to/snamenode/keytab/file'
-    security_params['hdfs-site']['dfs.secondary.namenode.kerberos.principal'] = 'snamenode_principal'
+    security_params = {
+      'core-site': {
+        'hadoop.security.authentication': 'kerberos'
+      },
+      'hdfs-site': {
+        'dfs.secondary.namenode.keytab.file': 'path/to/snamenode/keytab/file',
+        'dfs.secondary.namenode.kerberos.principal': 'snamenode_principal'
+      }
+    }
 
     props_value_check = None
     props_empty_check = ['dfs.secondary.namenode.kerberos.internal.spnego.principal',
@@ -321,13 +323,12 @@ class TestSNamenode(RMFTestCase):
 
     build_exp_mock.assert_called_with('hdfs-site', props_value_check, props_empty_check, props_read_check)
     put_structured_out_mock.assert_called_with({"securityState": "SECURED_KERBEROS"})
-    cached_kinit_executor_mock.called_with(status_params.kinit_path_local,
-                                           status_params.hdfs_user,
+    cached_kinit_executor_mock.called_with('/usr/bin/kinit',
+                                           self.config_dict['configurations']['hadoop-env']['hdfs_user'],
                                            security_params['hdfs-site']['dfs.secondary.namenode.keytab.file'],
-                                           security_params['hdfs-site'][
-                                             'dfs.secondary.namenode.kerberos.principal'],
-                                           status_params.hostname,
-                                           status_params.tmp_dir)
+                                           security_params['hdfs-site']['dfs.secondary.namenode.kerberos.principal'],
+                                           self.config_dict['hostname'],
+                                           '/tmp')
 
     # Testing when hadoop.security.authentication is simple
     security_params['core-site']['hadoop.security.authentication'] = 'simple'
@@ -359,9 +360,11 @@ class TestSNamenode(RMFTestCase):
       self.assertTrue(True)
 
     # Testing with a security_params which doesn't contains hdfs-site
-    empty_security_params = {}
-    empty_security_params['core-site'] = {}
-    empty_security_params['core-site']['hadoop.security.authentication'] = 'kerberos'
+    empty_security_params = {
+      'core-site': {
+        'hadoop.security.authentication': 'kerberos'
+      }
+    }
     cached_kinit_executor_mock.reset_mock()
     get_params_mock.reset_mock()
     put_structured_out_mock.reset_mock()
@@ -378,8 +381,9 @@ class TestSNamenode(RMFTestCase):
     put_structured_out_mock.assert_called_with({"securityIssuesFound": "Keytab file or principal are not set property."})
 
     # Testing with not empty result_issues
-    result_issues_with_params = {}
-    result_issues_with_params['hdfs-site']="Something bad happened"
+    result_issues_with_params = {
+      'hdfs-site': "Something bad happened"
+    }
 
     validate_security_config_mock.reset_mock()
     get_params_mock.reset_mock()

+ 16 - 13
ambari-server/src/test/python/stacks/2.0.6/HDFS/test_zkfc.py

@@ -346,12 +346,14 @@ class TestZkfc(RMFTestCase):
   @patch("resource_management.libraries.functions.security_commons.cached_kinit_executor")
   @patch("resource_management.libraries.script.Script.put_structured_out")
   def test_security_status(self, put_structured_out_mock, cached_kinit_executor_mock, validate_security_config_mock, get_params_mock, build_exp_mock):
-    # Test that function works when is called with correct parameters
-    import status_params
+    print "HELLO WORLD!!!!"
 
-    security_params = {}
-    security_params['core-site'] = {}
-    security_params['core-site']['hadoop.security.authentication'] = 'kerberos'
+    # Test that function works when is called with correct parameters
+    security_params = {
+      'core-site': {
+        'hadoop.security.authentication': 'kerberos'
+      }
+    }
 
     props_value_check = {"hadoop.security.authentication": "kerberos",
                          "hadoop.security.authorization": "true"}
@@ -373,12 +375,12 @@ class TestZkfc(RMFTestCase):
 
     build_exp_mock.assert_called_with('core-site', props_value_check, props_empty_check, props_read_check)
     put_structured_out_mock.assert_called_with({"securityState": "SECURED_KERBEROS"})
-    cached_kinit_executor_mock.called_with(status_params.kinit_path_local,
-                                           status_params.hdfs_user,
-                                           status_params.hdfs_user_keytab,
-                                           status_params.hdfs_user_principal,
-                                           status_params.hostname,
-                                           status_params.tmp_dir)
+    cached_kinit_executor_mock.called_with('/usr/bin/kinit',
+                                           self.config_dict['configurations']['hadoop-env']['hdfs_user'],
+                                           self.config_dict['configurations']['hadoop-env']['hdfs_user_keytab'],
+                                           self.config_dict['configurations']['hadoop-env']['hdfs_user_principal_name'],
+                                           self.config_dict['hostname'],
+                                           '/tmp')
 
     # Testing that the exception throw by cached_executor is caught
     cached_kinit_executor_mock.reset_mock()
@@ -410,8 +412,9 @@ class TestZkfc(RMFTestCase):
     security_params['core-site']['hadoop.security.authentication'] = 'kerberos'
 
     # Testing with not empty result_issues
-    result_issues_with_params = {}
-    result_issues_with_params['hdfs-site']="Something bad happened"
+    result_issues_with_params = {
+      'hdfs-site': "Something bad happened"
+    }
 
     validate_security_config_mock.reset_mock()
     get_params_mock.reset_mock()

+ 5 - 6
ambari-server/src/test/python/stacks/2.0.6/HIVE/test_hive_server.py

@@ -541,7 +541,6 @@ class TestHiveServer(RMFTestCase):
   @patch("resource_management.libraries.script.Script.put_structured_out")
   def test_security_status(self, put_structured_out_mock, cached_kinit_executor_mock, validate_security_config_mock, get_params_mock, build_exp_mock):
     # Test that function works when is called with correct parameters
-    import status_params
 
     security_params = {
       'hive-site': {
@@ -577,16 +576,16 @@ class TestHiveServer(RMFTestCase):
                        target = RMFTestCase.TARGET_COMMON_SERVICES
     )
 
-    get_params_mock.assert_called_with(status_params.hive_conf_dir, {'hive-site.xml': "XML"})
+    get_params_mock.assert_called_with('/etc/hive/conf', {'hive-site.xml': "XML"})
     build_exp_mock.assert_called_with('hive-site', props_value_check, props_empty_check, props_read_check)
     put_structured_out_mock.assert_called_with({"securityState": "SECURED_KERBEROS"})
     self.assertTrue(cached_kinit_executor_mock.call_count, 2)
-    cached_kinit_executor_mock.assert_called_with(status_params.kinit_path_local,
-                                                  status_params.hive_user,
+    cached_kinit_executor_mock.assert_called_with('/usr/bin/kinit',
+                                                  self.config_dict['configurations']['hive-env']['hive_user'],
                                                   security_params['hive-site']['hive.server2.authentication.spnego.keytab'],
                                                   security_params['hive-site']['hive.server2.authentication.spnego.principal'],
-                                                  status_params.hostname,
-                                                  status_params.tmp_dir)
+                                                  self.config_dict['hostname'],
+                                                  '/tmp')
 
     # Testing that the exception throw by cached_executor is caught
     cached_kinit_executor_mock.reset_mock()

+ 8 - 8
ambari-server/src/test/python/stacks/2.0.6/HIVE/test_webhcat_server.py

@@ -334,7 +334,6 @@ class TestWebHCatServer(RMFTestCase):
   @patch("resource_management.libraries.script.Script.put_structured_out")
   def test_security_status(self, put_structured_out_mock, cached_kinit_executor_mock, validate_security_config_mock, get_params_mock, build_exp_mock):
     # Test that function works when is called with correct parameters
-    import status_params
 
     security_params = {
       'webhcat-site': {
@@ -373,15 +372,15 @@ class TestWebHCatServer(RMFTestCase):
 
     build_exp_mock.assert_called_with('hive-site', hive_props_value_check, hive_props_empty_check, hive_props_read_check)
     # get_params_mock.assert_called_with(status_params.hive_conf_dir, {'hive-site.xml': "XML"})
-    get_params_mock.assert_called_with(status_params.webhcat_conf_dir, {'webhcat-site.xml': "XML"})
+    get_params_mock.assert_called_with('/etc/hive-webhcat/conf', {'webhcat-site.xml': "XML"})
     put_structured_out_mock.assert_called_with({"securityState": "SECURED_KERBEROS"})
     self.assertTrue(cached_kinit_executor_mock.call_count, 2)
-    cached_kinit_executor_mock.assert_called_with(status_params.kinit_path_local,
-                                                  status_params.webhcat_user,
+    cached_kinit_executor_mock.assert_called_with('/usr/bin/kinit',
+                                                  self.config_dict['configurations']['hive-env']['webhcat_user'],
                                                   security_params['webhcat-site']['templeton.kerberos.keytab'],
                                                   security_params['webhcat-site']['templeton.kerberos.principal'],
-                                                  status_params.hostname,
-                                                  status_params.tmp_dir)
+                                                  self.config_dict['hostname'],
+                                                  '/tmp')
 
     # Testing that the exception throw by cached_executor is caught
     cached_kinit_executor_mock.reset_mock()
@@ -415,8 +414,9 @@ class TestWebHCatServer(RMFTestCase):
     put_structured_out_mock.assert_called_with({"securityIssuesFound": "Keytab file or principal are not set property."})
 
     # Testing with not empty result_issues
-    result_issues_with_params = {}
-    result_issues_with_params['hive-site']="Something bad happened"
+    result_issues_with_params = {
+      'hive-site': "Something bad happened"
+    }
 
     validate_security_config_mock.reset_mock()
     get_params_mock.reset_mock()

+ 8 - 9
ambari-server/src/test/python/stacks/2.0.6/OOZIE/test_oozie_server.py

@@ -527,18 +527,16 @@ class TestOozieServer(RMFTestCase):
                        target = RMFTestCase.TARGET_COMMON_SERVICES
     )
 
-    import status_params
-
-    get_params_mock.assert_called_with(status_params.conf_dir, {'oozie-site.xml': 'XML'})
+    get_params_mock.assert_called_with("/etc/oozie/conf", {'oozie-site.xml': 'XML'})
     build_exp_mock.assert_called_with('oozie-site', props_value_check, props_empty_check, props_read_check)
     put_structured_out_mock.assert_called_with({"securityState": "SECURED_KERBEROS"})
     self.assertTrue(cached_kinit_executor_mock.call_count, 2)
-    cached_kinit_executor_mock.assert_called_with(status_params.kinit_path_local,
-                                                  status_params.oozie_user,
+    cached_kinit_executor_mock.assert_called_with('/usr/bin/kinit',
+                                                  self.config_dict['configurations']['oozie-env']['oozie_user'],
                                                   security_params['oozie-site']['oozie.service.HadoopAccessorService.keytab.file'],
                                                   security_params['oozie-site']['oozie.service.HadoopAccessorService.kerberos.principal'],
-                                                  status_params.hostname,
-                                                  status_params.tmp_dir)
+                                                  self.config_dict['hostname'],
+                                                  '/tmp')
 
     # Testing that the exception throw by cached_executor is caught
     cached_kinit_executor_mock.reset_mock()
@@ -572,8 +570,9 @@ class TestOozieServer(RMFTestCase):
     put_structured_out_mock.assert_called_with({"securityIssuesFound": "Keytab file or principal are not set property."})
 
     # Testing with not empty result_issues
-    result_issues_with_params = {}
-    result_issues_with_params['oozie-site']="Something bad happened"
+    result_issues_with_params = {
+      'oozie-site': "Something bad happened"
+    }
 
     validate_security_config_mock.reset_mock()
     get_params_mock.reset_mock()

+ 5 - 7
ambari-server/src/test/python/stacks/2.0.6/YARN/test_historyserver.py

@@ -561,9 +561,7 @@ class TestHistoryServer(RMFTestCase):
                        target = RMFTestCase.TARGET_COMMON_SERVICES
     )
 
-    import status_params
-
-    get_params_mock.assert_called_with(status_params.hadoop_conf_dir, {'mapred-site.xml': 'XML'})
+    get_params_mock.assert_called_with("/etc/hadoop/conf", {'mapred-site.xml': 'XML'})
     build_exp_mock.assert_called_with('mapred-site',
                                       None,
                                       [
@@ -575,12 +573,12 @@ class TestHistoryServer(RMFTestCase):
                                       None)
     put_structured_out_mock.assert_called_with({"securityState": "SECURED_KERBEROS"})
     self.assertTrue(cached_kinit_executor_mock.call_count, 2)
-    cached_kinit_executor_mock.assert_called_with(status_params.kinit_path_local,
-                                                  status_params.mapred_user,
+    cached_kinit_executor_mock.assert_called_with('/usr/bin/kinit',
+                                                  self.config_dict['configurations']['mapred-env']['mapred_user'],
                                                   security_params['mapred-site']['mapreduce.jobhistory.webapp.spnego-keytab-file'],
                                                   security_params['mapred-site']['mapreduce.jobhistory.webapp.spnego-principal'],
-                                                  status_params.hostname,
-                                                  status_params.tmp_dir)
+                                                  self.config_dict['hostname'],
+                                                  '/tmp')
 
     # Testing that the exception throw by cached_executor is caught
     cached_kinit_executor_mock.reset_mock()

+ 18 - 17
ambari-server/src/test/python/stacks/2.0.6/YARN/test_nodemanager.py

@@ -666,14 +666,15 @@ class TestNodeManager(RMFTestCase):
   @patch("resource_management.libraries.script.Script.put_structured_out")
   def test_security_status(self, put_structured_out_mock, cached_kinit_executor_mock, validate_security_config_mock, get_params_mock, build_exp_mock):
     # Test that function works when is called with correct parameters
-    import status_params
-
-    security_params = {}
-    security_params['yarn-site'] = {}
-    security_params['yarn-site']['yarn.nodemanager.keytab'] = 'path/to/nodemanager/keytab'
-    security_params['yarn-site']['yarn.nodemanager.principal'] = 'nodemanager_principal'
-    security_params['yarn-site']['yarn.nodemanager.webapp.spnego-keytab-file'] = 'path/to/nodemanager/webapp/keytab'
-    security_params['yarn-site']['yarn.nodemanager.webapp.spnego-principal'] = 'nodemanager_webapp_principal'
+
+    security_params = {
+      'yarn-site': {
+        'yarn.nodemanager.keytab': 'path/to/nodemanager/keytab',
+        'yarn.nodemanager.principal': 'nodemanager_principal',
+        'yarn.nodemanager.webapp.spnego-keytab-file': 'path/to/nodemanager/webapp/keytab',
+        'yarn.nodemanager.webapp.spnego-principal': 'nodemanager_webapp_principal'
+      }
+    }
     result_issues = []
     props_value_check = {"yarn.timeline-service.http-authentication.type": "kerberos",
                          "yarn.acl.enable": "true"}
@@ -699,13 +700,12 @@ class TestNodeManager(RMFTestCase):
     build_exp_mock.assert_called_with('yarn-site', props_value_check, props_empty_check, props_read_check)
     put_structured_out_mock.assert_called_with({"securityState": "SECURED_KERBEROS"})
     self.assertTrue(cached_kinit_executor_mock.call_count, 2)
-    cached_kinit_executor_mock.assert_called_with(status_params.kinit_path_local,
-                              status_params.yarn_user,
-                              security_params['yarn-site']['yarn.nodemanager.webapp.spnego-keytab-file'],
-                              security_params['yarn-site']['yarn.nodemanager.webapp.spnego-principal'],
-                              status_params.hostname,
-                              status_params.tmp_dir,
-                              30)
+    cached_kinit_executor_mock.assert_called_with('/usr/bin/kinit',
+                                                  self.config_dict['configurations']['yarn-env']['yarn_user'],
+                                                  security_params['yarn-site']['yarn.nodemanager.webapp.spnego-keytab-file'],
+                                                  security_params['yarn-site']['yarn.nodemanager.webapp.spnego-principal'],
+                                                  self.config_dict['hostname'],
+                                                  '/tmp')
 
     # Testing that the exception throw by cached_executor is caught
     cached_kinit_executor_mock.reset_mock()
@@ -739,8 +739,9 @@ class TestNodeManager(RMFTestCase):
     put_structured_out_mock.assert_called_with({"securityIssuesFound": "Keytab file or principal are not set property."})
 
     # Testing with not empty result_issues
-    result_issues_with_params = {}
-    result_issues_with_params['yarn-site']="Something bad happened"
+    result_issues_with_params = {
+      'yarn-site': "Something bad happened"
+    }
 
     validate_security_config_mock.reset_mock()
     get_params_mock.reset_mock()

+ 18 - 17
ambari-server/src/test/python/stacks/2.0.6/YARN/test_resourcemanager.py

@@ -456,14 +456,15 @@ class TestResourceManager(RMFTestCase):
   @patch("resource_management.libraries.script.Script.put_structured_out")
   def test_security_status(self, put_structured_out_mock, cached_kinit_executor_mock, validate_security_config_mock, get_params_mock, build_exp_mock):
     # Test that function works when is called with correct parameters
-    import status_params
-
-    security_params = {}
-    security_params['yarn-site'] = {}
-    security_params['yarn-site']['yarn.resourcemanager.keytab'] = '/path/to/resourcemanager/keytab'
-    security_params['yarn-site']['yarn.resourcemanager.principal'] = 'nresourcemanager_principal'
-    security_params['yarn-site']['yarn.resourcemanager.webapp.spnego-keytab-file'] = 'path/to/resourcemanager/webapp/keytab'
-    security_params['yarn-site']['yarn.resourcemanager.webapp.spnego-principal'] = 'resourcemanager_webapp_principal'
+
+    security_params = {
+      'yarn-site': {
+        'yarn.resourcemanager.keytab': '/path/to/resourcemanager/keytab',
+        'yarn.resourcemanager.principal': 'nresourcemanager_principal',
+        'yarn.resourcemanager.webapp.spnego-keytab-file': 'path/to/resourcemanager/webapp/keytab',
+        'yarn.resourcemanager.webapp.spnego-principal': 'resourcemanager_webapp_principal'
+      }
+    }
     result_issues = []
     props_value_check = {"yarn.timeline-service.http-authentication.type": "kerberos",
                          "yarn.acl.enable": "true"}
@@ -489,13 +490,12 @@ class TestResourceManager(RMFTestCase):
     build_exp_mock.assert_called_with('yarn-site', props_value_check, props_empty_check, props_read_check)
     put_structured_out_mock.assert_called_with({"securityState": "SECURED_KERBEROS"})
     self.assertTrue(cached_kinit_executor_mock.call_count, 2)
-    cached_kinit_executor_mock.assert_called_with(status_params.kinit_path_local,
-                              status_params.yarn_user,
-                              security_params['yarn-site']['yarn.resourcemanager.webapp.spnego-keytab-file'],
-                              security_params['yarn-site']['yarn.resourcemanager.webapp.spnego-principal'],
-                              status_params.hostname,
-                              status_params.tmp_dir,
-                              30)
+    cached_kinit_executor_mock.assert_called_with('/usr/bin/kinit',
+                                                  self.config_dict['configurations']['yarn-env']['yarn_user'],
+                                                  security_params['yarn-site']['yarn.resourcemanager.webapp.spnego-keytab-file'],
+                                                  security_params['yarn-site']['yarn.resourcemanager.webapp.spnego-principal'],
+                                                  self.config_dict['hostname'],
+                                                  '/tmp')
 
     # Testing that the exception throw by cached_executor is caught
     cached_kinit_executor_mock.reset_mock()
@@ -529,8 +529,9 @@ class TestResourceManager(RMFTestCase):
     put_structured_out_mock.assert_called_with({"securityIssuesFound": "Keytab file or principal are not set property."})
 
     # Testing with not empty result_issues
-    result_issues_with_params = {}
-    result_issues_with_params['yarn-site']="Something bad happened"
+    result_issues_with_params = {
+      'yarn-site': "Something bad happened"
+    }
 
     validate_security_config_mock.reset_mock()
     get_params_mock.reset_mock()

+ 17 - 15
ambari-server/src/test/python/stacks/2.0.6/ZOOKEEPER/test_zookeeper_server.py

@@ -235,13 +235,15 @@ class TestZookeeperServer(RMFTestCase):
   @patch("resource_management.libraries.script.Script.put_structured_out")
   def test_security_status(self, put_structured_out_mock, cached_kinit_executor_mock, validate_security_config_mock, get_params_mock, build_exp_mock):
     # Test that function works when is called with correct parameters
-    import status_params
 
-    security_params = {}
-    security_params['zookeeper_jaas'] = {}
-    security_params['zookeeper_jaas']['Server'] = {}
-    security_params['zookeeper_jaas']['Server']['keyTab'] = 'path/to/zookeeper/service/keytab'
-    security_params['zookeeper_jaas']['Server']['principal'] = 'zookeeper_keytab'
+    security_params = {
+      'zookeeper_jaas': {
+        'Server': {
+          'keyTab': 'path/to/zookeeper/service/keytab',
+          'principal': 'zookeeper_keytab'
+        }
+      }
+    }
     result_issues = []
     props_value_check = None
     props_empty_check = ['Server/keyTab', 'Server/principal']
@@ -261,13 +263,12 @@ class TestZookeeperServer(RMFTestCase):
     build_exp_mock.assert_called_with('zookeeper_jaas', props_value_check, props_empty_check, props_read_check)
     put_structured_out_mock.assert_called_with({"securityState": "SECURED_KERBEROS"})
     self.assertTrue(cached_kinit_executor_mock.call_count, 2)
-    cached_kinit_executor_mock.assert_called_with(status_params.kinit_path_local,
-                              status_params.zk_user,
-                              security_params['zookeeper_jaas']['Server']['keyTab'],
-                              security_params['zookeeper_jaas']['Server']['principal'],
-                              status_params.hostname,
-                              status_params.tmp_dir,
-                              30)
+    cached_kinit_executor_mock.assert_called_with('/usr/bin/kinit',
+                                                  self.config_dict['configurations']['zookeeper-env']['zk_user'],
+                                                  security_params['zookeeper_jaas']['Server']['keyTab'],
+                                                  security_params['zookeeper_jaas']['Server']['principal'],
+                                                  self.config_dict['hostname'],
+                                                  '/tmp')
 
     # Testing that the exception throw by cached_executor is caught
     cached_kinit_executor_mock.reset_mock()
@@ -301,8 +302,9 @@ class TestZookeeperServer(RMFTestCase):
     put_structured_out_mock.assert_called_with({"securityIssuesFound": "Keytab file or principal are not set property."})
 
     # Testing with not empty result_issues
-    result_issues_with_params = {}
-    result_issues_with_params['zookeeper_jaas']="Something bad happened"
+    result_issues_with_params = {
+      'zookeeper_jaas': "Something bad happened"
+    }
 
     validate_security_config_mock.reset_mock()
     get_params_mock.reset_mock()

+ 17 - 15
ambari-server/src/test/python/stacks/2.1/FALCON/test_falcon_server.py

@@ -180,14 +180,15 @@ class TestFalconServer(RMFTestCase):
   @patch("resource_management.libraries.script.Script.put_structured_out")
   def test_security_status(self, put_structured_out_mock, cached_kinit_executor_mock, validate_security_config_mock, get_params_mock, build_exp_mock):
     # Test that function works when is called with correct parameters
-    import status_params
 
-    security_params = {}
-    security_params['startup'] = {}
-    security_params['startup']['*.falcon.service.authentication.kerberos.keytab'] = 'path/to/falcon/service/keytab'
-    security_params['startup']['*.falcon.service.authentication.kerberos.principal'] = 'falcon_service_keytab'
-    security_params['startup']['*.falcon.http.authentication.kerberos.keytab'] = 'path/to/falcon/http/keytab'
-    security_params['startup']['*.falcon.http.authentication.kerberos.principal'] = 'falcon_http_principal'
+    security_params = {
+      'startup': {
+        '*.falcon.service.authentication.kerberos.keytab': 'path/to/falcon/service/keytab',
+        '*.falcon.service.authentication.kerberos.principal': 'falcon_service_keytab',
+        '*.falcon.http.authentication.kerberos.keytab': 'path/to/falcon/http/keytab',
+        '*.falcon.http.authentication.kerberos.principal': 'falcon_http_principal'
+      }
+    }
     result_issues = []
     props_value_check = {"*.falcon.authentication.type": "kerberos",
                            "*.falcon.http.authentication.type": "kerberos"}
@@ -214,12 +215,12 @@ class TestFalconServer(RMFTestCase):
     build_exp_mock.assert_called_with('startup', props_value_check, props_empty_check, props_read_check)
     put_structured_out_mock.assert_called_with({"securityState": "SECURED_KERBEROS"})
     self.assertTrue(cached_kinit_executor_mock.call_count, 2)
-    cached_kinit_executor_mock.assert_called_with(status_params.kinit_path_local,
-                                status_params.falcon_user,
-                                security_params['startup']['*.falcon.http.authentication.kerberos.keytab'],
-                                security_params['startup']['*.falcon.http.authentication.kerberos.principal'],
-                                status_params.hostname,
-                                status_params.tmp_dir)
+    cached_kinit_executor_mock.assert_called_with('/usr/bin/kinit',
+                                                  self.config_dict['configurations']['falcon-env']['falcon_user'],
+                                                  security_params['startup']['*.falcon.http.authentication.kerberos.keytab'],
+                                                  security_params['startup']['*.falcon.http.authentication.kerberos.principal'],
+                                                  self.config_dict['hostname'],
+                                                  '/tmp')
 
     # Testing that the exception throw by cached_executor is caught
     cached_kinit_executor_mock.reset_mock()
@@ -253,8 +254,9 @@ class TestFalconServer(RMFTestCase):
     put_structured_out_mock.assert_called_with({"securityIssuesFound": "Keytab file or principal are not set property."})
 
     # Testing with not empty result_issues
-    result_issues_with_params = {}
-    result_issues_with_params['startup']="Something bad happened"
+    result_issues_with_params = {
+      'startup': "Something bad happened"
+    }
 
     validate_security_config_mock.reset_mock()
     get_params_mock.reset_mock()

+ 8 - 8
ambari-server/src/test/python/stacks/2.1/HIVE/test_hive_metastore.py

@@ -341,7 +341,6 @@ class TestHiveMetastore(RMFTestCase):
   @patch("resource_management.libraries.script.Script.put_structured_out")
   def test_security_status(self, put_structured_out_mock, cached_kinit_executor_mock, validate_security_config_mock, get_params_mock, build_exp_mock):
     # Test that function works when is called with correct parameters
-    import status_params
 
     security_params = {
       'hive-site': {
@@ -377,16 +376,16 @@ class TestHiveMetastore(RMFTestCase):
                        target = RMFTestCase.TARGET_COMMON_SERVICES
     )
 
-    get_params_mock.assert_called_with(status_params.hive_conf_dir, {'hive-site.xml': "XML"})
+    get_params_mock.assert_called_with("/etc/hive/conf", {'hive-site.xml': "XML"})
     build_exp_mock.assert_called_with('hive-site', props_value_check, props_empty_check, props_read_check)
     put_structured_out_mock.assert_called_with({"securityState": "SECURED_KERBEROS"})
     self.assertTrue(cached_kinit_executor_mock.call_count, 2)
-    cached_kinit_executor_mock.assert_called_with(status_params.kinit_path_local,
-                                                  status_params.hive_user,
+    cached_kinit_executor_mock.assert_called_with('/usr/bin/kinit',
+                                                  self.config_dict['configurations']['hive-env']['hive_user'],
                                                   security_params['hive-site']['hive.metastore.kerberos.keytab.file'],
                                                   security_params['hive-site']['hive.metastore.kerberos.principal'],
-                                                  status_params.hostname,
-                                                  status_params.tmp_dir)
+                                                  self.config_dict['hostname'],
+                                                  '/tmp')
 
     # Testing that the exception throw by cached_executor is caught
     cached_kinit_executor_mock.reset_mock()
@@ -420,8 +419,9 @@ class TestHiveMetastore(RMFTestCase):
     put_structured_out_mock.assert_called_with({"securityIssuesFound": "Keytab file or principal are not set property."})
 
     # Testing with not empty result_issues
-    result_issues_with_params = {}
-    result_issues_with_params['hive-site']="Something bad happened"
+    result_issues_with_params = {
+      'hive-site': "Something bad happened"
+    }
 
     validate_security_config_mock.reset_mock()
     get_params_mock.reset_mock()

+ 18 - 17
ambari-server/src/test/python/stacks/2.1/STORM/test_storm_drpc_server.py

@@ -159,14 +159,15 @@ class TestStormDrpcServer(TestStormBase):
   @patch("resource_management.libraries.script.Script.put_structured_out")
   def test_security_status(self, put_structured_out_mock, cached_kinit_executor_mock, validate_security_config_mock, get_params_mock, build_exp_mock):
     # Test that function works when is called with correct parameters
-    import status_params
-
-    security_params = {}
-    security_params = {}
-    security_params['storm_jaas'] = {}
-    security_params['storm_jaas']['StormServer'] = {}
-    security_params['storm_jaas']['StormServer']['keyTab'] = 'path/to/storm/service/keytab'
-    security_params['storm_jaas']['StormServer']['principal'] = 'storm_keytab'
+
+    security_params = {
+      'storm_jaas': {
+        'StormServer': {
+          'keyTab': 'path/to/storm/service/keytab',
+          'principal': 'storm_keytab'
+        }
+      }
+    }
     result_issues = []
 
     props_value_check = None
@@ -187,13 +188,12 @@ class TestStormDrpcServer(TestStormBase):
     build_exp_mock.assert_called_with('storm_jaas', props_value_check, props_empty_check, props_read_check)
     put_structured_out_mock.assert_called_with({"securityState": "SECURED_KERBEROS"})
     self.assertTrue(cached_kinit_executor_mock.call_count, 2)
-    cached_kinit_executor_mock.assert_called_with(status_params.kinit_path_local,
-                              status_params.storm_user,
-                              security_params['storm_jaas']['StormServer']['keyTab'],
-                              security_params['storm_jaas']['StormServer']['principal'],
-                              status_params.hostname,
-                              status_params.tmp_dir,
-                              30)
+    cached_kinit_executor_mock.assert_called_with('/usr/bin/kinit',
+                                                  self.config_dict['configurations']['storm-env']['storm_user'],
+                                                  security_params['storm_jaas']['StormServer']['keyTab'],
+                                                  security_params['storm_jaas']['StormServer']['principal'],
+                                                  self.config_dict['hostname'],
+                                                  '/tmp')
 
     # Testing that the exception throw by cached_executor is caught
     cached_kinit_executor_mock.reset_mock()
@@ -227,8 +227,9 @@ class TestStormDrpcServer(TestStormBase):
     put_structured_out_mock.assert_called_with({"securityIssuesFound": "Keytab file or principal are not set property."})
 
     # Testing with not empty result_issues
-    result_issues_with_params = {}
-    result_issues_with_params['storm_jaas']="Something bad happened"
+    result_issues_with_params = {
+      'storm_jaas': "Something bad happened"
+    }
 
     validate_security_config_mock.reset_mock()
     get_params_mock.reset_mock()

+ 18 - 18
ambari-server/src/test/python/stacks/2.1/STORM/test_storm_nimbus.py

@@ -158,14 +158,15 @@ class TestStormNimbus(TestStormBase):
   @patch("resource_management.libraries.script.Script.put_structured_out")
   def test_security_status(self, put_structured_out_mock, cached_kinit_executor_mock, validate_security_config_mock, get_params_mock, build_exp_mock):
     # Test that function works when is called with correct parameters
-    import status_params
-
-    security_params = {}
-    security_params = {}
-    security_params['storm_jaas'] = {}
-    security_params['storm_jaas']['StormServer'] = {}
-    security_params['storm_jaas']['StormServer']['keyTab'] = 'path/to/storm/service/keytab'
-    security_params['storm_jaas']['StormServer']['principal'] = 'storm_keytab'
+
+    security_params = {
+      'storm_jaas': {
+        'StormServer': {
+          'keyTab': 'path/to/storm/service/keytab',
+          'principal': 'storm_keytab'
+        }
+      }
+    }
     result_issues = []
 
     props_value_check = None
@@ -186,13 +187,12 @@ class TestStormNimbus(TestStormBase):
     build_exp_mock.assert_called_with('storm_jaas', props_value_check, props_empty_check, props_read_check)
     put_structured_out_mock.assert_called_with({"securityState": "SECURED_KERBEROS"})
     self.assertTrue(cached_kinit_executor_mock.call_count, 2)
-    cached_kinit_executor_mock.assert_called_with(status_params.kinit_path_local,
-                              status_params.storm_user,
-                              security_params['storm_jaas']['StormServer']['keyTab'],
-                              security_params['storm_jaas']['StormServer']['principal'],
-                              status_params.hostname,
-                              status_params.tmp_dir,
-                              30)
+    cached_kinit_executor_mock.assert_called_with('/usr/bin/kinit',
+                                                  self.config_dict['configurations']['storm-env']['storm_user'],
+                                                  security_params['storm_jaas']['StormServer']['keyTab'],
+                                                  security_params['storm_jaas']['StormServer']['principal'],
+                                                  self.config_dict['hostname'],
+                                                  '/tmp')
 
     # Testing that the exception throw by cached_executor is caught
     cached_kinit_executor_mock.reset_mock()
@@ -226,9 +226,9 @@ class TestStormNimbus(TestStormBase):
     put_structured_out_mock.assert_called_with({"securityIssuesFound": "Keytab file or principal are not set property."})
 
     # Testing with not empty result_issues
-    result_issues_with_params = {}
-    result_issues_with_params['storm_jaas']="Something bad happened"
-
+    result_issues_with_params = {
+      'storm_jaas': "Something bad happened"
+    }
     validate_security_config_mock.reset_mock()
     get_params_mock.reset_mock()
     validate_security_config_mock.return_value = result_issues_with_params

+ 12 - 14
ambari-server/src/test/python/stacks/2.1/STORM/test_storm_ui_server.py

@@ -157,11 +157,12 @@ class TestStormUiServer(TestStormBase):
     # Test that function works when is called with correct parameters
     result_issues = []
 
-    security_params = {}
-    security_params['storm_ui'] = {}
-    security_params['storm_ui']['storm_ui_principal_name'] = 'HTTP/_HOST'
-    security_params['storm_ui']['storm_ui_keytab'] = '/etc/security/keytabs/spnego.service.keytab'
-
+    security_params = {
+      'storm_ui': {
+        'storm_ui_principal_name': 'HTTP/_HOST',
+        'storm_ui_keytab': '/etc/security/keytabs/spnego.service.keytab'
+      }
+    }
     props_value_check = None
     props_empty_check = ['storm_ui_principal_name', 'storm_ui_keytab']
     props_read_check = ['storm_ui_keytab']
@@ -176,19 +177,16 @@ class TestStormUiServer(TestStormBase):
                        target = RMFTestCase.TARGET_COMMON_SERVICES
     )
 
-    import status_params
-
     build_exp_mock.assert_called_with('storm_ui', props_value_check, props_empty_check, props_read_check)
     put_structured_out_mock.assert_called_with({"securityState": "SECURED_KERBEROS"})
     self.assertTrue(cached_kinit_executor_mock.call_count, 2)
 
-    cached_kinit_executor_mock.assert_called_with(status_params.kinit_path_local,
-                                status_params.storm_user,
-                                security_params['storm_ui']['storm_ui_keytab'],
-                                security_params['storm_ui']['storm_ui_principal_name'],
-                                status_params.hostname,
-                                status_params.tmp_dir,
-                                30)
+    cached_kinit_executor_mock.assert_called_with('/usr/bin/kinit',
+                                                  self.config_dict['configurations']['storm-env']['storm_user'],
+                                                  security_params['storm_ui']['storm_ui_keytab'],
+                                                  security_params['storm_ui']['storm_ui_principal_name'],
+                                                  self.config_dict['hostname'],
+                                                  '/tmp')
 
     # Testing that the exception throw by cached_executor is caught
     cached_kinit_executor_mock.reset_mock()

+ 16 - 15
ambari-server/src/test/python/stacks/2.1/YARN/test_apptimelineserver.py

@@ -239,14 +239,15 @@ class TestAppTimelineServer(RMFTestCase):
   @patch("resource_management.libraries.script.Script.put_structured_out")
   def test_security_status(self, put_structured_out_mock, cached_kinit_executor_mock, validate_security_config_mock, get_params_mock, build_exp_mock):
     # Test that function works when is called with correct parameters
-    import status_params
-
-    security_params = {}
-    security_params['yarn-site'] = {}
-    security_params['yarn-site']['yarn.timeline-service.keytab'] = '/path/to/applicationtimeline/keytab'
-    security_params['yarn-site']['yarn.timeline-service.principal'] = 'applicationtimeline_principal'
-    security_params['yarn-site']['yarn.timeline-service.http-authentication.kerberos.keytab'] = 'path/to/timeline/kerberos/keytab'
-    security_params['yarn-site']['yarn.timeline-service.http-authentication.kerberos.principal'] = 'timeline_principal'
+
+    security_params = {
+      'yarn-site': {
+        'yarn.timeline-service.keytab': '/path/to/applicationtimeline/keytab',
+        'yarn.timeline-service.principal': 'applicationtimeline_principal',
+        'yarn.timeline-service.http-authentication.kerberos.keytab': 'path/to/timeline/kerberos/keytab',
+        'yarn.timeline-service.http-authentication.kerberos.principal': 'timeline_principal'
+      }
+    }
     result_issues = []
     props_value_check = {"yarn.timeline-service.enabled": "true",
                          "yarn.timeline-service.http-authentication.type": "kerberos",
@@ -273,13 +274,12 @@ class TestAppTimelineServer(RMFTestCase):
     build_exp_mock.assert_called_with('yarn-site', props_value_check, props_empty_check, props_read_check)
     put_structured_out_mock.assert_called_with({"securityState": "SECURED_KERBEROS"})
     self.assertTrue(cached_kinit_executor_mock.call_count, 2)
-    cached_kinit_executor_mock.assert_called_with(status_params.kinit_path_local,
-                                                  status_params.yarn_user,
+    cached_kinit_executor_mock.assert_called_with('/usr/bin/kinit',
+                                                  self.config_dict['configurations']['yarn-env']['yarn_user'],
                                                   security_params['yarn-site']['yarn.timeline-service.http-authentication.kerberos.keytab'],
                                                   security_params['yarn-site']['yarn.timeline-service.http-authentication.kerberos.principal'],
-                                                  status_params.hostname,
-                                                  status_params.tmp_dir,
-                                                  30)
+                                                  self.config_dict['hostname'],
+                                                  '/tmp')
 
     # Testing that the exception throw by cached_executor is caught
     cached_kinit_executor_mock.reset_mock()
@@ -313,8 +313,9 @@ class TestAppTimelineServer(RMFTestCase):
     put_structured_out_mock.assert_called_with({"securityIssuesFound": "Keytab file or principal are not set property."})
 
     # Testing with not empty result_issues
-    result_issues_with_params = {}
-    result_issues_with_params['yarn-site']="Something bad happened"
+    result_issues_with_params = {
+      'yarn-site': "Something bad happened"
+    }
 
     validate_security_config_mock.reset_mock()
     get_params_mock.reset_mock()

+ 4 - 6
ambari-server/src/test/python/stacks/2.2/KNOX/test_knox_gateway.py

@@ -128,18 +128,16 @@ class TestKnoxGateway(RMFTestCase):
                        target = RMFTestCase.TARGET_COMMON_SERVICES
     )
 
-    import status_params
-
     self.assertTrue(build_exp_mock.call_count, 2)
     build_exp_mock.assert_called_with('gateway-site', {"gateway.hadoop.kerberos.secured": "true"}, None, None)
     put_structured_out_mock.assert_called_with({"securityState": "SECURED_KERBEROS"})
     self.assertTrue(cached_kinit_executor_mock.call_count, 1)
-    cached_kinit_executor_mock.assert_called_with(status_params.kinit_path_local,
-                                                  status_params.knox_user,
+    cached_kinit_executor_mock.assert_called_with('/usr/bin/kinit',
+                                                  self.config_dict['configurations']['knox-env']['knox_user'],
                                                   security_params['krb5JAASLogin']['keytab'],
                                                   security_params['krb5JAASLogin']['principal'],
-                                                  status_params.hostname,
-                                                  status_params.temp_dir)
+                                                  self.config_dict['hostname'],
+                                                  '/tmp')
 
     # Testing that the exception throw by cached_executor is caught
     cached_kinit_executor_mock.reset_mock()