internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: ansible/ansible

Issue:
ansible-galaxy should not need roles directory to exist
Commit aa46fcf09 introduces a check to ensure that `roles_path` exists. 

However, previously, if roles_path did not exist, it just created the directories anyway. 
https://github.com/ansible/ansible/blob/devel/bin/ansible-galaxy#L547
On that basis I'm not sure that the check for whether the directory exists is in the right place (it's nice to just blow away the roles directory entirely sometimes and reinstall from rolesfile)

I would like to understand the reason for this commit (it doesn't seem to be linked to an issue or PR)

cc @jimi-c 



Discussion:

Resolving patch:
diff --git a/lib/ansible/utils/__init__.py b/lib/ansible/utils/__init__.py
--- a/lib/ansible/utils/__init__.py
+++ b/lib/ansible/utils/__init__.py
@@ -362,7 +362,7 @@ def repo_url_to_role_name(repo_url):
     # gets the role name out of a repo like 
     # http://git.example.com/repos/repo.git" => "repo"
 
-    if '://' not in repo_url:
+    if '://' not in repo_url and '@' not in repo_url:
         return repo_url
     trailing_path = repo_url.split('/')[-1]
     if trailing_path.endswith('.git'):
@@ -387,15 +387,12 @@ def role_spec_parse(role_spec):
   
     role_spec = role_spec.strip()
     role_version = ''
+    default_role_versions = dict(git='master', hg='tip')
     if role_spec == "" or role_spec.startswith("#"):
         return (None, None, None, None)
 
     tokens = [s.strip() for s in role_spec.split(',')]
     
-    if not tokens[0].endswith('.tar.gz'): 
-        # pick a reasonable default branch
-        role_version = 'master'
-
     # assume https://github.com URLs are git+https:// URLs and not
     # tarballs unless they end in '.zip'
     if 'github.com/' in tokens[0] and not tokens[0].startswith("git+") and not tokens[0].endswith('.tar.gz'):
@@ -412,6 +409,8 @@ def role_spec_parse(role_spec):
         role_name = tokens[2]
     else:
         role_name = repo_url_to_role_name(tokens[0])
+    if scm and not role_version:
+        role_version = default_role_versions.get(scm, '')
     return dict(scm=scm, src=role_url, version=role_version, name=role_name)
 
 


Test patch:
diff --git a/test/integration/galaxy_roles.yml b/test/integration/galaxy_roles.yml
--- a/test/integration/galaxy_roles.yml
+++ b/test/integration/galaxy_roles.yml
@@ -6,3 +6,8 @@
 
 - src: https://bitbucket.org/willthames/http-ansible-galaxy/get/master.tar.gz
   name: http-role
+
+- src: git@github.com:geerlingguy/ansible-role-php.git
+  scm: git
+  name: php
+
diff --git a/test/integration/galaxy_rolesfile b/test/integration/galaxy_rolesfile
--- a/test/integration/galaxy_rolesfile
+++ b/test/integration/galaxy_rolesfile
@@ -1,3 +1,4 @@
 git+http://bitbucket.org/willthames/git-ansible-galaxy,v1.4
 hg+http://bitbucket.org/willthames/hg-ansible-galaxy
 https://bitbucket.org/willthames/http-ansible-galaxy/get/master.tar.gz,,http-role
+git+git@github.com:geerlingguy/ansible-role-php.git
Repository: ansible/ansible

Issue:
failed to use variable for retries in the loop
##### Issue Type:

“Bug Report”
##### Ansible Version:

1.4.3
##### Environment:

RHEL 6.5
##### Summary:

we are trying to use the variable for the value of retries at loop. But always hit an error
##### Steps To Reproduce:

Run following playbook:

```
hosts: localhost 
     vars: tries: 5 
tasks:
     - name: test
       debug: msg="looping" 
       register: output 
       until: no 
       retries: "{{ tries | int }}" 
       delay: 1
```
##### Expected Results:

retries count is 5 
##### Actual Results:

get following error:

TASK: [test] ******************************************************************
fatal: [localhost] => Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/ansible/runner/init.py", line 394, in executor
execrc = self.executorinternal(host, new_stdin)
File "/usr/lib/python2.6/site-packages/ansible/runner/init.py", line 485, in executorinternal
return self.executorinternal_inner(host, self.module_name, self.module_args, inject, port, complex_args=complex_args)
File "/usr/lib/python2.6/site-packages/ansible/runner/init.py", line 694, in executorinternal_inner
for x in range(1, retries + 1):
TypeError: cannot concatenate 'str' and 'int' objects

FATAL: all hosts have already failed -- aborting



Discussion:
Looks like this is still an issue with 1.8.2?


Resolving patch:
diff --git a/lib/ansible/runner/__init__.py b/lib/ansible/runner/__init__.py
--- a/lib/ansible/runner/__init__.py
+++ b/lib/ansible/runner/__init__.py
@@ -1030,7 +1030,7 @@ def _executor_internal_inner(self, host, module_name, module_args, inject, port,
 
             cond = template.template(self.basedir, until, inject, expand_lists=False)
             if not utils.check_conditional(cond,  self.basedir, inject, fail_on_undefined=self.error_on_undefined_vars):
-                retries = self.module_vars.get('retries')
+                retries = template.template(self.basedir, self.module_vars.get('retries'), inject, expand_lists=False)
                 delay   = self.module_vars.get('delay')
                 for x in range(1, int(retries) + 1):
                     # template the delay, cast to float and sleep


Test patch:
Repository: ansible/ansible

Issue:
Ansible string variable values that contain dashes yield unexpected results when used in a conditional 
##### Issue Type:  Bug report
##### Ansible Version:

```
$ ansible-playbook --version
ansible-playbook 1.9 (devel f88e2e1f01) last updated 2014/12/11 11:21:42 (GMT -400)
  lib/ansible/modules/core: (detached HEAD 467ad65f73) last updated 2014/12/11 12:44:11 (GMT -400)
  lib/ansible/modules/extras: (detached HEAD b8071a8d5e) last updated 2014/12/11 12:44:13 (GMT -400)
  v2/ansible/modules/core: (detached HEAD cb69744bce) last updated 2014/12/11 12:44:14 (GMT -400)
  v2/ansible/modules/extras: (detached HEAD 8a4f07eecd) last updated 2014/12/11 12:44:16 (GMT -400)
  configured module search path = None
```
##### Environment:

Ubuntu 14.04 (N/A)
##### Summary:

Testing the truth value of a string variable should fail, if the variable has dashes in the value it will evaluate as true. 
##### Steps To Reproduce:

Example play:

```
- name: Test play
  hosts: all
  vars:
    with_dash: "a-value-with-dashes"
    without_dash: "without_dashes"
  tasks:
    - debug: msg="with_dash"
      when: with_dash
    - debug: msg="without_dash"
      when: without_dash
```
##### Actual Results:

```
TASK: [debug msg="with_dash"] ************************************************* 
ok: [localhost] => {
    "msg": "with_dash"
}

TASK: [debug msg="without_dash"] ********************************************** 
fatal: [localhost] => error while evaluating conditional: without_dashes
```
##### Expected Results:

```
TASK: [debug msg="with_dash"] ************************************************* 
fatal: [localhost] => error while evaluating conditional: with_dash
```



Discussion:
nevermind, its not the variable, its the value


Resolving patch:
diff --git a/lib/ansible/utils/__init__.py b/lib/ansible/utils/__init__.py
--- a/lib/ansible/utils/__init__.py
+++ b/lib/ansible/utils/__init__.py
@@ -269,7 +269,7 @@ def check_conditional(conditional, basedir, inject, fail_on_undefined=False):
 
     conditional = conditional.replace("jinja2_compare ","")
     # allow variable names
-    if conditional in inject and '-' not in str(inject[conditional]):
+    if conditional in inject:
         conditional = inject[conditional]
     conditional = template.template(basedir, conditional, inject, fail_on_undefined=fail_on_undefined)
     original = str(conditional).replace("jinja2_compare ","")


Test patch:
Repository: ansible/ansible

Issue:
fact cache unicode error
##### Issue Type:

Bug Report
##### Ansible Version:
- 1.8.1
##### Environment:
- Linux Ubuntu 11.4
##### Summary:

jsonfile fact caching use `json.dump` directly. If some UTF-8 character is included in the fact, the exception occurred. I think it should use util.jsonify instead.
##### Steps To Reproduce:

ansible-playbook to a host which produces UTF-8 facts such as `ansible_date_time['weekday']`
##### Expected Results:

a playbook runs.
##### Actual Results:

This exception occurred.

```
  File "/Users/shirou/Works/VEnvs/ansible/lib/python2.7/site-packages/ansible/utils/__init__.py", line 1638, in update_hash
    hash[key] = value
  File "/Users/shirou/Works/VEnvs/ansible/lib/python2.7/site-packages/ansible/cache/__init__.py", line 38, in __setitem__
    self._plugin.set(key, value)
  File "/Users/shirou/Works/VEnvs/ansible/lib/python2.7/site-packages/ansible/cache/jsonfile.py", line 76, in set
    json.dump(value, f, ensure_ascii=False)
  File "/usr/local/Cellar/python/2.7.8_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py", line 190, in dump
    fp.write(chunk)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 1-3: ordinal not in range(128)
```



Discussion:
There is also the problem in the redis cache. 


Resolving patch:
diff --git a/lib/ansible/cache/jsonfile.py b/lib/ansible/cache/jsonfile.py
--- a/lib/ansible/cache/jsonfile.py
+++ b/lib/ansible/cache/jsonfile.py
@@ -17,14 +17,12 @@
 
 import os
 import time
-import json
 import errno
 
 from ansible import constants as C
 from ansible import utils
 from ansible.cache.base import BaseCacheModule
 
-
 class CacheModule(BaseCacheModule):
     """
     A caching module backed by json files.
@@ -70,12 +68,11 @@ def set(self, key, value):
 
         cachefile = "%s/%s" % (self._cache_dir, key)
         try:
-            #TODO: check if valid keys can have invalid FS chars, base32?
             f = open(cachefile, 'w')
         except (OSError,IOError), e:
             utils.warning("error while trying to read %s : %s" % (cachefile, str(e)))
         else:
-            json.dump(value, f, ensure_ascii=False)
+            f.write(utils.jsonify(value))
         finally:
             f.close()
 
diff --git a/lib/ansible/cache/redis.py b/lib/ansible/cache/redis.py
--- a/lib/ansible/cache/redis.py
+++ b/lib/ansible/cache/redis.py
@@ -20,9 +20,9 @@
 # FIXME: can we store these as something else before we ship it?
 import sys
 import time
-import json
 
 from ansible import constants as C
+from ansible.utils import jsonify
 from ansible.cache.base import BaseCacheModule
 
 try:
@@ -65,7 +65,7 @@ def get(self, key):
         return json.loads(value)
 
     def set(self, key, value):
-        value2 = json.dumps(value)
+        value2 = jsonify(value)
         if self._timeout > 0: # a timeout of 0 is handled as meaning 'never expire'
             self._cache.setex(self._make_key(key), int(self._timeout), value2)
         else:


Test patch:
Repository: ansible/ansible

Issue:
systemd-journald assertions being triggered
I am triggering systemd assertions with this playbook:

``` yaml

---
- hosts: all
  tasks:
    - replace: dest=/tmp/foo regexp=foo replace=bar
```

Which boils down to the following in the `module_utils/basic.py`:

``` python
from systemd import journal
journal_args = ['MESSAGE=ansible-<stdin> Invoked with src=None directory_mode=None force=None remote_src=None dest=/tmp/foo selevel=None seuser=None serole=None replace=bar content=NOT_LOGGING_PARAMETER setype=None delimiter=None mode=None regexp=foo owner=None follow=False validate=None backup=False group=None ', 'MODULE=<stdin>', 'SRC=None', 'DIRECTORY_MODE=None', 'FORCE=None', 'REMOTE_SRC=None', 'DEST=/tmp/foo', 'SELEVEL=None', 'SEUSER=None', 'SEROLE=None', 'REPLACE=bar', 'CONTENT=NOT_LOGGING_PARAMETER', 'SETYPE=None', 'DELIMITER=None', 'MODE=None', 'REGEXP=foo', 'OWNER=None', 'FOLLOW=False', 'VALIDATE=None', 'BACKUP=False', 'GROUP=None']
journal.sendv(*journal_args)
```

Which triggers this issue with `systemd-216-13.fc21.x86_64`:

```
systemd-journal[13307]: Permanent journal is using 2.9G (max allowed 4.0G, trying to leave 4.0G free of 38.8G available → current limit 4.0G).
systemd-journald[13252]: Assertion 'n + 20 + (object_pid ? 11 : 0) <= m' failed at ../src/journal/journald-server.c:575, function dispatch_message_real(). Aborting.
systemd-journal[13307]: Journal started
systemd[1]: systemd-journald.service: main process exited, code=dumped, status=6/ABRT
systemd[1]: Unit systemd-journald.service entered failed state.
```



Discussion:

Resolving patch:
diff --git a/lib/ansible/module_utils/basic.py b/lib/ansible/module_utils/basic.py
--- a/lib/ansible/module_utils/basic.py
+++ b/lib/ansible/module_utils/basic.py
@@ -1104,12 +1104,11 @@ def _log_invocation(self):
             msg = msg.encode('utf-8')
 
         if (has_journal):
-            journal_args = ["MESSAGE=%s %s" % (module, msg)]
-            journal_args.append("MODULE=%s" % os.path.basename(__file__))
+            journal_args = [("MODULE", os.path.basename(__file__))]
             for arg in log_args:
-                journal_args.append(arg.upper() + "=" + str(log_args[arg]))
+                journal_args.append((arg.upper(), str(log_args[arg])))
             try:
-                journal.sendv(*journal_args)
+                journal.send("%s %s" % (module, msg), **dict(journal_args))
             except IOError, e:
                 # fall back to syslog since logging to journal failed
                 syslog.openlog(str(module), 0, syslog.LOG_USER)


Test patch:
Repository: ansible/ansible

Issue:
fetch: should use hostname instead of ip for directory name
##### Issue Type: Bug Report
##### Ansible Version: ansible 1.7.1
##### Environment: N/A
##### Summary:

As per the [Ansible Project discussion](https://groups.google.com/forum/?nomobile=true#!msg/ansible-project/ky01x1PY_H8/70c5jGGJolgJ) with @jimi-c and @mpdehaan, `fetch` should be using `inventory_hostname` rather than `conn.host` to name the download directory.

In the meantime, you can use this as a workaround:

`- fetch: src=/etc/hosts dest="/tmp/{{inventory_hostname}}/" flat=yes`
##### Steps To Reproduce:
- Create a task which uses the `fetch` module to pull down a file from one or more remote hosts
##### Expected Results:

File system tree is built using the hostname: 
![](https://s3.amazonaws.com/snaps.michaelwarkentin.com/scan-fs.yml__waveapps_2014-10-24_11-35-04.png)
##### Actual Results:

File system tree is built using the host ip: 
![](https://s3.amazonaws.com/snaps.michaelwarkentin.com/scan-fs.yml__waveapps_2014-10-24_11-36-32.png)



Discussion:

Resolving patch:
diff --git a/lib/ansible/runner/action_plugins/fetch.py b/lib/ansible/runner/action_plugins/fetch.py
--- a/lib/ansible/runner/action_plugins/fetch.py
+++ b/lib/ansible/runner/action_plugins/fetch.py
@@ -110,7 +110,7 @@ def run(self, conn, tmp, module_name, module_args, inject, complex_args=None, **
                 dest = utils.path_dwim(self.runner.basedir, dest)
         else:
             # files are saved in dest dir, with a subdir for each host, then the filename
-            dest = "%s/%s/%s" % (utils.path_dwim(self.runner.basedir, dest), conn.host, source_local)
+            dest = "%s/%s/%s" % (utils.path_dwim(self.runner.basedir, dest), inject['inventory_hostname'], source_local)
 
         dest = dest.replace("//","/")
 


Test patch:
Repository: ansible/ansible

Issue:
Backup (for file modules) is a broken feature (?)
Basically, backup_local uses the minutes as the lowest unit of time ("%Y-%m-%d@%H:%M~"). It implies that if two backups are done of the same file during the same minute, one will be lost. Wouldn't it be possible to improve it using a real timestamp? Or by at least adding the seconds?

If someone wants to rely on the backup option, the only reliable solution is to follow the command with a sleep 1 minute. It's hard to accept that.

Here is the current implementation : https://github.com/ansible/ansible/blob/5bc81f9ae7a0b13dab8a741081261660f1080727/lib/ansible/module_utils/basic.py#L1269



Discussion:

Resolving patch:
diff --git a/lib/ansible/module_utils/basic.py b/lib/ansible/module_utils/basic.py
--- a/lib/ansible/module_utils/basic.py
+++ b/lib/ansible/module_utils/basic.py
@@ -1268,8 +1268,8 @@ def sha256(self, filename):
 
     def backup_local(self, fn):
         '''make a date-marked backup of the specified file, return True or False on success or failure'''
-        # backups named basename-YYYY-MM-DD@HH:MM~
-        ext = time.strftime("%Y-%m-%d@%H:%M~", time.localtime(time.time()))
+        # backups named basename-YYYY-MM-DD@HH:MM:SS~
+        ext = time.strftime("%Y-%m-%d@%H:%M:%S~", time.localtime(time.time()))
         backupdest = '%s.%s' % (fn, ext)
 
         try:


Test patch:
Repository: ansible/ansible

Issue:
Shell checksum validation fails on large files
Current##### Issue Type:

Bug Report
##### Ansible Version:

ansible 1.8.2
  configured module search path = None
##### Environment:

Linux
##### Summary:

Current implementation reads whole file into memory. For files larger than available memory, it fails.
##### Steps To Reproduce:

Try fetching a large file from a remote server
##### Expected Results:

It should work
##### Actual Results:

 {"changed": false, "file": "/root/foobar-folyondar-sport.tar.gz", "msg": "unable to calculate the checksum of the remote file"}

(and the file does not get created locally)



Discussion:

Resolving patch:
diff --git a/lib/ansible/runner/shell_plugins/sh.py b/lib/ansible/runner/shell_plugins/sh.py
--- a/lib/ansible/runner/shell_plugins/sh.py
+++ b/lib/ansible/runner/shell_plugins/sh.py
@@ -98,7 +98,7 @@ def checksum(self, path, python_interp):
 
         test = "rc=flag; [ -r \'%(p)s\' ] || rc=2; [ -f \'%(p)s\' ] || rc=1; [ -d \'%(p)s\' ] && rc=3; %(i)s -V 2>/dev/null || rc=4; [ x\"$rc\" != \"xflag\" ] && echo \"${rc}\"\'  %(p)s\' && exit 0" % dict(p=path, i=python_interp)
         csums = [
-            "(%s -c 'import hashlib; print(hashlib.sha1(open(\"%s\", \"rb\").read()).hexdigest())' 2>/dev/null)" % (python_interp, path),      # Python > 2.4 (including python3)
+            "(%s -c 'import hashlib; BLOCKSIZE = 65536; hasher = hashlib.sha1();\nafile = open(\"%s\", \"rb\")\nbuf = afile.read(BLOCKSIZE)\nwhile len(buf) > 0:\n\thasher.update(buf)\n\tbuf = afile.read(BLOCKSIZE)\nafile.close()\nprint(hasher.hexdigest())' 2>/dev/null)" % (python_interp, path),      # Python > 2.4 (including python3)
             "(%s -c 'import sha; print(sha.sha(open(\"%s\", \"rb\").read()).hexdigest())' 2>/dev/null)" % (python_interp, path),        # Python == 2.4
         ]
 
diff --git a/v2/ansible/plugins/shell/sh.py b/v2/ansible/plugins/shell/sh.py
--- a/v2/ansible/plugins/shell/sh.py
+++ b/v2/ansible/plugins/shell/sh.py
@@ -98,7 +98,7 @@ def checksum(self, path, python_interp):
 
         test = "rc=flag; [ -r \'%(p)s\' ] || rc=2; [ -f \'%(p)s\' ] || rc=1; [ -d \'%(p)s\' ] && rc=3; %(i)s -V 2>/dev/null || rc=4; [ x\"$rc\" != \"xflag\" ] && echo \"${rc}\"\'  %(p)s\' && exit 0" % dict(p=path, i=python_interp)
         csums = [
-            "(%s -c 'import hashlib; print(hashlib.sha1(open(\"%s\", \"rb\").read()).hexdigest())' 2>/dev/null)" % (python_interp, path),      # Python > 2.4 (including python3)
+            "(%s -c 'import hashlib; BLOCKSIZE = 65536; hasher = hashlib.sha1();\nafile = open(\"%s\", \"rb\")\nbuf = afile.read(BLOCKSIZE)\nwhile len(buf) > 0:\n\thasher.update(buf)\n\tbuf = afile.read(BLOCKSIZE)\nafile.close()\nprint(hasher.hexdigest())' 2>/dev/null)" % (python_interp, path),      # Python > 2.4 (including python3)
             "(%s -c 'import sha; print(sha.sha(open(\"%s\", \"rb\").read()).hexdigest())' 2>/dev/null)" % (python_interp, path),        # Python == 2.4
         ]
 


Test patch:
Repository: ansible/ansible

Issue:
if hosts section contains list(dict) instead of list(str), stacktrace is dumped 
I used a list of dicts for the hosts section -- apparently not legal. But Ansbile does not explain where in my document the error is. 

```
- name: a section I did not want to put in a role
  hosts:
    - { host: group1, var_for_context: group1var }
    - { host: group2, var_for_context: group2var }
  sudo: true
  tasks:
    - name: a test
      shell: echo "hi"
```

The result is: 

```
Traceback (most recent call last):
  File "/usr/bin/ansible-playbook", line 309, in <module>
    sys.exit(main(sys.argv[1:]))
  File "/usr/bin/ansible-playbook", line 249, in main
    pb.run()
  File "/usr/lib/python2.7/dist-packages/ansible/playbook/__init__.py", line 305, in run
    play = Play(self, play_ds, play_basedir, vault_password=self.vault_password)
  File "/usr/lib/python2.7/dist-packages/ansible/playbook/play.py", line 122, in __init__
    hosts = ';'.join(hosts)
TypeError: sequence item 0: expected string, dict found
```

Apparently the 'hosts' section doesn't accept a list of dicts, like the roles section does. You can argue whether this would be useful (I hoped it would, because it seemed good for my use case). 

However, Ansible should at least say where in the yaml file the structure is incorrect ( a line number). Now it's just guesswork. 



Discussion:
This is ansible 1.7.2


Resolving patch:
diff --git a/lib/ansible/playbook/play.py b/lib/ansible/playbook/play.py
--- a/lib/ansible/playbook/play.py
+++ b/lib/ansible/playbook/play.py
@@ -128,7 +128,11 @@ def __init__(self, playbook, ds, basedir, vault_password=None):
         if hosts is None:
             raise errors.AnsibleError('hosts declaration is required')
         elif isinstance(hosts, list):
-            hosts = ';'.join(hosts)
+            try:
+                hosts = ';'.join(hosts)
+            except TypeError,e:
+                raise errors.AnsibleError('improper host declaration: %s' % str(e))
+
         self.serial           = str(ds.get('serial', 0))
         self.hosts            = hosts
         self.name             = ds.get('name', self.hosts)


Test patch:
Repository: ansible/ansible

Issue:
ansible-vault: missing editor message unclear
##### Issue Type:

Bug Report
##### Ansible Version:

```
ansible 1.8.2
  configured module search path = None
```
##### Environment:

Running Ubuntu 14.04.1 LTS.
##### Summary:

When ansible-vault invokes an editor, for example when creating a new file,
and that editor is not found,
the message presented is unclear about exactly what is going on.
##### Steps To Reproduce:
1. run: EDITOR=testing ansible-vault create test
##### Expected Results:

I expected ansible-vault to give me a bit more information to what was happening. For example, something like:

```
ERROR: Failed to launch editor: [Errno 2] No such file or directory
```

Maybe even what editor it was trying to launch.
##### Actual Results:

```
tyler@ubuntu:~$ EDITOR=testing ansible-vault create test
Vault password:
Confirm Vault password:
ERROR: [Errno 2] No such file or directory
```



Discussion:

Resolving patch:
diff --git a/lib/ansible/utils/vault.py b/lib/ansible/utils/vault.py
--- a/lib/ansible/utils/vault.py
+++ b/lib/ansible/utils/vault.py
@@ -203,7 +203,10 @@ def _edit_file_helper(self, existing_data=None, cipher=None):
             self.write_data(existing_data, tmp_path)
 
         # drop the user into an editor on the tmp file
-        call(self._editor_shell_command(tmp_path))
+        try:
+            call(self._editor_shell_command(tmp_path))
+        except OSError, e:
+           raise Exception("Failed to open editor (%s): %s" % (self._editor_shell_command(tmp_path)[0],str(e)))
         tmpdata = self.read_data(tmp_path)
 
         # create new vault


Test patch: