self.node.upload(stdin, dst, overwrite = False, text = True)
# create "stdin" symlink on ${APP_HOME} directory
- command = "( cd %s ; ln -s %s stdin )" % ( self.app_home, dst)
+ command = "( cd %(app_home)s ; [ ! -f stdin ] && ln -s %(stdin)s stdin )" % ({
+ "app_home": self.app_home,
+ "stdin": dst })
return command
env = self.get("env")
if command:
+ self.info("Uploading command '%s'" % command)
+
# We want to make sure the content is published
# before the experiment starts.
# Run the command as a bash script in the background,
env = self.replace_paths(env)
command = self.replace_paths(command)
- (out, err), proc = self.execute_command(command, env)
+ (out, err), proc = self.execute_command(command, env,
+ blocking = True)
if proc.poll():
self.fail()
# force waiting until ping is READY before we starting the FIB
self.ec.register_condition(self.guid, ResourceAction.START,
self._ping, ResourceState.READY)
- # schedule ping deploy and start
+ # schedule ping deploy
self.ec.deploy(group=[self._ping])
- self.ec.start_with_conditions(self._ping)
if self.trace_enabled("mtr"):
self.info("Configuring TRACE trace")
# force waiting until mtr is READY before we starting the FIB
self.ec.register_condition(self.guid, ResourceAction.START,
self._mtr, ResourceState.READY)
- # schedule mtr deploy and start
+ # schedule mtr deploy
self.ec.deploy(group=[self._mtr])
- self.ec.start_with_conditions(self._mtr)
-
def start(self):
if self._state in [ResourceState.READY, ResourceState.STARTED]:
if not self.get("command"):
self.set("command", self._start_command)
+ if not self.get("env"):
+ self.set("env", "PATH=$PATH:/usr/sbin/")
+
if not self.get("depends"):
self.set("depends", "mtr")
def _start_command(self):
args = []
+ args.append("echo 'Starting PING to %s' ;" % self.get("target"))
+
if self.get("printTimestamp") == True:
args.append("""echo "`date +'%Y%m%d%H%M%S'`";""")
if not self.get("command"):
self.set("command", self._start_command)
+ if not self.get("env"):
+ self.set("env", "PATH=$PATH:/usr/sbin/")
+
if not self.get("depends"):
self.set("depends", "tcpdump")