self.__class__.__name__,
' '.join(filter(bool,(self.depends, self.sources)))
)
-
+
+ def deployed(self):
+ return self._setup
+
def validate(self):
if self.home_path is None:
raise AssertionError, "Misconfigured application: missing home path"
'home' : server.shell_escape(self.home_path),
'token' : server.shell_escape(self._master_token),
}
-
+
return cStringIO.StringIO(slavescript)
def _do_launch_build(self):
for i in xrange(5):
pidtuple = rspawn.remote_check_pid(
os.path.join(self.home_path,'build-pid'),
- host = self.node.hostname,
+ host = self.node.hostip,
port = None,
user = self.node.slicename,
agent = None,
time.sleep(delay*(0.5+random.random()))
delay = min(30,delay*1.2)
bustspin = 0
-
+
# check build token
slave_token = ""
for i in xrange(3):
if self.sources:
sources = self.sources.split(' ')
-
- # Copy all sources
+
+ http_sources = list()
+ for source in list(sources):
+ if source.startswith("http") or source.startswith("https"):
+ http_sources.append(source)
+ sources.remove(source)
+
+ # Download http sources
+ try:
+ for source in http_sources:
+ path = os.path.join(self.home_path, source.split("/")[-1])
+ command = "wget -o %s %s" % (path, source)
+ self._popen_ssh(command)
+ except RuntimeError, e:
+ raise RuntimeError, "Failed wget source file %r: %s %s" \
+ % (sources, e.args[0], e.args[1],)
+
+ # Copy all other sources
try:
self._popen_scp(
sources,
def _do_install(self):
if self.install:
self._logger.info("Installing %s at %s", self, self.node.hostname)
-
+
# Install application
try:
- self._popen_ssh_command(
- "cd %(home)s && cd build && ( %(command)s ) > ${HOME}/%(home)s/installlog 2>&1 || ( tail ${HOME}/%(home)s/{install,build}log >&2 && false )" % \
- {
- 'command' : self._replace_paths(self.install),
- 'home' : server.shell_escape(self.home_path),
- },
- )
+ command = "cd %(home)s && cd build && ( %(command)s ) > ${HOME}/%(home)s/installlog 2>&1 || ( tail ${HOME}/%(home)s/{install,build}log >&2 && false )" % \
+ {
+ 'command' : self._replace_paths(self.install),
+ 'home' : server.shell_escape(self.home_path),
+ }
+ self._popen_ssh_command(command)
except RuntimeError, e:
if self.check_bad_host(e.args[0], e.args[1]):
self.node.blacklist()
- raise RuntimeError, "Failed install build sources: %s %s" % (e.args[0], e.args[1],)
+ raise RuntimeError, "Failed install build sources on node %s: %s %s. COMMAND %s" % (
+ self.node.hostname, e.args[0], e.args[1], command)
def set_master(self, master):
self._master = master
stdout = 'stdout' if self.stdout else '/dev/null',
stderr = 'stderr' if self.stderr else '/dev/null',
sudo = self.sudo,
-
host = self.node.hostname,
port = None,
user = self.node.slicename,
# Attributes
self.ccnLocalPort = None
self.ccnRoutes = None
- self.ccnxVersion = "ccnx-0.6.0"
+ self.ccnxVersion = "0.7.1"
- #self.ccnx_0_5_1_sources = "http://www.ccnx.org/releases/ccnx-0.5.1.tar.gz"
- self.ccnx_0_5_1_sources = "http://yans.pl.sophia.inria.fr/libs/ccnx-0.5.1.tar.gz"
- #self.ccnx_0_6_0_sources = "http://www.ccnx.org/releases/ccnx-0.6.0.tar.gz"
- self.ccnx_0_6_0_sources = "http://yans.pl.sophia.inria.fr/libs/ccnx-0.6.0.tar.gz"
- self.buildDepends = 'make gcc development-tools openssl-devel expat-devel libpcap-devel libxml2-devel'
-
- self.ccnx_0_5_1_build = (
- " ( "
- " cd .. && "
- " test -d ccnx-0.5.1-src/build/bin "
- " ) || ( "
- # Not working, rebuild
- "("
- " mkdir -p ccnx-0.5.1-src && "
- " wget -q -c -O ccnx-0.5.1-src.tar.gz %(ccnx_source_url)s &&"
- " tar xf ccnx-0.5.1-src.tar.gz --strip-components=1 -C ccnx-0.5.1-src "
- ") && "
- "cd ccnx-0.5.1-src && "
- "mkdir -p build/include &&"
- "mkdir -p build/lib &&"
- "mkdir -p build/bin &&"
- "I=$PWD/build && "
- "INSTALL_BASE=$I ./configure &&"
- "make && make install"
- " )") % dict(
- ccnx_source_url = server.shell_escape(self.ccnx_0_5_1_sources),
- )
-
- self.ccnx_0_5_1_install = (
- " ( "
- " test -d ${BUILD}/ccnx-0.5.1-src/build/bin && "
- " cp -r ${BUILD}/ccnx-0.5.1-src/build/bin ${SOURCES}"
- " )"
- )
+ #self.ccnx_0_6_0_sources = "http://yans.pl.sophia.inria.fr/libs/ccnx-0.6.0.tar.gz"
+ self.ccnx_sources = "http://www.ccnx.org/releases/ccnx-%s.tar.gz"
+ self.buildDepends = 'make gcc openssl-devel expat-devel libpcap-devel libxml2-devel'
- self.ccnx_0_6_0_build = (
+ self.ccnx_build = (
" ( "
" cd .. && "
- " test -d ccnx-0.6.0-src/build/bin "
+ " test -d ccnx-src/build/bin "
" ) || ( "
# Not working, rebuild
"("
- " mkdir -p ccnx-0.6.0-src && "
- " wget -q -c -O ccnx-0.6.0-src.tar.gz %(ccnx_source_url)s &&"
- " tar xf ccnx-0.6.0-src.tar.gz --strip-components=1 -C ccnx-0.6.0-src "
+ " mkdir -p ccnx-src && "
+ " wget -q -c -O ccnx-src.tar.gz %(ccnx_source_url)s &&"
+ " tar xf ccnx-src.tar.gz --strip-components=1 -C ccnx-src "
") && "
- "cd ccnx-0.6.0-src && "
+ "cd ccnx-src && "
"./configure && make"
" )") % dict(
- ccnx_source_url = server.shell_escape(self.ccnx_0_6_0_sources),
+ ccnx_source_url = server.shell_escape(self.ccnx_sources % self.ccnxVersion),
)
- self.ccnx_0_6_0_install = (
+ self.ccnx_install = (
" ( "
- " test -d ${BUILD}/ccnx-0.6.0-src/bin && "
- " cp -r ${BUILD}/ccnx-0.6.0-src/bin ${SOURCES}"
+ " test -d ${BUILD}/ccnx-src/bin && "
+ " cp -r ${BUILD}/ccnx-src/bin ${SOURCES}"
" )"
)
def setup(self):
# setting ccn sources
if not self.build:
- if self.ccnxVersion == 'ccnx-0.6.0':
- self.build = self.ccnx_0_6_0_build
- elif self.ccnxVersion == 'ccnx-0.5.1':
- self.build = self.ccnx_0_5_1_build
+ self.build = self.ccnx_build
if not self.install:
- if self.ccnxVersion == 'ccnx-0.6.0':
- self.install = self.ccnx_0_6_0_install
- elif self.ccnxVersion == 'ccnx-0.5.1':
- self.install = self.ccnx_0_5_1_install
+ self.install = self.ccnx_install
super(CCNxDaemon, self).setup()