Change the name of the delivered dummynet box image.
authorMarta Carbone <marta@prova.iet.unipi.it>
Wed, 3 Sep 2008 17:22:28 +0000 (17:22 +0000)
committerMarta Carbone <marta@prova.iet.unipi.it>
Wed, 3 Sep 2008 17:22:28 +0000 (17:22 +0000)
PLC/Methods/GetDummyBoxMedium.py

index c33d136..3030859 100644 (file)
@@ -85,11 +85,6 @@ class GetDummyBoxMedium(Method):
     # Here starts the execution of the call
     def call(self, auth, dummybox_id):
 
-        # set file names
-        IMAGE_NAME = str(WORK_DIR) + "/dummybox_" + str(dummybox_id) + ".bin"
-        configfile = WORK_DIR + '/dummybox.conf'
-        lockfile =  WORK_DIR + '/lockfile'
-
         # Check for dummybox existence
         dummyboxes = DummyBoxes(self.api, [dummybox_id])
         if not dummyboxes:
@@ -97,6 +92,12 @@ class GetDummyBoxMedium(Method):
 
         dummybox = dummyboxes[0]
 
+        # Get the dummynet box hostname
+        dummybox_hostname = dummybox['hostname']
+        IMAGE_NAME = str(WORK_DIR) + "/dummybox_" + dummybox_hostname + ".bin"
+        configfile = WORK_DIR + '/dummybox.conf'
+        lockfile =  WORK_DIR + '/lockfile'
+
         # Permission checks
         assert self.caller is not None
         if 'admin' not in self.caller['roles']: