Skip to content

Commit c166d77

Browse files
committed
Merge pull request #479 from nathansamson/vagrant-fixes
Thanks for fixing all these cases, @nathansamson.
2 parents 86160ce + db9404e commit c166d77

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

provider/vagrant.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ def build_node(node):
8888
# Make a folder for the VM with its own Vagrantfile. Vagrant will then create a .vagrant folder
8989
# there too when it first gets booted.
9090
node_dir = HOST_NODES_DIR + '/' + uid
91-
mkdir = 'mkdir -p ' + node_dir
92-
cp_tpl = 'echo "' + result.replace('"', '\\"') + '" > ' + node_dir + '/Vagrantfile'
91+
mkdir = 'mkdir -p "{}"'.format(node_dir)
92+
cp_tpl = 'echo "' + result.replace('"', '\\"') + '" > "{}/Vagrantfile"'.format(node_dir)
9393
_host_ssh(commands=[mkdir, cp_tpl], creds=node['creds'])
9494

9595
# Boot the VM
@@ -141,8 +141,8 @@ def destroy_node(node):
141141
"Aborted node destruction: attempting to 'rm -rf' unexpected directory")
142142

143143
# Completely remove the folder that contained the VM
144-
rm_vagrantfile = 'rm ' + node_dir + '/Vagrantfile'
145-
rm_node_dir = 'rm -rf ' + node_dir
144+
rm_vagrantfile = 'rm "{}/Vagrantfile"'.format(node_dir)
145+
rm_node_dir = 'rm -rf "{}"'.format(node_dir)
146146
_host_ssh(commands=[rm_vagrantfile, rm_node_dir], creds=node['creds'])
147147
except RuntimeError as err:
148148
# If we couldn't cd to the node dir, just log that as a warning
@@ -158,7 +158,7 @@ def _run_vagrant_command(node_id, args=[], creds={}):
158158
e.g. ['up', 'my_vm_name', '--no-provision']
159159
"""
160160

161-
cd = 'cd ' + HOST_NODES_DIR + '/' + node_id
161+
cd = 'cd "{}/{}"'.format(HOST_NODES_DIR, node_id)
162162
command = ['vagrant'] + [arg for arg in args if arg is not None]
163163
return _host_ssh(commands=[cd, ' '.join(command)], creds=creds)
164164

0 commit comments

Comments
 (0)