summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2016-02-19 12:08:44 (GMT)
committerSam Thursfield <sam.thursfield@codethink.co.uk>2016-02-19 12:11:29 (GMT)
commitc03b9c714e38b24c1b09ec4ab4da8f8b593b1c47 (patch)
tree905c2323e188aa3fc3bf93a9b7476246cd6614e7
parent535443bcfa78568ecdd091a57e4aff64bfbf9638 (diff)
downloadmorph-c03b9c714e38b24c1b09ec4ab4da8f8b593b1c47.tar.gz
deploy: Fix an unlikely crash at deploy-time
For some reason I had a deployment .morph file that specified: deploy-defaults: This resulted in the deploy_defaults variable having value None, which lead to a crash further down: 2016-02-19 12:03:52 Deciding on task order Traceback (most recent call last): File "/usr/lib/python2.7/site-packages/cliapp/app.py", line 190, in _run self.process_args(args) File "/src/morph/morphlib/app.py", line 299, in process_args cliapp.Application.process_args(self, args) File "/usr/lib/python2.7/site-packages/cliapp/app.py", line 539, in process_args method(args[1:]) File "/src/morph/morphlib/plugins/deploy_plugin.py", line 574, in upgrade self.deploy(args) File "/src/morph/morphlib/plugins/deploy_plugin.py", line 370, in deploy env_vars, deployments) File "/src/morph/morphlib/plugins/deploy_plugin.py", line 403, in deploy_cluster parent_location='') File "/src/morph/morphlib/plugins/deploy_plugin.py", line 462, in deploy_system env_vars, deployment_filter, parent_location) File "/src/morph/morphlib/plugins/deploy_plugin.py", line 483, in deploy_system_with_source_pool system_id, env_vars, deploy_defaults, deploy_params) File "/src/morph/morphlib/plugins/deploy_plugin.py", line 59, in configuration_for_system deploy_params.items() + AttributeError: 'NoneType' object has no attribute 'items' This change makes the code work as expected. Change-Id: I667f4142667be31797cac7c8994d35a404119cca
-rw-r--r--morphlib/plugins/deploy_plugin.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/morphlib/plugins/deploy_plugin.py b/morphlib/plugins/deploy_plugin.py
index 189222a..18ea8d8 100644
--- a/morphlib/plugins/deploy_plugin.py
+++ b/morphlib/plugins/deploy_plugin.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2013-2015 Codethink Limited
+# Copyright (C) 2013-2016 Codethink Limited
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -471,7 +471,7 @@ class DeployPlugin(cliapp.Plugin):
build_command = morphlib.buildcommand.BuildCommand(self.app)
artifact = build_command.resolve_artifacts(source_pool)
- deploy_defaults = system.get('deploy-defaults', {})
+ deploy_defaults = system.get('deploy-defaults') or {}
for system_id, deploy_params in system['deploy'].iteritems():
if not system_id in deployment_filter and deployment_filter:
continue