|
20 | 20 |
|
21 | 21 | from cf_remote.cloud_data import aws_image_criteria, aws_defaults |
22 | 22 | from cf_remote.paths import cf_remote_dir, CLOUD_STATE_FPATH |
23 | | -from cf_remote.utils import whoami, copy_file, canonify, read_json |
| 23 | +from cf_remote.utils import CFRUserError, whoami, copy_file, canonify, read_json |
24 | 24 | from cf_remote import log |
25 | 25 | from cf_remote import cloud_data |
26 | 26 |
|
@@ -822,10 +822,25 @@ def spawn_vm_in_vagrant( |
822 | 822 | command_args.append("--no-provision") |
823 | 823 |
|
824 | 824 | log.debug("Starting the VM(s)") |
825 | | - result = subprocess.run(command_args, env=vagrant_env, stderr=subprocess.PIPE) |
| 825 | + try: |
| 826 | + result = subprocess.run(command_args, env=vagrant_env, stderr=subprocess.PIPE) |
| 827 | + except FileNotFoundError as e: |
| 828 | + raise CFRUserError( |
| 829 | + "'vagrant' not found - go to https://www.vagrantup.com/downloads to download and install vagrant ({}).".format( |
| 830 | + e |
| 831 | + ) |
| 832 | + ) |
826 | 833 |
|
827 | 834 | if result.returncode != 0: |
828 | | - raise Exception(result.stderr.decode()) |
| 835 | + print() |
| 836 | + log.error(result.stderr.decode()) |
| 837 | + raise CFRUserError( |
| 838 | + ( |
| 839 | + "vagrant exited with error code {}" |
| 840 | + + " - Make sure you have a working vagrant setup, install VirtualBox if you haven't already: " |
| 841 | + + "https://www.virtualbox.org/wiki/Downloads" |
| 842 | + ).format(result.returncode) |
| 843 | + ) |
829 | 844 |
|
830 | 845 | log.debug("Copying vagrant ssh config") |
831 | 846 |
|
|
0 commit comments