We should always merge option with the default

If the user doesn't provide any options file then we should just use the
generated default. If the user provides an options file then we should
merge it with the generated defaults.
This commit is contained in:
José Armando García Sancio
2015-04-27 22:33:26 -07:00
parent 75178961e6
commit 70bffdf9d5

View File

@@ -298,18 +298,22 @@ def _install(package_name, options_path, app_id, cli, app):
return 1
if options_path is None:
options = {}
user_options = {}
else:
try:
with open(options_path) as options_file:
user_options = json.load(options_file)
options, err = pkg.options(pkg_version, user_options)
if err is not None:
emitter.publish(err)
return 1
except Exception as e:
emitter.publish(errors.DefaultError(e.message))
with open(options_path) as options_file:
user_options, err = util.load_json(options_file)
if err is not None:
emitter.publish(err)
return 1
try:
options, err = pkg.options(pkg_version, user_options)
if err is not None:
emitter.publish(err)
return 1
except Exception as e:
emitter.publish(errors.DefaultError(e.message))
return 1
if app:
# Install in Marathon