Commit b41dbca1 authored by aknecht2's avatar aknecht2
Browse files

Fixed a lot of minor syntax errors. Added missing xml closing tags. Added...

Fixed a lot of minor syntax errors.  Added missing xml closing tags.  Added validation for execute & output sites.
parent 2b1ed709
......@@ -24,11 +24,14 @@ class PegasusConfig(object):
try:
with open(config_file, "r") as rh:
self.config = yaml.load(rh)
self.validate()
self.validate()
except yaml.YAMLError as exc:
self.errors.append("Error parsing config template file '%s': %s.\n" % (config_file, exc))
return
def __getitem__(self, key):
return self.config[key]
def is_valid(self):
"""
:returns: Whether or not the run is valid.
......@@ -96,7 +99,7 @@ class PegasusConfig(object):
<directory type="%s" path="%s">
<file-server operation="all" url="file://%s" />
</directory>
""" % (dir_name, dir_path, dir_path)
""" % (dir_type, dir_path.replace("%base_path%", self.base_path), dir_path.replace("%base_path%", self.base_path))
# Grids is required for the BRIDGES setup,
# conditionally add those to the sites
if "grids" in site_info:
......@@ -111,8 +114,8 @@ class PegasusConfig(object):
# Pass profile information directly through
if "profile" in site_info:
site_string += "\n"
for namespace in self.config["profile"]:
for key, value in self.config["profile"][namespace].iteritems():
for namespace in site_info["profile"]:
for key, value in site_info["profile"][namespace].iteritems():
if key == "PATH":
value = value + ":%s/jobs/scripts/" % (os.path.dirname(os.path.abspath(__file__)),)
site_string += """\n\t<profile namespace="%s" key="%s">%s</profile> """ % (
......@@ -126,6 +129,10 @@ class PegasusConfig(object):
os.path.dirname(os.path.abspath(__file__))
)
site_string += "</site>\n"
site_string += "</sitecatalog>\n"
with open(self.site_file, "w") as wh:
wh.write("\n".join([line for line in xml.dom.minidom.parseString(site_string).toprettyxml().split("\n") if line.strip()]))
......
No preview for this file type
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment