backend: Rename RunRemoteCommand to RunRestrictedCmd
authorMichael Hanselmann <hansmi@google.com>
Tue, 20 Nov 2012 04:53:12 +0000 (05:53 +0100)
committerMichael Hanselmann <hansmi@google.com>
Wed, 21 Nov 2012 13:43:18 +0000 (14:43 +0100)
As per Iustin Pop's suggestion in <20121115131730.GX824@google.com> on
<ganeti-devel@googlegroups.com>.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

lib/backend.py
lib/server/noded.py
test/ganeti.backend_unittest.py

index 59484b8..6e3e918 100644 (file)
@@ -3707,7 +3707,7 @@ def _PrepareRemoteCommand(path, cmd,
   return _verify_cmd(path, cmd)
 
 
-def RunRemoteCommand(cmd,
+def RunRestrictedCmd(cmd,
                      _lock_timeout=_RCMD_LOCK_TIMEOUT,
                      _lock_file=pathutils.RESTRICTED_COMMANDS_LOCK_FILE,
                      _path=pathutils.RESTRICTED_COMMANDS_DIR,
index 77a3964..e04a2c7 100644 (file)
@@ -817,7 +817,7 @@ class NodeRequestHandler(http.server.HttpServerHandler):
     """
     (cmd, ) = params
 
-    return backend.RunRemoteCommand(cmd)
+    return backend.RunRestrictedCmd(cmd)
 
   @staticmethod
   def perspective_write_ssconf_files(params):
index bcf933e..cdc0521 100755 (executable)
@@ -274,7 +274,7 @@ def _GenericRemoteCommandError(cmd):
   return "Executing command '%s' failed" % cmd
 
 
-class TestRunRemoteCommand(unittest.TestCase):
+class TestRunRestrictedCmd(unittest.TestCase):
   def setUp(self):
     self.tmpdir = tempfile.mkdtemp()
 
@@ -286,7 +286,7 @@ class TestRunRemoteCommand(unittest.TestCase):
     sleep_fn = testutils.CallCounter(_SleepForRemoteCommand)
     self.assertFalse(os.path.exists(lockfile))
     self.assertRaises(backend.RPCFail,
-                      backend.RunRemoteCommand, "test",
+                      backend.RunRestrictedCmd, "test",
                       _lock_timeout=NotImplemented,
                       _lock_file=lockfile,
                       _path=NotImplemented,
@@ -302,7 +302,7 @@ class TestRunRemoteCommand(unittest.TestCase):
 
     result = False
     try:
-      backend.RunRemoteCommand("test22717",
+      backend.RunRestrictedCmd("test22717",
                                _lock_timeout=0.1,
                                _lock_file=lockfile,
                                _path=NotImplemented,
@@ -341,7 +341,7 @@ class TestRunRemoteCommand(unittest.TestCase):
     prepare_fn = testutils.CallCounter(self._PrepareRaisingException)
 
     try:
-      backend.RunRemoteCommand("test23122",
+      backend.RunRestrictedCmd("test23122",
                                _lock_timeout=1.0, _lock_file=lockfile,
                                _path=NotImplemented, _runcmd_fn=NotImplemented,
                                _sleep_fn=sleep_fn, _prepare_fn=prepare_fn,
@@ -366,7 +366,7 @@ class TestRunRemoteCommand(unittest.TestCase):
     prepare_fn = testutils.CallCounter(self._PrepareFails)
 
     try:
-      backend.RunRemoteCommand("test29327",
+      backend.RunRestrictedCmd("test29327",
                                _lock_timeout=1.0, _lock_file=lockfile,
                                _path=NotImplemented, _runcmd_fn=NotImplemented,
                                _sleep_fn=sleep_fn, _prepare_fn=prepare_fn,
@@ -417,7 +417,7 @@ class TestRunRemoteCommand(unittest.TestCase):
     runcmd_fn = testutils.CallCounter(fn)
 
     try:
-      backend.RunRemoteCommand("test3079",
+      backend.RunRestrictedCmd("test3079",
                                _lock_timeout=1.0, _lock_file=lockfile,
                                _path=self.tmpdir, _runcmd_fn=runcmd_fn,
                                _sleep_fn=sleep_fn, _prepare_fn=prepare_fn,
@@ -454,7 +454,7 @@ class TestRunRemoteCommand(unittest.TestCase):
     prepare_fn = testutils.CallCounter(self._SuccessfulPrepare)
     runcmd_fn = testutils.CallCounter(fn)
 
-    result = backend.RunRemoteCommand("test5667",
+    result = backend.RunRestrictedCmd("test5667",
                                       _lock_timeout=1.0, _lock_file=lockfile,
                                       _path=self.tmpdir, _runcmd_fn=runcmd_fn,
                                       _sleep_fn=sleep_fn,
@@ -468,7 +468,7 @@ class TestRunRemoteCommand(unittest.TestCase):
 
   def testCommandsDisabled(self):
     try:
-      backend.RunRemoteCommand("test",
+      backend.RunRestrictedCmd("test",
                                _lock_timeout=NotImplemented,
                                _lock_file=NotImplemented,
                                _path=NotImplemented,