Révision 96454bcd
Ajouté par Sylvain Sauvage il y a plus de 11 ans
IoTa-Installer/lib/utils.py | ||
---|---|---|
HALT_ON_ERROR = True
|
||
|
||
|
||
# ActiveMQ Utilities
|
||
|
||
def isActiveMQRunning():
|
||
try:
|
||
cnx = urllib.urlopen(CONFIG.get("activemq", "admin_url"))
|
||
cnx.close()
|
||
return True
|
||
except IOError:
|
||
return False
|
||
|
||
|
||
def startActiveMQ():
|
||
putWait("Starting up ActiveMQ")
|
||
if isActiveMQRunning():
|
||
putDoneOK("(already running)")
|
||
return
|
||
commandStart = ("ACTIVEMQ_OPTS_MEMORY=' ' " + CONFIG.get("activemq", "home") + "/bin/activemq start")
|
||
if not sh_exec(commandStart):
|
||
putDoneFail()
|
||
return
|
||
putDoneOK()
|
||
|
||
|
||
# Tomcat Utilities
|
||
|
||
def isTomcatRunning():
|
||
... | ... | |
webapp_path = CONFIG.get("tomcat", "catalina_home") + "webapps/" + webapp_name
|
||
warfile = webapp_path + ".war"
|
||
if os.path.exists(warfile):
|
||
if not getYN("Webapp exists. Do you realy want to overwrite it?"):
|
||
if not getYN("Webapp exists. Do you really want to overwrite it?"):
|
||
return
|
||
sh_rm(warfile)
|
||
sh_rm_r(webapp_path)
|
||
... | ... | |
# replace old values
|
||
for line in lines:
|
||
words = re.split("[=:]", line)
|
||
# don’t touch lines without = or :
|
||
if len(words) < 2:
|
||
propfile.write(line)
|
||
continue
|
||
# get the key (part before first = or :)
|
||
key = words[0].strip()
|
||
if key in dic:
|
||
val = dic[key]
|
||
if not isinstance(val, basestring):
|
||
val = CONFIG.get(val[0], val[1])
|
||
# beware =
|
||
val = val.replace("=", "\\=")
|
||
propfile.write(key + " = " + val + "\n")
|
||
del dic[key]
|
||
else:
|
||
... | ... | |
val = dic[key]
|
||
if not isinstance(val, basestring):
|
||
val = CONFIG.get(val[0], val[1])
|
||
# beware =
|
||
val = val.replace("=", "\\=")
|
||
propfile.write(key + " = " + val + "\n")
|
||
putDoneOK()
|
||
|
||
... | ... | |
if not execDB("Granting access rights", "mysql",
|
||
"GRANT SELECT, INSERT, UPDATE, DELETE ON " +
|
||
CONFIG.get(section_name, "db_name") + ".* TO " +
|
||
CONFIG.get(section_name, "db_login") + "@localhost " +
|
||
CONFIG.get(section_name, "db_login") + "@'" + CONFIG.get("db", "user_host") + "' " +
|
||
"IDENTIFIED BY '" + CONFIG.get(section_name, "db_password") + "';"):
|
||
return
|
||
if not execDB("Creating tables", CONFIG.get(section_name, "db_name"),
|
||
... | ... | |
return False
|
||
|
||
|
||
# Key and certificate tool
|
||
def execKeytool(msg, keycmd, storetype, keystore, password, keyalias, keypass, other_opts):
|
||
putWait(msg)
|
||
if keypass:
|
||
keypass = "-keypass \"" + keypass + "\""
|
||
cmd = ("keytool " + keycmd + " -storetype \"" + storetype + "\" -keystore \"" + keystore +
|
||
"\" -storepass \"" + password + "\" -alias \"" + keyalias + "\" " + keypass)
|
||
for opt, value in other_opts:
|
||
cmd += " " + opt + " \"" + value + "\""
|
||
if sh_exec(cmd):
|
||
putDoneOK()
|
||
else:
|
||
putDoneFail()
|
||
|
||
|
||
# File and Shell Utilities
|
||
|
||
def sh_rm(filename):
|
||
... | ... | |
def sh_exec(cmd):
|
||
with open("install.log", "a") as logfile:
|
||
logfile.write("\n## executing <" + cmd + ">:\n")
|
||
return os.system(cmd + " 2>&1 >>install.log") == 0
|
||
return os.system(cmd + " >>install.log 2>&1") == 0
|
||
|
||
|
||
def waitForFile(filename):
|
Formats disponibles : Unified diff
Version 1.9-mock
This is version 1.9-mock. 1.9 because the API still have changes pending
(principally relative to the Discovery Services). “mock” because TLS
configuration is not yet available and the signatures (SigMa) are not fully
implemented.
- code cleaned and refactored
- lots of bugs fixed
- dependencies checked and trimmed
- documentation added
- Identity handling added
- code refactored
- new, better APIs
- Identity handling added
- use EPCglobal and DS events (no proxy types anymore)
- ETa-Callback modules are now available as web applications
- filtering rules: if a part of an event is not allowed, now the whole
event is deleted from the result (before only the rejectd part was)
- new temporary User web service
- new Xi module: XACML Interrogation web service (was two modules: TCP and
servlet)
- ETa and its Callback modules
- ActiveMQ
- SigMa
- certificate/signing key
- new simplified figures (sans IoTa and simplified IoTa)
- new figure for ETa modules
- show 3rd party clients
- data flows specified
- TLS and link security added
- IDs and trusted IDs added
- color adjusted for printing
- GREYC logo added