Jelajahi Sumber

AMBARI-9962. HostCleanup.py does not remove packages (dlysnichenko)

Lisnichenko Dmitro 10 tahun lalu
induk
melakukan
844687f0c8

+ 1 - 1
ambari-agent/src/main/python/ambari_agent/HostCleanup.py

@@ -477,7 +477,7 @@ class HostCleanup:
   # Run command as sudoer by default, if root no issues
   def run_os_command(self, cmd, runWithSudo=True):
     if runWithSudo:
-      cmd = AMBARI_SUDO_BINARY + cmd
+      cmd = "/var/lib/ambari-agent/"+AMBARI_SUDO_BINARY + " " + cmd
     logger.info('Executing command: ' + str(cmd))
     if type(cmd) == str:
       cmd = shlex.split(cmd)

+ 1 - 1
ambari-agent/src/test/python/resource_management/TestUserResource.py

@@ -183,7 +183,7 @@ class TestUserResource(TestCase):
       user = User("mapred", action = "create", groups = ['1','2','3'], 
           shell = "/bin/bash")
 
-    popen_mock.assert_called_with(['/bin/bash', '--login', '--noprofile', '-c', "ambari-sudo.sh  PATH=/bin -H -E usermod -G 1,2,3 -s /bin/bash mapred"], shell=False, preexec_fn=None, stderr=-2, stdout=5, bufsize=1, env={'PATH': '/bin'}, cwd=None)
+    popen_mock.assert_called_with(['/bin/bash', '--login', '--noprofile', '-c', 'ambari-sudo.sh  PATH=/bin -H -E usermod -G 1,2,3,hadoop -s /bin/bash mapred'], shell=False, preexec_fn=None, stderr=-2, stdout=5, env={'PATH': '/bin'}, bufsize=1, cwd=None)
     self.assertEqual(popen_mock.call_count, 1)
 
   @patch.object(subprocess, "Popen")

+ 1 - 1
ambari-common/src/main/python/ambari_commons/constants.py

@@ -18,4 +18,4 @@ See the License for the specific language governing permissions and
 limitations under the License.
 '''
 
-AMBARI_SUDO_BINARY = "ambari-sudo.sh"
+AMBARI_SUDO_BINARY = "ambari-sudo.sh"