You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by al...@apache.org on 2015/04/03 23:10:50 UTC

ambari git commit: AMBARI-10317. Knox gateway fails to restart on Ubuntu 12.04 after system restart (alejandro)

Repository: ambari
Updated Branches:
  refs/heads/trunk ebe3c659a -> c9033c986


AMBARI-10317. Knox gateway fails to restart on Ubuntu 12.04 after system restart (alejandro)


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

Branch: refs/heads/trunk
Commit: c9033c986c7e2f4d8853c35abfa0bffb75d70e85
Parents: ebe3c65
Author: Alejandro Fernandez <af...@hortonworks.com>
Authored: Thu Apr 2 14:14:33 2015 -0700
Committer: Alejandro Fernandez <af...@hortonworks.com>
Committed: Fri Apr 3 14:10:41 2015 -0700

----------------------------------------------------------------------
 .../KNOX/0.5.0.2.2/package/scripts/knox.py      | 22 ++++++++------------
 .../python/stacks/2.2/KNOX/test_knox_gateway.py | 16 +++++++++++++-
 2 files changed, 24 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/c9033c98/ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/package/scripts/knox.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/package/scripts/knox.py b/ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/package/scripts/knox.py
index 108ebb2..ab25187 100644
--- a/ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/package/scripts/knox.py
+++ b/ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/package/scripts/knox.py
@@ -60,12 +60,13 @@ def knox():
 def knox():
     import params
 
-    Directory(params.knox_conf_dir,
-              owner = params.knox_user,
-              group = params.knox_group,
-              recursive = True
-    )
-
+    directories = [params.knox_data_dir, params.knox_logs_dir, params.knox_pid_dir, params.knox_conf_dir]
+    for directory in directories:
+      Directory(directory,
+                owner = params.knox_user,
+                group = params.knox_group,
+                recursive = True
+      )
 
     XmlConfig("gateway-site.xml",
               conf_dir=params.knox_conf_dir,
@@ -93,16 +94,11 @@ def knox():
                       template_tag = None
       )
 
-    dirs_to_chown = (params.knox_data_dir, params.knox_logs_dir, params.knox_logs_dir, params.knox_pid_dir, params.knox_conf_dir)
-    cmd = ('chown','-R',format('{knox_user}:{knox_group}'))+dirs_to_chown
+    dirs_to_chown = tuple(directories)
+    cmd = ('chown','-R',format('{knox_user}:{knox_group}')) + dirs_to_chown
     Execute(cmd,
             sudo = True,
     )
-    
-    #File([params.knox_data_dir, params.knox_logs_dir, params.knox_logs_dir, params.knox_pid_dir, params.knox_conf_dir],
-    #     owner = params.knox_user,
-    #     group = params.knox_group
-    #)
 
     cmd = format('{knox_client_bin} create-master --master {knox_master_secret!p}')
     master_secret_exist = as_user(format('test -f {knox_master_secret_path}'), params.knox_user)

http://git-wip-us.apache.org/repos/asf/ambari/blob/c9033c98/ambari-server/src/test/python/stacks/2.2/KNOX/test_knox_gateway.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.2/KNOX/test_knox_gateway.py b/ambari-server/src/test/python/stacks/2.2/KNOX/test_knox_gateway.py
index b1d9888..c5ebbc0 100644
--- a/ambari-server/src/test/python/stacks/2.2/KNOX/test_knox_gateway.py
+++ b/ambari-server/src/test/python/stacks/2.2/KNOX/test_knox_gateway.py
@@ -34,6 +34,21 @@ class TestKnoxGateway(RMFTestCase):
                        target = RMFTestCase.TARGET_COMMON_SERVICES
     )
 
+    self.assertResourceCalled('Directory', '/var/lib/knox/data',
+                              owner = 'knox',
+                              group = 'knox',
+                              recursive = True
+    )
+    self.assertResourceCalled('Directory', '/var/log/knox',
+                              owner = 'knox',
+                              group = 'knox',
+                              recursive = True
+    )
+    self.assertResourceCalled('Directory', '/var/run/knox',
+                              owner = 'knox',
+                              group = 'knox',
+                              recursive = True
+    )
     self.assertResourceCalled('Directory', '/etc/knox/conf',
                               owner = 'knox',
                               group = 'knox',
@@ -64,7 +79,6 @@ class TestKnoxGateway(RMFTestCase):
      'knox:knox',
      '/var/lib/knox/data',
      '/var/log/knox',
-     '/var/log/knox',
      '/var/run/knox',
      '/etc/knox/conf'),
         sudo = True,