From bea6bd7212e9fd679c11e0e3d280dfc49c334b58 Mon Sep 17 00:00:00 2001 From: gardlt Date: Fri, 16 Jun 2017 19:32:54 +0000 Subject: [PATCH] [bug] pre-post-not-check-correctly * updated pre and post checks --- armada/cli/apply.py | 4 ++-- armada/handlers/armada.py | 16 ++++++++++------ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/armada/cli/apply.py b/armada/cli/apply.py index 72aba151..bcf4dc1e 100644 --- a/armada/cli/apply.py +++ b/armada/cli/apply.py @@ -41,9 +41,9 @@ class ApplyChartsCommand(cmd.Command): default=False, help='Skip Pre Flight') parser.add_argument('--debug', action='store', default=False, help='Run charts with dry run') - parser.add_argument('--disable-update-pre', action='store', + parser.add_argument('--disable-update-pre', action='store_true', default=False, help='Disable pre upgrade actions') - parser.add_argument('--disable-update-post', action='store', + parser.add_argument('--disable-update-post', action='store_true', default=False, help='Disable post upgrade actions') parser.add_argument('--enable-chart-cleanup', action='store', default=False, help='Enable Chart Clean Up') diff --git a/armada/handlers/armada.py b/armada/handlers/armada.py index 400b5f9d..fe3346f7 100644 --- a/armada/handlers/armada.py +++ b/armada/handlers/armada.py @@ -131,13 +131,17 @@ class Armada(object): installed_chart, installed_values = self.find_release_chart( known_releases, release_prefix(prefix, chart.release_name)) - if not self.disable_update_pre and getattr(chart, 'upgrade', - False): - pre_actions = getattr(chart.upgrade, 'pre', {}) + LOG.info("Checking Pre/Post Actions") + upgrade = entry.get('chart', {}).get('upgrade', False) + if upgrade: + if not self.disable_update_pre and upgrade.get('pre', + False): + pre_actions = getattr(chart.upgrade, 'pre', {}) - if not self.disable_update_post and getattr(chart, 'upgrade', - False): - post_actions = getattr(chart.upgrade, 'post', {}) + if not self.disable_update_post and upgrade.get('post', + False): + LOG.info("Checking Post Actions") + post_actions = getattr(chart.upgrade, 'post', {}) # show delta for both the chart templates and the chart values # TODO(alanmeadows) account for .files differences