Commit 066a340c authored by Tomáš Peterka's avatar Tomáš Peterka Committed by Rafael Monnerat

[slapconfiguration] Don't expect new attributes to exist on all machines

parent dfd4d114
...@@ -249,21 +249,22 @@ class Recipe(object): ...@@ -249,21 +249,22 @@ class Recipe(object):
# The external information transfered from Slap Master has been processed # The external information transfered from Slap Master has been processed
# so we extend with information gathered from partition resource file # so we extend with information gathered from partition resource file
resource_home = instance_root if hasattr(slapformat.Partition, "resource_file"):
while not os.path.exists(os.path.join(resource_home, slapformat.Partition.resource_file)): resource_home = instance_root
resource_home = os.path.normpath(os.path.join(resource_home, '..')) while not os.path.exists(os.path.join(resource_home, slapformat.Partition.resource_file)):
if resource_home == "/": resource_home = os.path.normpath(os.path.join(resource_home, '..'))
break if resource_home == "/":
else: break
# no break happened - let's add partition resources into options else:
logger.debug("Using partition resource file {}".format( # no break happened - let's add partition resources into options
os.path.join(resource_home, slapformat.Partition.resource_file))) logger.debug("Using partition resource file {}".format(
with open(os.path.join(resource_home, slapformat.Partition.resource_file)) as fi: os.path.join(resource_home, slapformat.Partition.resource_file)))
partition_params = json.load(fi) with open(os.path.join(resource_home, slapformat.Partition.resource_file)) as fi:
# be very careful with overriding master's information partition_params = json.load(fi)
for key, value in flatten_dict(partition_params).items(): # be very careful with overriding master's information
if key not in options: for key, value in flatten_dict(partition_params).items():
options[key] = value if key not in options:
options[key] = value
# print out augmented options to see what we are passing # print out augmented options to see what we are passing
logger.debug(str(options)) logger.debug(str(options))
return self._expandParameterDict(options, parameter_dict) return self._expandParameterDict(options, parameter_dict)
......
Markdown is supported
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