Prechádzať zdrojové kódy

AMBARI-16386: HAWQ Password handling updated (bhuvnesh2703)

Bhuvnesh Chaudhary 9 rokov pred
rodič
commit
215ffc334f

+ 1 - 1
ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/common.py

@@ -51,7 +51,7 @@ def __create_hawq_user():
 
   User(hawq_constants.hawq_user,
        gid=hawq_constants.hawq_group,
-       password=crypt.crypt(params.hawq_password, "salt"),
+       password=crypt.crypt(params.hawq_password, "$1$salt$"),
        groups=[hawq_constants.hawq_group, params.user_group],
        ignore_failures=True)
 

+ 2 - 2
ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/master_helper.py

@@ -16,8 +16,8 @@ See the License for the specific language governing permissions and
 limitations under the License.
 """
 import os
-
 import sys
+import json
 from resource_management.core.source import InlineTemplate
 from resource_management.core.logger import Logger
 from resource_management.libraries.functions.format import format
@@ -50,7 +50,7 @@ def setup_passwordless_ssh():
   failed_hosts = []
   for host in params.hawq_all_hosts:
     try:
-      utils.exec_hawq_operation("ssh-exkeys", format('-h {hawq_host} -p {hawq_password!p}', hawq_host=host, hawq_password=params.hawq_password))
+      utils.exec_hawq_operation("ssh-exkeys", format('-h {hawq_host} -p {hawq_password!p}', hawq_host=host, hawq_password=json.dumps(params.hawq_password)))
     except:
       failed_hosts.append(host)
 

+ 3 - 3
ambari-server/src/test/python/stacks/2.3/HAWQ/test_hawqmaster.py

@@ -18,7 +18,7 @@ See the License for the specific language governing permissions and
 limitations under the License.
 '''
 
-import os, json
+import os, json, crypt
 import  resource_management.libraries.functions
 
 from mock.mock import MagicMock, call, patch
@@ -52,7 +52,7 @@ class TestHawqMaster(RMFTestCase):
         gid = self.GPADMIN,
         groups = ['gpadmin', u'hadoop'],
         ignore_failures = True,
-        password = 'saNIJ3hOyqasU'
+        password = crypt.crypt(self.config_dict['configurations']['hawq-env']['hawq_password'], "$1$salt$")
         )
 
     self.assertResourceCalled('Group', self.POSTGRES,
@@ -423,4 +423,4 @@ class TestHawqMaster(RMFTestCase):
         logoutput = True
         )
 
-    self.assertNoMoreResources()
+    self.assertNoMoreResources()

+ 2 - 1
ambari-server/src/test/python/stacks/2.3/HAWQ/test_hawqsegment.py

@@ -18,6 +18,7 @@ See the License for the specific language governing permissions and
 limitations under the License.
 '''
 
+import os, json, crypt
 from mock.mock import MagicMock, call, patch
 from stacks.utils.RMFTestCase import *
 
@@ -37,7 +38,7 @@ class TestHawqSegment(RMFTestCase):
         gid = self.GPADMIN,
         groups = [self.GPADMIN, u'hadoop'],
         ignore_failures = True,
-        password = 'saNIJ3hOyqasU'
+        password = crypt.crypt(self.getConfig()['configurations']['hawq-env']['hawq_password'], "$1$salt$")
         )
 
     self.assertResourceCalled('Group', self.POSTGRES,

+ 2 - 1
ambari-server/src/test/python/stacks/2.3/HAWQ/test_hawqstandby.py

@@ -18,6 +18,7 @@ See the License for the specific language governing permissions and
 limitations under the License.
 '''
 
+import os, json, crypt
 from mock.mock import MagicMock, call, patch
 from stacks.utils.RMFTestCase import *
 
@@ -38,7 +39,7 @@ class TestHawqStandby(RMFTestCase):
         gid = self.GPADMIN,
         groups = [self.GPADMIN, u'hadoop'],
         ignore_failures = True,
-        password = 'saNIJ3hOyqasU'
+        password = crypt.crypt(self.getConfig()['configurations']['hawq-env']['hawq_password'], "$1$salt$")
         )
 
     self.assertResourceCalled('Group', self.POSTGRES,