From ac806787cc9dc25d9e17d6242bada76515849eb8 Mon Sep 17 00:00:00 2001 From: Maksim Malchuk Date: Thu, 19 May 2016 20:25:35 +0300 Subject: [PATCH] Apply puppet on the master node for security module There is need to run puppet apply host manifest when some changes were made in the post_deployment phase in the security module. Change-Id: I88d409f7d4819e2662d51a4cf42719ccbda2a3bd Closes-Bug: #1583593 Signed-off-by: Maksim Malchuk --- fuelmenu/consts.py | 1 + fuelmenu/modules/security.py | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/fuelmenu/consts.py b/fuelmenu/consts.py index 1cec689..932e605 100644 --- a/fuelmenu/consts.py +++ b/fuelmenu/consts.py @@ -18,6 +18,7 @@ LOGFILE = "/var/log/fuelmenu.log" PUPPET_LOGFILE = "/var/log/puppet/fuelmenu-puppet.log" PUPPET_NAILGUN = "/etc/puppet/modules/fuel/examples/nailgun.pp" +PUPPET_FUEL_MASTER = "/etc/puppet/modules/fuel/examples/host.pp" SETTINGS_FILE = "/etc/fuel/astute.yaml" RELEASE_FILE = "/etc/fuel_release" diff --git a/fuelmenu/modules/security.py b/fuelmenu/modules/security.py index ce49aad..434eb4b 100644 --- a/fuelmenu/modules/security.py +++ b/fuelmenu/modules/security.py @@ -19,7 +19,10 @@ import urwid from fuelmenu.common import dialog from fuelmenu.common import modulehelper as helper from fuelmenu.common import network +from fuelmenu.common import puppet from fuelmenu.common import urwidwrapper as widget +from fuelmenu.common import utils +from fuelmenu import consts log = logging.getLogger('fuelmenu.security') @@ -91,9 +94,26 @@ class Security(urwid.WidgetWrap): if responses is False: log.error("Check failed. Not applying") return False + + if utils.is_post_deployment(): + self.parent.apply_tasks.add(self.apply_to_master) + self.save(responses) return True + def apply_to_master(self): + """Apply changes to the Fuel master""" + + msg = "Apply settings to Fuel master." + log.info(msg) + self.parent.footer.set_text(msg) + self.parent.refreshScreen() + + result, msg = puppet.puppetApplyManifest(consts.PUPPET_FUEL_MASTER) + + self.parent.footer.set_text(msg) + return result + def save(self, responses): newsettings = helper.ModuleHelper.make_settings_from_responses( responses)