From 88a20e7a20926728e20f498b5c4efd707ebe38fe Mon Sep 17 00:00:00 2001 From: Abhijit Menon-Sen Date: Thu, 10 Sep 2015 10:07:19 +0530 Subject: [PATCH] Fix broken integration test with unicode hostnames 1. The test did "name: '{{hostnames}}.{{item}}'" inside a with_sequence loop, which didn't do what was intended: it expanded hostnames into an array, appended ".1", and set name to the resulting string. This can be converted to a simple with_items loop. 2. Some of the entries in hostnames contained punctuation characters, which I see no reason to support in inventory hostnames anyway. 3. Once the add_host failures are fixed, the playbook later fails when the unicode hostnames are interpolated into debug output in ssh.py due to an encoding error. This is only one of the many places that may fail when using unicode inventory hostnames; we work around it by providing an ansible_ssh_host setting. --- test/integration/unicode.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/test/integration/unicode.yml b/test/integration/unicode.yml index 1044c25270..6e8e073a79 100644 --- a/test/integration/unicode.yml +++ b/test/integration/unicode.yml @@ -4,10 +4,9 @@ connection: local vars: test_var: 'Ī ī Ĭ ĭ Į į İ ı IJ ij Ĵ ĵ Ķ ķ ĸ Ĺ ĺ Ļ ļ Ľ ľ Ŀ ŀ Ł ł Ń ń Ņ ņ Ň ň ʼn Ŋ ŋ Ō ō Ŏ ŏ Ő ő Œ' - num_hosts: 5 hostnames: - - 'host-#ϬϭϮϯϰ' - - 'host-ͰͱͲͳʹ͵' + - 'host-ϬϭϮϯϰ' + - 'host-fóöbär' - 'host-ΙΚΛΜΝΞ' - 'host-στυφχψ' - 'host-ϬϭϮϯϰϱ' @@ -29,11 +28,11 @@ - 'ā Ă ă Ą ą Ć ć Ĉ ĉ Ċ ċ Č č Ď ď Đ đ Ē ē Ĕ ĕ Ė ė Ę ę Ě ě Ĝ ĝ Ğ ğ Ġ ġ Ģ ģ Ĥ ĥ Ħ ħ Ĩ ĩ' - add_host: - name: '{{hostnames}}.{{item}}' + name: '{{item}}' groups: 'ĪīĬĭ' + ansible_ssh_host: 127.0.0.1 ansible_connection: local - host_id: '{{item}}' - with_sequence: start=1 end={{num_hosts}} format=%d + with_items: hostnames - name: 'A task with unicode extra vars' debug: var=extra_var