git://git.onelab.eu
/
nepi.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Porting changes in LinuxApplication directory structure to CCNx RMs
[nepi.git]
/
src
/
nepi
/
resources
/
linux
/
ccn
/
ccnd.py
diff --git
a/src/nepi/resources/linux/ccn/ccnd.py
b/src/nepi/resources/linux/ccn/ccnd.py
index
7c150ea
..
cc30823
100644
(file)
--- a/
src/nepi/resources/linux/ccn/ccnd.py
+++ b/
src/nepi/resources/linux/ccn/ccnd.py
@@
-126,8
+126,15
@@
class LinuxCCND(LinuxApplication):
def __init__(self, ec, guid):
super(LinuxCCND, self).__init__(ec, guid)
self._home = "ccnd-%s" % self.guid
def __init__(self, ec, guid):
super(LinuxCCND, self).__init__(ec, guid)
self._home = "ccnd-%s" % self.guid
- self._version = None
- self._environment = None
+ self._version = "ccnx"
+
+ @property
+ def version(self):
+ return self._version
+
+ @property
+ def path(self):
+ return "PATH=$PATH:${BIN}/%s/" % self.version
def deploy(self):
if not self.node or self.node.state < ResourceState.READY:
def deploy(self):
if not self.node or self.node.state < ResourceState.READY:
@@
-145,6
+152,14
@@
class LinuxCCND(LinuxApplication):
if not self.get("sources"):
self.set("sources", self._sources)
if not self.get("sources"):
self.set("sources", self._sources)
+ sources = self.get("sources")
+ source = sources.split(" ")[0]
+ basename = os.path.basename(source)
+ self._version = ( basename.strip().replace(".tar.gz", "")
+ .replace(".tar","")
+ .replace(".gz","")
+ .replace(".zip","") )
+
if not self.get("build"):
self.set("build", self._build)
if not self.get("build"):
self.set("build", self._build)
@@
-160,7
+175,7
@@
class LinuxCCND(LinuxApplication):
self.info("Deploying command '%s' " % command)
# create home dir for application
self.info("Deploying command '%s' " % command)
# create home dir for application
- self.node.mkdir(self.
app
_home)
+ self.node.mkdir(self.
run
_home)
# upload sources
self.upload_sources()
# upload sources
self.upload_sources()
@@
-188,9
+203,11
@@
class LinuxCCND(LinuxApplication):
env = self.replace_paths(env)
command = self.replace_paths(command)
env = self.replace_paths(env)
command = self.replace_paths(command)
- self.node.run_and_wait(command, self.app_home,
+ shfile = os.path.join(self.app_home, "start.sh")
+ self.node.run_and_wait(command, self.run_home,
+ shfile = shfile,
+ overwrite = False,
env = env,
env = env,
- shfile = "app.sh",
raise_on_error = True)
self.debug("----- READY ---- ")
raise_on_error = True)
self.debug("----- READY ---- ")
@@
-225,8
+242,10
@@
class LinuxCCND(LinuxApplication):
env = env and self.replace_paths(env)
# Upload the command to a file, and execute asynchronously
env = env and self.replace_paths(env)
# Upload the command to a file, and execute asynchronously
- self.node.run_and_wait(command, self.app_home,
- shfile = "ccndstop.sh",
+ shfile = os.path.join(self.app_home, "stop.sh")
+ self.node.run_and_wait(command, self.run_home,
+ shfile = shfile,
+ overwrite = False,
env = env,
pidfile = "ccndstop_pidfile",
ecodefile = "ccndstop_exitcode",
env = env,
pidfile = "ccndstop_pidfile",
ecodefile = "ccndstop_exitcode",
@@
-296,32
+315,35
@@
class LinuxCCND(LinuxApplication):
return (
# Evaluate if ccnx binaries are already installed
" ( "
return (
# Evaluate if ccnx binaries are already installed
" ( "
- " test -f ${
STORE}/ccnx/bin
/ccnd && "
- " echo '
sourc
es found, nothing to do' "
+ " test -f ${
BIN}/%(version)s
/ccnd && "
+ " echo '
binari
es found, nothing to do' "
" ) || ( "
# If not, untar and build
" ( "
" ) || ( "
# If not, untar and build
" ( "
- " mkdir -p ${S
TORE}/ccnx
&& "
- " tar xf ${S
TORE}/%(sources)s --strip-components=1 -C ${STORE}/ccnx
"
+ " mkdir -p ${S
RC}/%(version)s
&& "
+ " tar xf ${S
RC}/%(sources)s --strip-components=1 -C ${SRC}/%(version)s
"
" ) && "
" ) && "
- "cd ${S
TORE}/ccnx
&& "
+ "cd ${S
RC}/%(version)s
&& "
# Just execute and silence warnings...
" ( ./configure && make ) "
# Just execute and silence warnings...
" ( ./configure && make ) "
- " )") % ({ 'sources': sources })
+ " )") % ({ 'sources': sources,
+ 'version': self.version
+ })
@property
def _install(self):
return (
# Evaluate if ccnx binaries are already installed
" ( "
@property
def _install(self):
return (
# Evaluate if ccnx binaries are already installed
" ( "
- " test -f ${
SOURCES}/ccnx/bin
/ccnd && "
- " echo '
sourc
es found, nothing to do' "
+ " test -f ${
BIN}/%(version)s
/ccnd && "
+ " echo '
binari
es found, nothing to do' "
" ) || ( "
# If not, install
" ) || ( "
# If not, install
- " mkdir -p ${
SOURCES}/ccnx/bin
&& "
- "
cp -r ${}/ccnx ${STORE}
"
+ " mkdir -p ${
BIN}/%(version)s
&& "
+ "
mv ${SRC}/%(version)s/bin/* ${BIN}/%(version)s/
"
" )"
" )"
- )
+ ) % ({ 'version': self.version
+ })
@property
def _environment(self):
@property
def _environment(self):
@@
-341,12
+363,12
@@
class LinuxCCND(LinuxApplication):
"prefix" : "CCND_PREFIX",
})
"prefix" : "CCND_PREFIX",
})
- env =
"PATH=$PATH:${SOURCES}/ccnx/bin "
+ env =
self.path
env += " ".join(map(lambda k: "%s=%s" % (envs.get(k), str(self.get(k))) \
if self.get(k) else "", envs.keys()))
return env
env += " ".join(map(lambda k: "%s=%s" % (envs.get(k), str(self.get(k))) \
if self.get(k) else "", envs.keys()))
return env
-
+
def valid_connection(self, guid):
# TODO: Validate!
return True
def valid_connection(self, guid):
# TODO: Validate!
return True