aboutsummaryrefslogtreecommitdiff
path: root/ansible/action_plugins
diff options
context:
space:
mode:
authorJeffrey Zhang <jeffrey.zhang@99cloud.net>2016-05-27 01:04:03 +0800
committerJeffrey Zhang <jeffrey.zhang@99cloud.net>2016-05-30 23:02:09 +0800
commit3545e6d503c7451921333134fb75d3fef3713952 (patch)
tree85b8eaea64b145dcda82f86540db5423d2ad425d /ansible/action_plugins
parentb40bf517aeb894ed4b79985f66405507e0725ebd (diff)
downloadkolla-3545e6d503c7451921333134fb75d3fef3713952.tar.gz
kolla-3545e6d503c7451921333134fb75d3fef3713952.zip
Fix the incompatibility for ansible 2.1.0
Ansible 2.1.0 has lots of change and the plugin is not compatible between 2.0.0 and 2.1.0. This change fix the gap. * fix the signature change for _make_tmp_path in ansible 2.1.0 * fix the common_options in the kolla_docker.py Change-Id: I05f5f05581c8bd625cd868fa0db549d0c60a7043 Closes-Bug: #1586018
Diffstat (limited to 'ansible/action_plugins')
-rw-r--r--ansible/action_plugins/merge_configs.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/ansible/action_plugins/merge_configs.py b/ansible/action_plugins/merge_configs.py
index b5df51fdc..556f6233f 100644
--- a/ansible/action_plugins/merge_configs.py
+++ b/ansible/action_plugins/merge_configs.py
@@ -16,6 +16,7 @@
from ConfigParser import ConfigParser
from cStringIO import StringIO
+import inspect
import os
from ansible.plugins.action import ActionBase
@@ -41,8 +42,16 @@ class ActionModule(ActionBase):
task_vars = dict()
result = super(ActionModule, self).run(tmp, task_vars)
- if not tmp:
+ # NOTE(jeffrey4l): Ansible 2.1 add a remote_user param to the
+ # _make_tmp_path function. inspect the number of the args here. In
+ # this way, ansible 2.0 and ansible 2.1 are both supported
+ make_tmp_path_args = inspect.getargspec(self._make_tmp_path)[0]
+ if not tmp and len(make_tmp_path_args) == 1:
tmp = self._make_tmp_path()
+ if not tmp and len(make_tmp_path_args) == 2:
+ remote_user = (task_vars.get('ansible_ssh_user')
+ or self._play_context.remote_user)
+ tmp = self._make_tmp_path(remote_user)
sources = self._task.args.get('sources', None)
extra_vars = self._task.args.get('vars', list())