Hi Matt, thanks for the help!

I'm creating a blank file to add content. I thought the process was use

ansible-vault create filename.yml

and then it opens in your default editor to add content. Mine is Vim 7.3. 
I'm getting the error on create.

If I have an existing file with content already and use

ansible-vault encrypt filename.yml

it works fine. So does the decrypt command.

On Thursday, January 21, 2016 at 12:26:36 PM UTC-5, Matt Martz wrote:
>
> What contents are you putting in the vault file?  I can get this to happen 
> if I put nothing in the file.  In which case the following is the cause:
>
>   File 
> "/Users/matt/python_venvs/ansibledev/ansible/lib/ansible/parsing/vault/__init__.py",
>  
> line 249, in _shred_file_custom
>     for _ in range(0, file_len // chunk_len):
> ZeroDivisionError: integer division or modulo by zero
>
> But is this happening if you put content into the file?
>
> We should probably solve the above error regardless.
>
> Also, what EDITOR is being used on Ubuntu and Mac?  Are they both vim? 
> What versions?
>
> On Thu, Jan 21, 2016 at 10:48 AM, Victor Keenan <vic...@inspyre.com 
> <javascript:>> wrote:
>
>> It works on Ubuntu for me too. Just not on Mac OS X.
>>
>> On Thursday, January 21, 2016 at 11:40:49 AM UTC-5, Brian Coca wrote:
>>>
>>> I cannot reproduce this ... but I'm on linux ... 
>>>
>>> On Thu, Jan 21, 2016 at 11:09 AM, Victor Keenan <vic...@inspyre.com> 
>>> wrote: 
>>> > No, I'm trying to create a new file/vault. Here is what I'm entering 
>>> and the 
>>> > output... 
>>> > 
>>> > local ...pment/Ansible_Playbooks/server_lepr/vars(master) $ ls -an 
>>> > total 0 
>>> > drwxr-xr-x  2 501  20   68 Jan 21 11:07 . 
>>> > drwxr-xr-x  9 501  20  306 Jan 21 10:56 .. 
>>> > local ...pment/Ansible_Playbooks/server_lepr/vars(master) $ 
>>> ansible-vault 
>>> > create victor.yml -vvvv 
>>> > No config file found; using defaults 
>>> > New Vault password: 
>>> > Confirm New Vault password: 
>>> > ERROR! Unexpected Exception: [Errno 2] No such file or directory 
>>> > the full traceback was: 
>>> > 
>>> > 
>>> > Traceback (most recent call last): 
>>> >   File "/Users/VictorSK/ansible/bin/ansible-vault", line 85, in 
>>> <module> 
>>> >     sys.exit(cli.run()) 
>>> >   File "/Users/VictorSK/ansible/lib/ansible/cli/vault.py", line 119, 
>>> in run 
>>> >     self.execute() 
>>> >   File "/Users/VictorSK/ansible/lib/ansible/cli/__init__.py", line 99, 
>>> in 
>>> > execute 
>>> >     fn() 
>>> >   File "/Users/VictorSK/ansible/lib/ansible/cli/vault.py", line 151, 
>>> in 
>>> > execute_create 
>>> >     self.editor.create_file(self.args[0]) 
>>> >   File 
>>> "/Users/VictorSK/ansible/lib/ansible/parsing/vault/__init__.py", line 
>>> > 344, in create_file 
>>> >     self._edit_file_helper(filename) 
>>> >   File 
>>> "/Users/VictorSK/ansible/lib/ansible/parsing/vault/__init__.py", line 
>>> > 298, in _edit_file_helper 
>>> >     call(self._editor_shell_command(tmp_path)) 
>>> >   File 
>>> > 
>>> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py",
>>>  
>>>
>>> > line 522, in call 
>>> >     return Popen(*popenargs, **kwargs).wait() 
>>> >   File 
>>> > 
>>> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py",
>>>  
>>>
>>> > line 710, in __init__ 
>>> >     errread, errwrite) 
>>> >   File 
>>> > 
>>> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py",
>>>  
>>>
>>> > line 1335, in _execute_child 
>>> >     raise child_exception 
>>> > OSError: [Errno 2] No such file or directory 
>>> > local ...pment/Ansible_Playbooks/server_lepr/vars(master) $ 
>>> > 
>>> > 
>>> > On Thursday, January 21, 2016 at 11:05:26 AM UTC-5, Brian Coca wrote: 
>>> >> 
>>> >> are you trying to edit a non existant file? 
>>> >> 
>>> >> On Thu, Jan 21, 2016 at 11:01 AM, Victor Keenan <vic...@inspyre.com> 
>>> >> wrote: 
>>> >> > Thanks Brain! Progress, but now a different error... 
>>> >> > 
>>> >> > ERROR! Unexpected Exception: [Errno 2] No such file or directory 
>>> >> > the full traceback was: 
>>> >> > 
>>> >> > 
>>> >> > Traceback (most recent call last): 
>>> >> >   File "/Users/VictorSK/ansible/bin/ansible-vault", line 85, in 
>>> <module> 
>>> >> >     sys.exit(cli.run()) 
>>> >> >   File "/Users/VictorSK/ansible/lib/ansible/cli/vault.py", line 
>>> 119, in 
>>> >> > run 
>>> >> >     self.execute() 
>>> >> >   File "/Users/VictorSK/ansible/lib/ansible/cli/__init__.py", line 
>>> 99, 
>>> >> > in 
>>> >> > execute 
>>> >> >     fn() 
>>> >> >   File "/Users/VictorSK/ansible/lib/ansible/cli/vault.py", line 
>>> 151, in 
>>> >> > execute_create 
>>> >> >     self.editor.create_file(self.args[0]) 
>>> >> >   File 
>>> "/Users/VictorSK/ansible/lib/ansible/parsing/vault/__init__.py", 
>>> >> > line 
>>> >> > 344, in create_file 
>>> >> >     self._edit_file_helper(filename) 
>>> >> >   File 
>>> "/Users/VictorSK/ansible/lib/ansible/parsing/vault/__init__.py", 
>>> >> > line 
>>> >> > 298, in _edit_file_helper 
>>> >> >     call(self._editor_shell_command(tmp_path)) 
>>> >> >   File 
>>> >> > 
>>> >> > 
>>> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py",
>>>  
>>>
>>> >> > line 522, in call 
>>> >> >     return Popen(*popenargs, **kwargs).wait() 
>>> >> >   File 
>>> >> > 
>>> >> > 
>>> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py",
>>>  
>>>
>>> >> > line 710, in __init__ 
>>> >> >     errread, errwrite) 
>>> >> >   File 
>>> >> > 
>>> >> > 
>>> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py",
>>>  
>>>
>>> >> > line 1335, in _execute_child 
>>> >> >     raise child_exception 
>>> >> > OSError: [Errno 2] No such file or directory 
>>> >> > 
>>> >> > 
>>> >> > On Thursday, January 21, 2016 at 10:51:57 AM UTC-5, Brian Coca 
>>> wrote: 
>>> >> >> 
>>> >> >> fixed via 
>>> >> >> 
>>> >> >> 
>>> http://github.com/ansible/ansible/commit/f26adcc7da7f8e6605167203249648f7b0e74fb7
>>>  
>>> >> >> 
>>> >> >> On Thu, Jan 21, 2016 at 10:28 AM, Victor Keenan <
>>> vic...@inspyre.com> 
>>> >> >> wrote: 
>>> >> >> > Thanks Brian for the help! I'm using ansible 2.1.0 (devel 
>>> >> >> > 5e18bc5955). 
>>> >> >> > My 
>>> >> >> > -vvvv output is... 
>>> >> >> > 
>>> >> >> > Unexpected Exception: integer division or modulo by zero 
>>> >> >> > the full traceback was: 
>>> >> >> > 
>>> >> >> > 
>>> >> >> > Traceback (most recent call last): 
>>> >> >> >   File "/Users/VictorSK/ansible/bin/ansible-vault", line 85, in 
>>> >> >> > <module> 
>>> >> >> >     sys.exit(cli.run()) 
>>> >> >> >   File "/Users/VictorSK/ansible/lib/ansible/cli/vault.py", line 
>>> 119, 
>>> >> >> > in 
>>> >> >> > run 
>>> >> >> >     self.execute() 
>>> >> >> >   File "/Users/VictorSK/ansible/lib/ansible/cli/__init__.py", 
>>> line 
>>> >> >> > 99, 
>>> >> >> > in 
>>> >> >> > execute 
>>> >> >> >     fn() 
>>> >> >> >   File "/Users/VictorSK/ansible/lib/ansible/cli/vault.py", line 
>>> 151, 
>>> >> >> > in 
>>> >> >> > execute_create 
>>> >> >> >     self.editor.create_file(self.args[0]) 
>>> >> >> >   File 
>>> >> >> > "/Users/VictorSK/ansible/lib/ansible/parsing/vault/__init__.py", 
>>> >> >> > line 
>>> >> >> > 341, in create_file 
>>> >> >> >     self._edit_file_helper(filename) 
>>> >> >> >   File 
>>> >> >> > "/Users/VictorSK/ansible/lib/ansible/parsing/vault/__init__.py", 
>>> >> >> > line 
>>> >> >> > 298, in _edit_file_helper 
>>> >> >> >     self._shred_file(tmp_path) 
>>> >> >> >   File 
>>> >> >> > "/Users/VictorSK/ansible/lib/ansible/parsing/vault/__init__.py", 
>>> >> >> > line 
>>> >> >> > 281, in _shred_file 
>>> >> >> >     self._shred_file_custom(tmp_path) 
>>> >> >> >   File 
>>> >> >> > "/Users/VictorSK/ansible/lib/ansible/parsing/vault/__init__.py", 
>>> >> >> > line 
>>> >> >> > 248, in _shred_file_custom 
>>> >> >> >     for _ in range(0, file_len // chunk_len): 
>>> >> >> > ZeroDivisionError: integer division or modulo by zero 
>>> >> >> > 
>>> >> >> > 
>>> >> >> > On Thursday, January 21, 2016 at 10:06:40 AM UTC-5, Brian Coca 
>>> wrote: 
>>> >> >> >> 
>>> >> >> >> what version are you using? there was a bug that caused this 
>>> but it 
>>> >> >> >> has been fixed. Also output with -vvvv would be helfpul 
>>> >> >> >> 
>>> >> >> >> 
>>> >> >> >> 
>>> >> >> >> 
>>> >> >> >> -- 
>>> >> >> >> Brian Coca 
>>> >> >> > 
>>> >> >> > -- 
>>> >> >> > You received this message because you are subscribed to the 
>>> Google 
>>> >> >> > Groups 
>>> >> >> > "Ansible Project" group. 
>>> >> >> > To unsubscribe from this group and stop receiving emails from 
>>> it, 
>>> >> >> > send 
>>> >> >> > an 
>>> >> >> > email to ansible-proje...@googlegroups.com. 
>>> >> >> > To post to this group, send email to ansible...@googlegroups.com. 
>>>
>>> >> >> > To view this discussion on the web visit 
>>> >> >> > 
>>> >> >> > 
>>> >> >> > 
>>> https://groups.google.com/d/msgid/ansible-project/d48e57ba-1415-413e-93a1-f4b8b348d3e3%40googlegroups.com.
>>>  
>>>
>>> >> >> > 
>>> >> >> > For more options, visit https://groups.google.com/d/optout. 
>>> >> >> 
>>> >> >> 
>>> >> >> 
>>> >> >> -- 
>>> >> >> Brian Coca 
>>> >> > 
>>> >> > -- 
>>> >> > You received this message because you are subscribed to the Google 
>>> >> > Groups 
>>> >> > "Ansible Project" group. 
>>> >> > To unsubscribe from this group and stop receiving emails from it, 
>>> send 
>>> >> > an 
>>> >> > email to ansible-proje...@googlegroups.com. 
>>> >> > To post to this group, send email to ansible...@googlegroups.com. 
>>> >> > To view this discussion on the web visit 
>>> >> > 
>>> >> > 
>>> https://groups.google.com/d/msgid/ansible-project/de784f85-37ba-43dc-9f55-6848fdd4070e%40googlegroups.com.
>>>  
>>>
>>> >> > 
>>> >> > For more options, visit https://groups.google.com/d/optout. 
>>> >> 
>>> >> 
>>> >> 
>>> >> -- 
>>> >> Brian Coca 
>>> > 
>>> > -- 
>>> > You received this message because you are subscribed to the Google 
>>> Groups 
>>> > "Ansible Project" group. 
>>> > To unsubscribe from this group and stop receiving emails from it, send 
>>> an 
>>> > email to ansible-proje...@googlegroups.com. 
>>> > To post to this group, send email to ansible...@googlegroups.com. 
>>> > To view this discussion on the web visit 
>>> > 
>>> https://groups.google.com/d/msgid/ansible-project/3803c459-71d7-454a-99a1-760e8ae66808%40googlegroups.com.
>>>  
>>>
>>> > 
>>> > For more options, visit https://groups.google.com/d/optout. 
>>>
>>>
>>>
>>> -- 
>>> Brian Coca 
>>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Ansible Project" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to ansible-proje...@googlegroups.com <javascript:>.
>> To post to this group, send email to ansible...@googlegroups.com 
>> <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/e08236ce-43d2-41de-b6b2-52be0218fa63%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/ansible-project/e08236ce-43d2-41de-b6b2-52be0218fa63%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Matt Martz
> @sivel
> sivel.net
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/4f0c9ff0-b0ce-495a-ba70-3e67a7ccb776%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to