git://git.onelab.eu
/
nodemanager.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
cdf5b60
)
logs for when PLC is unreachable
author
Thierry Parmentelat
<thierry.parmentelat@sophia.inria.fr>
Thu, 28 Jan 2010 17:24:03 +0000
(17:24 +0000)
committer
Thierry Parmentelat
<thierry.parmentelat@sophia.inria.fr>
Thu, 28 Jan 2010 17:24:03 +0000
(17:24 +0000)
conf_files.py
patch
|
blob
|
history
logger.py
patch
|
blob
|
history
plugins/codemux.py
patch
|
blob
|
history
plugins/rawdisk.py
patch
|
blob
|
history
plugins/sliverauth.py
patch
|
blob
|
history
plugins/specialaccounts.py
patch
|
blob
|
history
plugins/vsys.py
patch
|
blob
|
history
plugins/vsys_privs.py
patch
|
blob
|
history
sm.py
patch
|
blob
|
history
diff --git
a/conf_files.py
b/conf_files.py
index
bccf20a
..
9e2c257
100644
(file)
--- a/
conf_files.py
+++ b/
conf_files.py
@@
-79,7
+79,8
@@
class conf_files:
for f in data['conf_files']:
try: self.update_conf_file(f)
except: logger.log_exc("failed to update conf_file")
for f in data['conf_files']:
try: self.update_conf_file(f)
except: logger.log_exc("failed to update conf_file")
- else: logger.log("conf_files: No conf_files found or API failure. Skipping")
+ else:
+ logger.log_missing_data("conf_files.run_once",'conf_files')
def start(options, config): pass
def start(options, config): pass
diff --git
a/logger.py
b/logger.py
index
7dff05e
..
eff93e6
100644
(file)
--- a/
logger.py
+++ b/
logger.py
@@
-58,6
+58,12
@@
def log_exc(msg="",name=None):
else:
log("EXCEPTION caught <%s> \n %s" %(msg, traceback.format_exc()))
else:
log("EXCEPTION caught <%s> \n %s" %(msg, traceback.format_exc()))
+# for some reason the various modules are still triggered even when the
+# data from PLC cannot be reached
+# we show this message instead of the exception stack instead in this case
+def log_missing_data (msg,key):
+ log("%s: could not find the %s key in data (PLC connection down?) - IGNORED"%(msg,key))
+
def log_data_in_file (data, file, message=""):
import pprint, time
try:
def log_data_in_file (data, file, message=""):
import pprint, time
try:
diff --git
a/plugins/codemux.py
b/plugins/codemux.py
index
84b0f4e
..
731b74d
100644
(file)
--- a/
plugins/codemux.py
+++ b/
plugins/codemux.py
@@
-36,6
+36,9
@@
def GetSlivers(data, config, plc = None):
else: _writeconf = True
# Parse attributes and update dict of scripts
else: _writeconf = True
# Parse attributes and update dict of scripts
+ if 'slivers' not in data:
+ logger.log_missing_data("codemux.GetSlivers", 'slivers')
+ return
for sliver in data['slivers']:
for attribute in sliver['attributes']:
if attribute['tagname'] == 'codemux':
for sliver in data['slivers']:
for attribute in sliver['attributes']:
if attribute['tagname'] == 'codemux':
diff --git
a/plugins/rawdisk.py
b/plugins/rawdisk.py
index
ad84761
..
641bc69
100644
(file)
--- a/
plugins/rawdisk.py
+++ b/
plugins/rawdisk.py
@@
-51,7
+51,7
@@
def get_unused_devices():
def GetSlivers(data, config=None, plc=None):
if 'slivers' not in data:
def GetSlivers(data, config=None, plc=None):
if 'slivers' not in data:
- logger.log
("sliverauth: getslivers data lack's sliver information. IGNORING!"
)
+ logger.log
_missing_data("rawdisk.GetSlivers",'slivers'
)
return
devices = get_unused_devices()
return
devices = get_unused_devices()
diff --git
a/plugins/sliverauth.py
b/plugins/sliverauth.py
index
ad813b8
..
bf35830
100644
(file)
--- a/
plugins/sliverauth.py
+++ b/
plugins/sliverauth.py
@@
-46,7
+46,7
@@
def GetSlivers(data, config, plc):
return
if 'slivers' not in data:
return
if 'slivers' not in data:
- logger.log
("sliverauth: getslivers data lack's sliver information. IGNORING!"
)
+ logger.log
_missing_data("sliverauth.GetSlivers", 'slivers'
)
return
for sliver in data['slivers']:
return
for sliver in data['slivers']:
diff --git
a/plugins/specialaccounts.py
b/plugins/specialaccounts.py
index
9396062
..
cef877e
100644
(file)
--- a/
plugins/specialaccounts.py
+++ b/
plugins/specialaccounts.py
@@
-27,7
+27,7
@@
def start(options, conf):
def GetSlivers(data, conf = None, plc = None):
if 'accounts' not in data:
def GetSlivers(data, conf = None, plc = None):
if 'accounts' not in data:
- logger.log
("specialaccounts: No account information found. DISABLED!"
)
+ logger.log
_missing_data("specialaccounts.GetSlivers",'accounts'
)
return
for account in data['accounts']:
return
for account in data['accounts']:
diff --git
a/plugins/vsys.py
b/plugins/vsys.py
index
f33d11b
..
05b87cd
100644
(file)
--- a/
plugins/vsys.py
+++ b/
plugins/vsys.py
@@
-22,6
+22,9
@@
def GetSlivers(data, config=None, plc=None):
slices = []
_restart = False
# Parse attributes and update dict of scripts
slices = []
_restart = False
# Parse attributes and update dict of scripts
+ if 'slivers' not in data:
+ logger.log_missing_data("vsys.GetSlivers",'slivers')
+ return
for sliver in data['slivers']:
for attribute in sliver['attributes']:
if attribute['tagname'] == 'vsys':
for sliver in data['slivers']:
for attribute in sliver['attributes']:
if attribute['tagname'] == 'vsys':
diff --git
a/plugins/vsys_privs.py
b/plugins/vsys_privs.py
index
f30012d
..
5cd40a2
100755
(executable)
--- a/
plugins/vsys_privs.py
+++ b/
plugins/vsys_privs.py
@@
-23,6
+23,9
@@
def GetSlivers(data, config=None, plc=None):
privs = {}
# Parse attributes and update dict of scripts
privs = {}
# Parse attributes and update dict of scripts
+ if 'slivers' not in data:
+ logger.log_missing_data("vsys_privs.GetSlivers",'slivers')
+ return
for sliver in data['slivers']:
slice = sliver['name']
for attribute in sliver['attributes']:
for sliver in data['slivers']:
slice = sliver['name']
for attribute in sliver['attributes']:
diff --git
a/sm.py
b/sm.py
index
25b5e87
..
8c04760
100644
(file)
--- a/
sm.py
+++ b/
sm.py
@@
-82,6
+82,9
@@
def GetSlivers(data, config = None, plc=None, fullupdate=True):
DEFAULT_ALLOCATION['net_max_rate'] = network['bwlimit'] / 1000
# Take intscripts (global) returned by API, make dict
DEFAULT_ALLOCATION['net_max_rate'] = network['bwlimit'] / 1000
# Take intscripts (global) returned by API, make dict
+ if 'initscripts' not in data:
+ logger.log_missing_data("sm.GetSlivers",'initscripts')
+ return
initscripts = {}
for is_rec in data['initscripts']:
logger.verbose("initscript: %s" % is_rec['name'])
initscripts = {}
for is_rec in data['initscripts']:
logger.verbose("initscript: %s" % is_rec['name'])