mirror of
https://github.com/ansible/awx.git
synced 2026-05-19 14:57:39 -02:30
Fix some encoding issues for custom inventory scripts
This commit is contained in:
@@ -291,7 +291,7 @@ class BaseTask(Task):
|
|||||||
continue
|
continue
|
||||||
elif hidden_re.search(k):
|
elif hidden_re.search(k):
|
||||||
env[k] = HIDDEN_PASSWORD
|
env[k] = HIDDEN_PASSWORD
|
||||||
elif urlpass_re.match(v):
|
elif type(v) == str and urlpass_re.match(v):
|
||||||
env[k] = urlpass_re.sub(HIDDEN_PASSWORD, v)
|
env[k] = urlpass_re.sub(HIDDEN_PASSWORD, v)
|
||||||
return env
|
return env
|
||||||
|
|
||||||
@@ -1047,7 +1047,7 @@ class RunInventoryUpdate(BaseTask):
|
|||||||
elif inventory_update.source == 'custom':
|
elif inventory_update.source == 'custom':
|
||||||
for env_k in inventory_update.source_vars_dict:
|
for env_k in inventory_update.source_vars_dict:
|
||||||
if env_k not in os.environ:
|
if env_k not in os.environ:
|
||||||
env[env_k] = inventory_update.source_vars_dict[env_k]
|
env[env_k] = unicode(inventory_update.source_vars_dict[env_k])
|
||||||
return env
|
return env
|
||||||
|
|
||||||
def build_args(self, inventory_update, **kwargs):
|
def build_args(self, inventory_update, **kwargs):
|
||||||
@@ -1119,7 +1119,7 @@ class RunInventoryUpdate(BaseTask):
|
|||||||
handle, path = tempfile.mkstemp(dir=runpath)
|
handle, path = tempfile.mkstemp(dir=runpath)
|
||||||
f = os.fdopen(handle, 'w')
|
f = os.fdopen(handle, 'w')
|
||||||
# Check that source_script is not none and exists and that .script is not an empty string
|
# Check that source_script is not none and exists and that .script is not an empty string
|
||||||
f.write(inventory_update.source_script.script)
|
f.write(inventory_update.source_script.script.encode('utf-8'))
|
||||||
f.close()
|
f.close()
|
||||||
os.chmod(path, stat.S_IRUSR|stat.S_IWUSR|stat.S_IXUSR)
|
os.chmod(path, stat.S_IRUSR|stat.S_IWUSR|stat.S_IXUSR)
|
||||||
args.append(runpath)
|
args.append(runpath)
|
||||||
|
|||||||
Reference in New Issue
Block a user