diff --git a/molteniron/molteniron b/molteniron/molteniron index 692ab7c..33f19b6 100755 --- a/molteniron/molteniron +++ b/molteniron/molteniron @@ -83,7 +83,7 @@ if __name__ == "__main__": YAML_CONF = resource_filename("molteniron", "conf.yaml") with open(YAML_CONF, "r") as fobj: - conf = yaml.load(fobj) + conf = yaml.load(fobj, Loader=yaml.SafeLoader) mi.setup_conf(conf) mi.setup_parser(parser) diff --git a/molteniron/moltenirond-helper b/molteniron/moltenirond-helper index 4e684b3..6c8ece3 100755 --- a/molteniron/moltenirond-helper +++ b/molteniron/moltenirond-helper @@ -77,7 +77,7 @@ def moltenirond_main(): """This is the main routine for the MoltenIron server.""" with open(YAML_CONF, "r") as fobj: - conf = yaml.load(fobj) + conf = yaml.load(fobj, Loader=yaml.SafeLoader) moltenirond.listener(conf) diff --git a/molteniron/moltenirond.py b/molteniron/moltenirond.py index 6314316..9ad1dcd 100755 --- a/molteniron/moltenirond.py +++ b/molteniron/moltenirond.py @@ -507,6 +507,11 @@ class DataBase(object): if node_pool != "Default": count_with_pool = session.query(Nodes).filter_by( status="ready", node_pool=node_pool).count() + if count_with_pool < how_many: + fmt = "Not enough available nodes found." + fmt += " Found %d, requested %d" + return {'status': 404, + 'message': fmt % (count_with_pool, how_many, )} # If we don't have enough nodes return an error if count < how_many: fmt = "Not enough available nodes found." @@ -1357,6 +1362,6 @@ if __name__ == "__main__": YAML_CONF = resource_filename("molteniron", "conf.yaml") with open(YAML_CONF, "r") as fobj: - conf = yaml.load(fobj) + conf = yaml.load(fobj, Loader=yaml.SafeLoader) listener(conf) diff --git a/molteniron/tests/testAddBMNode.py b/molteniron/tests/testAddBMNode.py index f764f66..ba73e12 100755 --- a/molteniron/tests/testAddBMNode.py +++ b/molteniron/tests/testAddBMNode.py @@ -53,7 +53,7 @@ if __name__ == "__main__": YAML_CONF = resource_filename("molteniron", "conf.yaml") with open(YAML_CONF, "r") as fobj: - conf = yaml.load(fobj) + conf = yaml.load(fobj, Loader=yaml.SafeLoader) request1 = { "name": "pkvmci816", diff --git a/molteniron/tests/testAllocateBM.py b/molteniron/tests/testAllocateBM.py index d88cf00..da1ea7b 100755 --- a/molteniron/tests/testAllocateBM.py +++ b/molteniron/tests/testAllocateBM.py @@ -94,7 +94,7 @@ if __name__ == "__main__": YAML_CONF = resource_filename("molteniron", "conf.yaml") with open(YAML_CONF, "r") as fobj: - conf = yaml.load(fobj) + conf = yaml.load(fobj, Loader=yaml.SafeLoader) request1 = { "name": "pkvmci816", diff --git a/molteniron/tests/testCull.py b/molteniron/tests/testCull.py index 367b022..7f69eb4 100755 --- a/molteniron/tests/testCull.py +++ b/molteniron/tests/testCull.py @@ -93,7 +93,7 @@ if __name__ == "__main__": YAML_CONF = resource_filename("molteniron", "conf.yaml") with open(YAML_CONF, "r") as fobj: - conf = yaml.load(fobj) + conf = yaml.load(fobj, Loader=yaml.SafeLoader) request1 = { "name": "pkvmci816", diff --git a/molteniron/tests/testDeallocateBM.py b/molteniron/tests/testDeallocateBM.py index fd483da..033ca2e 100755 --- a/molteniron/tests/testDeallocateBM.py +++ b/molteniron/tests/testDeallocateBM.py @@ -94,7 +94,7 @@ if __name__ == "__main__": YAML_CONF = resource_filename("molteniron", "conf.yaml") with open(YAML_CONF, "r") as fobj: - conf = yaml.load(fobj) + conf = yaml.load(fobj, Loader=yaml.SafeLoader) request1 = { "name": "pkvmci816", diff --git a/molteniron/tests/testDeallocateOwner.py b/molteniron/tests/testDeallocateOwner.py index d0e3058..6ef7646 100755 --- a/molteniron/tests/testDeallocateOwner.py +++ b/molteniron/tests/testDeallocateOwner.py @@ -94,7 +94,7 @@ if __name__ == "__main__": YAML_CONF = resource_filename("molteniron", "conf.yaml") with open(YAML_CONF, "r") as fobj: - conf = yaml.load(fobj) + conf = yaml.load(fobj, Loader=yaml.SafeLoader) request1 = { "name": "pkvmci816", diff --git a/molteniron/tests/testDoClean.py b/molteniron/tests/testDoClean.py index 88e73d0..97c2795 100755 --- a/molteniron/tests/testDoClean.py +++ b/molteniron/tests/testDoClean.py @@ -53,7 +53,7 @@ if __name__ == "__main__": YAML_CONF = resource_filename("molteniron", "conf.yaml") with open(YAML_CONF, "r") as fobj: - conf = yaml.load(fobj) + conf = yaml.load(fobj, Loader=yaml.SafeLoader) request1 = { "name": "pkvmci816", diff --git a/molteniron/tests/testGetField.py b/molteniron/tests/testGetField.py index dfcad2c..afc2406 100755 --- a/molteniron/tests/testGetField.py +++ b/molteniron/tests/testGetField.py @@ -53,7 +53,7 @@ if __name__ == "__main__": YAML_CONF = resource_filename("molteniron", "conf.yaml") with open(YAML_CONF, "r") as fobj: - conf = yaml.load(fobj) + conf = yaml.load(fobj, Loader=yaml.SafeLoader) request1 = { "name": "pkvmci816", diff --git a/molteniron/tests/testGetIps.py b/molteniron/tests/testGetIps.py index 51335ef..fb0ef50 100755 --- a/molteniron/tests/testGetIps.py +++ b/molteniron/tests/testGetIps.py @@ -53,7 +53,7 @@ if __name__ == "__main__": YAML_CONF = resource_filename("molteniron", "conf.yaml") with open(YAML_CONF, "r") as fobj: - conf = yaml.load(fobj) + conf = yaml.load(fobj, Loader=yaml.SafeLoader) request1 = { "name": "pkvmci816", diff --git a/molteniron/tests/testRemoveBMNode.py b/molteniron/tests/testRemoveBMNode.py index af703ae..47ab1bb 100755 --- a/molteniron/tests/testRemoveBMNode.py +++ b/molteniron/tests/testRemoveBMNode.py @@ -53,7 +53,7 @@ if __name__ == "__main__": YAML_CONF = resource_filename("molteniron", "conf.yaml") with open(YAML_CONF, "r") as fobj: - conf = yaml.load(fobj) + conf = yaml.load(fobj, Loader=yaml.SafeLoader) request1 = { "name": "pkvmci816", diff --git a/utils/createDB.py b/utils/createDB.py index 490f88b..17b2a91 100755 --- a/utils/createDB.py +++ b/utils/createDB.py @@ -40,7 +40,7 @@ def main(): # The conf.yaml is located in the molteniron/ directory. newPath = "/".join(dirs[:-2]) + "/" fobj = open(newPath + "molteniron/conf.yaml", "r") - conf = yaml.load(fobj) + conf = yaml.load(fobj, Loader=yaml.SafeLoader) # Create the SQL User SQL("CREATE USER '" diff --git a/utils/test_hook_mi_ipmiblob.py b/utils/test_hook_mi_ipmiblob.py index 8f658f7..ebdb325 100755 --- a/utils/test_hook_mi_ipmiblob.py +++ b/utils/test_hook_mi_ipmiblob.py @@ -83,7 +83,7 @@ if __name__ == "__main__": YAML_CONF = resource_filename("molteniron", "conf.yaml") with open(YAML_CONF, "r") as fobj: - conf = yaml.load(fobj) + conf = yaml.load(fobj, Loader=yaml.SafeLoader) mi.setup_conf(conf) mi.setup_parser(parser)