From 321240524f72762ef526d18ec3cc484624d03b7b Mon Sep 17 00:00:00 2001 From: Mauro Torrez Date: Sat, 7 Sep 2019 19:41:18 -0300 Subject: [PATCH] run postconf inside container --- action_plugins/postconf.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/action_plugins/postconf.py b/action_plugins/postconf.py index 5a7b9dd..ec92ff4 100755 --- a/action_plugins/postconf.py +++ b/action_plugins/postconf.py @@ -43,28 +43,31 @@ class ActionModule(ActionBase): return '{}'.format(self._task.args.get(key, '')) if key in ('private', 'unprivileged', 'chroot', 'wakeup', 'process_limit'): return '{}'.format(self._task.args.get(key, '')) + if key == 'container_name': + return '{}'.format(self._task.args.get(key, 'postfix')) # no default value for key: return as-is return self._task.args.get(key) def runcmd(self, reg_name, cmd, param=None): + fullcmd = 'docker exec '+ self.getarg('container_name') + cmd try: if param: self.reg[param][reg_name] = self._execute_module( module_name='command', - module_args=dict(_raw_params=cmd) + module_args=dict(_raw_params=fullcmd) ) return self.reg[reg_name] = self._execute_module( module_name='command', - module_args=dict(_raw_params=cmd) + module_args=dict(_raw_params=fullcmd) ) except Exception as e: raise PfWorkflowError( "{}: {}; failed command line: {}".format( type(e).__name__, to_text(e), - cmd + fullcmd ) )