File: //lib/python2.7/site-packages/lap/check_hw_bad_model.py
from pymongo import MongoClient
import re
def __run__(params):
try:
client = MongoClient("mongodb://localhost")
db = client.cegonha
hwcollection = db.hardwares
except Exception, err:
return([2, "Critial and unexpected error: {0}".format(err)])
regex = re.compile("^Dis", re.IGNORECASE)
query = {'hardwares.status': regex,
'hardwares.hardware_config_template_name': None
}
available = hwcollection.find(query)
hws = [h['hardwares']['name_cache'] for h in available]
if not hws:
return([0, "OK - Nice, not hardwares without default"])
else:
return([1, hws])