Procházet zdrojové kódy

AMBARI-5501. Hdfs Service Start fail due bad snmpd usage for Ubuntu (aonishuk)

Andrew Onishuk před 11 roky
rodič
revize
04dc302839

+ 12 - 3
ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/scripts/shared_initialization.py

@@ -183,6 +183,15 @@ def init_services():
   File(os.path.join(params.snmp_conf_dir, 'snmpd.conf'),
        content=Template("snmpd.conf.j2"))
   # enable snmpd
-  Execute( "service snmpd start; chkconfig snmpd on",
-    path = "/usr/local/bin/:/bin/:/sbin/"
-  )
+  Execute( "service snmpd start",
+  )
+  
+  if System.get_instance().os_family == "debian":
+    Execute( "update-rc.d snmpd defaults",
+    )    
+  else:
+    Execute( "chkconfig snmpd on",
+    )
+      
+  
+  

+ 6 - 4
ambari-server/src/test/python/stacks/2.0.6/hooks/before-START/test_before_start.py

@@ -99,8 +99,9 @@ class TestHookBeforeStart(RMFTestCase):
     self.assertResourceCalled('File', '/etc/snmp/snmpd.conf',
                               content = Template('snmpd.conf.j2'),
                               )
-    self.assertResourceCalled('Execute', 'service snmpd start; chkconfig snmpd on',
-                              path = ['/usr/local/bin/:/bin/:/sbin/'],
+    self.assertResourceCalled('Execute', 'service snmpd start',
+                              )
+    self.assertResourceCalled('Execute', 'chkconfig snmpd on',
                               )
     self.assertNoMoreResources()
 
@@ -180,7 +181,8 @@ class TestHookBeforeStart(RMFTestCase):
     self.assertResourceCalled('File', '/etc/snmp/snmpd.conf',
                               content = Template('snmpd.conf.j2'),
                               )
-    self.assertResourceCalled('Execute', 'service snmpd start; chkconfig snmpd on',
-                            path = ['/usr/local/bin/:/bin/:/sbin/'],
+    self.assertResourceCalled('Execute', 'service snmpd start',
+                            )
+    self.assertResourceCalled('Execute', 'chkconfig snmpd on',
                             )
     self.assertNoMoreResources()