X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=src%2Fnepi%2Fresources%2Flinux%2Fccn%2Fccnd.py;h=eb39737402a3033a02b8d2254335b88b5ca99cef;hb=58a2b493f8df1072a1faa653c8abb6a3f9ba21fa;hp=d8a3fc39353bf89780bb607ef4d6ea2608d2c339;hpb=d662dcbab5a504791e306489dde627dde9221fd1;p=nepi.git diff --git a/src/nepi/resources/linux/ccn/ccnd.py b/src/nepi/resources/linux/ccn/ccnd.py index d8a3fc39..eb397374 100644 --- a/src/nepi/resources/linux/ccn/ccnd.py +++ b/src/nepi/resources/linux/ccn/ccnd.py @@ -3,9 +3,8 @@ # Copyright (C) 2013 INRIA # # This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation; # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -20,7 +19,7 @@ from nepi.execution.attribute import Attribute, Flags, Types from nepi.execution.trace import Trace, TraceAttr from nepi.execution.resource import ResourceManager, clsinit_copy, \ - ResourceState, reschedule_delay + ResourceState from nepi.resources.linux.application import LinuxApplication from nepi.resources.linux.node import OSType from nepi.util.timefuncs import tnow, tdiffsec @@ -32,7 +31,7 @@ import os @clsinit_copy class LinuxCCND(LinuxApplication): - _rtype = "LinuxCCND" + _rtype = "linux::CCND" @classmethod def _register_attributes(cls): @@ -50,56 +49,56 @@ class LinuxCCND(LinuxApplication): " -1 - max logging \n" " Or apply bitwise OR to these values to get combinations of them", type = Types.Integer, - flags = Flags.ExecReadOnly) + flags = Flags.Design) port = Attribute("port", "Sets the CCN_LOCAL_PORT environmental variable. " "Defaults to 9695 ", - flags = Flags.ExecReadOnly) + flags = Flags.Design) sockname = Attribute("sockname", "Sets the CCN_LOCAL_SCOKNAME environmental variable. " "Defaults to /tmp/.ccnd.sock", - flags = Flags.ExecReadOnly) + flags = Flags.Design) capacity = Attribute("capacity", "Sets the CCND_CAP environmental variable. " "Capacity limit in terms of ContentObjects", - flags = Flags.ExecReadOnly) + flags = Flags.Design) mtu = Attribute("mtu", "Sets the CCND_MTU environmental variable. ", - flags = Flags.ExecReadOnly) + flags = Flags.Design) data_pause = Attribute("dataPauseMicrosec", "Sets the CCND_DATA_PAUSE_MICROSEC environmental variable. ", - flags = Flags.ExecReadOnly) + flags = Flags.Design) default_stale = Attribute("defaultTimeToStale", "Sets the CCND_DEFAULT_TIME_TO_STALE environmental variable. ", - flags = Flags.ExecReadOnly) + flags = Flags.Design) max_stale = Attribute("maxTimeToStale", "Sets the CCND_MAX_TIME_TO_STALE environmental variable. ", - flags = Flags.ExecReadOnly) + flags = Flags.Design) max_rte = Attribute("maxRteMicrosec", "Sets the CCND_MAX_RTE_MICROSEC environmental variable. ", - flags = Flags.ExecReadOnly) + flags = Flags.Design) keystore = Attribute("keyStoreDirectory", "Sets the CCND_KEYSTORE_DIRECTORY environmental variable. ", - flags = Flags.ExecReadOnly) + flags = Flags.Design) listen_on = Attribute("listenOn", "Sets the CCND_LISTEN_ON environmental variable. ", - flags = Flags.ExecReadOnly) + flags = Flags.Design) autoreg = Attribute("autoreg", "Sets the CCND_AUTOREG environmental variable. ", - flags = Flags.ExecReadOnly) + flags = Flags.Design) prefix = Attribute("prefix", "Sets the CCND_PREFIX environmental variable. ", - flags = Flags.ExecReadOnly) + flags = Flags.Design) cls._register_attribute(debug) cls._register_attribute(port) @@ -141,7 +140,7 @@ class LinuxCCND(LinuxApplication): self.debug("---- RESCHEDULING DEPLOY ---- node state %s " % self.node.state ) # ccnd needs to wait until node is deployed and running - self.ec.schedule(reschedule_delay, self.deploy) + self.ec.schedule(self.reschedule_delay, self.deploy) else: if not self.get("command"): self.set("command", self._start_command) @@ -176,7 +175,6 @@ class LinuxCCND(LinuxApplication): self.do_discover() self.do_provision() - self.debug("----- READY ---- ") self.set_ready() def upload_start_command(self): @@ -195,8 +193,7 @@ class LinuxCCND(LinuxApplication): self.node.run_and_wait(command, self.run_home, shfile = shfile, overwrite = False, - env = env, - raise_on_error = True) + env = env) def do_start(self): if self.state == ResourceState.READY: @@ -207,7 +204,7 @@ class LinuxCCND(LinuxApplication): else: msg = " Failed to execute command '%s'" % command self.error(msg, out, err) - raise RuntimeError, msg + raise RuntimeError(msg) def do_stop(self): command = self.get('command') or '' @@ -284,7 +281,7 @@ class LinuxCCND(LinuxApplication): @property def _sources(self): - return "http://www.ccnx.org/releases/ccnx-0.7.2.tar.gz" + return "http://www.ccnx.org/releases/ccnx-0.8.2.tar.gz" @property def _build(self): @@ -343,8 +340,8 @@ class LinuxCCND(LinuxApplication): }) env = self.path - env += " ".join(map(lambda k: "%s=%s" % (envs.get(k), str(self.get(k))) \ - if self.get(k) else "", envs.keys())) + env += " ".join(["%s=%s" % (envs.get(k), str(self.get(k))) \ + if self.get(k) else "" for k in list(envs.keys())]) return env