simplificando config
This commit is contained in:
@@ -22,6 +22,7 @@ import re
|
||||
from ansible.plugins.action import ActionBase
|
||||
from ansible.utils.vars import merge_hash
|
||||
from ansible.module_utils._text import to_text
|
||||
from six import string_types
|
||||
|
||||
class PfWorkflowError(Exception):
|
||||
pass
|
||||
@@ -29,7 +30,7 @@ class PfWorkflowError(Exception):
|
||||
class ActionModule(ActionBase):
|
||||
|
||||
def getarg(self, key, default=True):
|
||||
if isinstance(default, basestring):
|
||||
if isinstance(default, string_types):
|
||||
if key == 'parameter':
|
||||
return self._task.args.get(key, default)
|
||||
return '{}'.format(self._task.args.get(key, default))
|
||||
@@ -234,7 +235,7 @@ class ActionModule(ActionBase):
|
||||
'''
|
||||
|
||||
# value should be string
|
||||
if not isinstance(value, basestring):
|
||||
if not isinstance(value, string_types):
|
||||
try:
|
||||
value = ', '.join(value)
|
||||
except TypeError:
|
||||
@@ -341,7 +342,7 @@ class ActionModule(ActionBase):
|
||||
state = self.getarg('state')
|
||||
if parameter:
|
||||
# build (parameter, value) pairs for iteration
|
||||
if isinstance(parameter, basestring):
|
||||
if isinstance(parameter, string_types):
|
||||
pv = [ (parameter, self.getarg('value')) ]
|
||||
elif isinstance(parameter, dict):
|
||||
# if dict ignore new_value
|
||||
|
||||
Reference in New Issue
Block a user