# Author: Alina Quereilhac <alina.quereilhac@inria.fr>
from nepi.execution.attribute import Attribute, Flags, Types
-from nepi.execution.resource import clsinit_copy
+from nepi.execution.resource import clsinit_copy
from nepi.resources.linux.application import LinuxApplication
from nepi.util.timefuncs import tnow
count = Attribute("count",
"Sets ping -c option. Determines the number of ECHO_REQUEST "
"packates to send before stopping.",
+ type = Types.Integer,
flags = Flags.ExecReadOnly)
mark = Attribute("mark",
numeric = Attribute("numeric",
"Sets ping -n option. Disables resolution of host addresses into "
- "symbolic names ",
+ "symbolic names. ",
type = Types.Bool,
default = False,
flags = Flags.ExecReadOnly)
super(LinuxPing, self).__init__(ec, guid)
self._home = "ping-%s" % self.guid
- def deploy(self):
+ def do_deploy(self):
if not self.get("command"):
self.set("command", self._start_command)
- super(LinuxPing, self).deploy()
+ super(LinuxPing, self).do_deploy()
@property
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'`";""")
+
+ args.append("ping ")
+
if self.get("count"):
args.append("-c %s" % self.get("count"))
if self.get("mark"):
args.append("-n")
if self.get("pattern"):
args.append("-p %s" % self.get("pattern"))
- if self.get("printTimestamp") == True:
- args.append("-D")
if self.get("tos"):
args.append("-Q %s" % self.get("tos"))
if self.get("quiet"):
args.append("-W %s" % self.get("timeout"))
args.append(self.get("target"))
- command = " sudo -S ping "
- command += " ".join(args)
+ command = " ".join(args)
return command