- # Invoke the actual deployment
- super(LinuxCCNR, self).deploy()
-
- # As soon as deployment is finished, we launch the ccnr
- # command ( we don't want to lose time ccnr later on )
- if self._state == ResourceState.READY:
- self._start_in_background()
- self._running = True
-
- def start(self):
- # CCND should already be started by now.
- # Nothing to do but to set the state to STARTED
- if self._running:
- self._start_time = strfnow()
- self._state = ResourceState.STARTED
+ if not self.get("command"):
+ self.set("command", self._start_command)
+
+ if not self.get("env"):
+ self.set("env", self._environment)
+
+ command = self.get("command")
+
+ self.info("Deploying command '%s' " % command)
+
+ self.do_discover()
+ self.do_provision()
+
+ self.set_ready()
+
+ def upload_start_command(self):
+ command = self.get("command")
+ env = self.get("env")
+
+ if self.get("repoFile1"):
+ # upload repoFile1
+ local_file = self.get("repoFile1")
+ remote_file = "${RUN_HOME}/repoFile1"
+ remote_file = self.replace_paths(remote_file)
+ self.node.upload(local_file,
+ remote_file,
+ overwrite = False)
+
+ # We want to make sure the repository is running
+ # before the experiment starts.
+ # Run the command as a bash script in background,
+ # in the host ( but wait until the command has
+ # finished to continue )
+ env = self.replace_paths(env)
+ command = self.replace_paths(command)
+
+ shfile = os.path.join(self.app_home, "start.sh")
+ self.node.run_and_wait(command, self.run_home,
+ shfile = shfile,
+ overwrite = False,
+ env = env)
+
+ def do_start(self):
+ if self.state == ResourceState.READY:
+ command = self.get("command")
+ self.info("Starting command '%s'" % command)
+
+ self.set_started()