Bug#917114: ansible: crashes when trying to read vault variables

2018-12-26 Thread Yvan Masson
Le 24/12/2018 à 18:46, Harlan Lieberman-Berg a écrit :
> retitle 917114 ansible: crashes when running playbook in non-ascii path
> tag 917114 +confirmed +upstream
> thanks
> 
> On Mon, Dec 24, 2018 at 12:31 PM Yvan Masson
>  wrote:
>> The isdir() function gave me a hint: my playbook and other files are in
>> a path that contains character "é". I moved it to a path with only ASCII
>> chars and it fixed the issue. I am very surprised this type of issue
>> still exist in popular software like Ansible!
> 
> Bingo!
> 
> Yes, please -- when you do, please shoot a link over to this ticket so
> we can track it on this side.
> 
> It's quite possible that ansible upstream may be uninterested in
> fixing this as it will get fixed "automatically" when we switch to
> using python3.  We're working on that now, and we hope to have it
> finished in time to get into buster before the freeze.  They still
> advertise py2 support, though, so I consider it still a bug.
> 
Reported upstream to https://github.com/ansible/ansible/issues/50316

Thanks!



signature.asc
Description: OpenPGP digital signature


Bug#917114: ansible: crashes when trying to read vault variables

2018-12-24 Thread Harlan Lieberman-Berg
retitle 917114 ansible: crashes when running playbook in non-ascii path
tag 917114 +confirmed +upstream
thanks

On Mon, Dec 24, 2018 at 12:31 PM Yvan Masson
 wrote:
> The isdir() function gave me a hint: my playbook and other files are in
> a path that contains character "é". I moved it to a path with only ASCII
> chars and it fixed the issue. I am very surprised this type of issue
> still exist in popular software like Ansible!

Bingo!

Yes, please -- when you do, please shoot a link over to this ticket so
we can track it on this side.

It's quite possible that ansible upstream may be uninterested in
fixing this as it will get fixed "automatically" when we switch to
using python3.  We're working on that now, and we hope to have it
finished in time to get into buster before the freeze.  They still
advertise py2 support, though, so I consider it still a bug.

-- 
Harlan Lieberman-Berg
~hlieberman



Bug#917114: ansible: crashes when trying to read vault variables

2018-12-24 Thread Yvan Masson
Le 24/12/2018 à 02:07, Harlan Lieberman-Berg a écrit :
> On Sat, Dec 22, 2018 at 4:06 PM Yvan Masson  
> wrote:
>> Using testing, Ansible crashes when trying to read vault variables. I
>> see this issue since Ansible 2.6 at least.
> 
> Interesting!  Can you try to reproduce this with `LC_ALL=C LANG=C` ?
>
> Also, do you get the same error when you run the command without the
> verbosity flags? That error appears to be a unicode string problem
> related to some debug output.
> 
Output is similar without the verbosity flags. However, running it with
`LC_ALL=C LANG=C` was a very good idea:

ERROR! Unexpected Exception, this is probably a bug: 'ascii' codec can't
encode character u'\xe9' in position 24: ordinal not in range(128)
the full traceback was:

Traceback (most recent call last):
  File "/usr/bin/ansible-playbook", line 118, in 
exit_code = cli.run()
  File "/usr/lib/python2.7/dist-packages/ansible/cli/playbook.py", line
122, in run
results = pbex.run()
  File
"/usr/lib/python2.7/dist-packages/ansible/executor/playbook_executor.py",
line 81, in run
pb = Playbook.load(playbook_path,
variable_manager=self._variable_manager, loader=self._loader)
  File "/usr/lib/python2.7/dist-packages/ansible/playbook/__init__.py",
line 54, in load
pb._load_playbook_data(file_name=file_name,
variable_manager=variable_manager)
  File "/usr/lib/python2.7/dist-packages/ansible/playbook/__init__.py",
line 74, in _load_playbook_data
if os.path.isdir(plugin_path):
  File "/usr/lib/python2.7/genericpath.py", line 49, in isdir
st = os.stat(s)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in
position 24: ordinal not in range(128)


The isdir() function gave me a hint: my playbook and other files are in
a path that contains character "é". I moved it to a path with only ASCII
chars and it fixed the issue. I am very surprised this type of issue
still exist in popular software like Ansible!

I could not find a corresponding bug report upstream: would you like me
to report this issue upstream?

Regards,
Yvan



signature.asc
Description: OpenPGP digital signature


Bug#917114: ansible: crashes when trying to read vault variables

2018-12-23 Thread Harlan Lieberman-Berg
On Sat, Dec 22, 2018 at 4:06 PM Yvan Masson  wrote:
> Using testing, Ansible crashes when trying to read vault variables. I
> see this issue since Ansible 2.6 at least.

Interesting!  Can you try to reproduce this with `LC_ALL=C LANG=C` ?

Also, do you get the same error when you run the command without the
verbosity flags? That error appears to be a unicode string problem
related to some debug output.

-- 
Harlan Lieberman-Berg
~hlieberman



Bug#917114: ansible: crashes when trying to read vault variables

2018-12-22 Thread Yvan Masson
Package: ansible
Version: 2.7.5+dfsg-1
Severity: normal

Dear Maintainer,

Using testing, Ansible crashes when trying to read vault variables. I
see this issue since Ansible 2.6 at least.

For example, I have a playbook I run with:
  ansible-playbook -i host.ini -bkK --vault-id @prompt main.yml -vvv

The error is attached (ansible-crash.log).

The vault is:

$ANSIBLE_VAULT;1.1;AES256
38613831366531323432326436616438363765303566326439336563313534386533396236383035
3363363335383833303665326262666563646465363862330a336639646631336265613639666365
6239653234303533653934366536313765376135303162306432373662376638326634343432
3933633832353761300a333964393134316265653161633736656233306463346535313761303732
61653363623836383964663365663734346636323735623863396435303938306162663939363135
3634663662386334383263653430653965383162376532633664

And contains:

dyndns_pwd: 1234
smtpd_pwd: 1234

For reference, I asked on Ansible forums
(https://groups.google.com/forum/#!msg/ansible-project/WlPtOS2h1vE/fnlzbZv1BgAJ)
with no answer.

Best regards,
Yvan

-- System Information:
Debian Release: buster/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.18.0-3-amd64 (SMP w/4 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8),
LANGUAGE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages ansible depends on:
ii  python2.7.15-3
ii  python-crypto 2.6.1-9+b1
ii  python-cryptography   2.3-1
ii  python-httplib2   0.11.3-1
ii  python-jinja2 2.10-1
ii  python-netaddr0.7.19-1
ii  python-paramiko   2.4.2-0.1
ii  python-pkg-resources  40.6.2-1
ii  python-yaml   3.13-1

Versions of packages ansible recommends:
ii  python-jmespath   0.9.3-1
ii  python-kerberos   1.1.14-1+b1
ii  python-libcloud   2.3.0-3
ii  python-selinux2.8-1+b1
pn  python-winrm  
ii  python-xmltodict  0.11.0-2

Versions of packages ansible suggests:
pn  cowsay   
ii  sshpass  1.06-1

-- no debconf information
TASK [include_vars] **
task path: /some/path/to/playbook.yml:39
The full traceback is:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/ansible/executor/task_executor.py", line 140, in run
res = self._execute()
  File "/usr/lib/python2.7/dist-packages/ansible/executor/task_executor.py", line 612, in _execute
result = self._handler.run(task_vars=variables)
  File "/usr/lib/python2.7/dist-packages/ansible/plugins/action/include_vars.py", line 131, in run
self._load_files(self.source_file)
  File "/usr/lib/python2.7/dist-packages/ansible/plugins/action/include_vars.py", line 236, in _load_files
b_data, show_content = self._loader._get_file_contents(filename)
  File "/usr/lib/python2.7/dist-packages/ansible/parsing/dataloader.py", line 162, in _get_file_contents
return self._decrypt_if_vault_data(data, b_file_name)
  File "/usr/lib/python2.7/dist-packages/ansible/parsing/dataloader.py", line 132, in _decrypt_if_vault_data
b_data = self._vault.decrypt(b_vault_data, filename=b_file_name)
  File "/usr/lib/python2.7/dist-packages/ansible/parsing/vault/__init__.py", line 658, in decrypt
plaintext, vault_id, vault_secret = self.decrypt_and_get_vault_id(vaulttext, filename=filename)
  File "/usr/lib/python2.7/dist-packages/ansible/parsing/vault/__init__.py", line 743, in decrypt_and_get_vault_id
display.v('Decrypt%s successful with secret=%s and vault_id=%s' % (file_slug, vault_secret, vault_secret_id))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 36: ordinal not in range(128)

fatal: [home-server]: FAILED! => {
"msg": "Unexpected failure during module execution.", 
"stdout": ""
}


signature.asc
Description: OpenPGP digital signature