deploy-tools icon indicating copy to clipboard operation
deploy-tools copied to clipboard

Fabric does not respect the IP address I set in Vagrantfile

Open nrrb opened this issue 11 years ago • 1 comments

Going by the instructions, after I add deploy-tools as a git submodule and copy the contents of examples to the root of my project, I edit Vagrantfile to set the IP address to something other than the default:

  config.vm.network :hostonly, "192.168.33.55"

After I've brought up the Vagrant box, if I try to run any fab commands I can see that it's still trying to use the default IP address "192.168.33.10":

$ fab vagrant_create_db:wordpress
Creating database: wordpress
[localhost] local: mysql -s --host=192.168.33.10 --user=root --password=root -e "create database wordpress;"
Warning: Using a password on the command line interface can be insecure.
ERROR 1007 (HY000) at line 1: Can't create database 'wordpress'; database exists

Fatal error: local() encountered an error (return code 1) while executing 'mysql -s --host=192.168.33.10 --user=root --password=root -e "create database wordpress;"'

Aborting.

This IP appears to be hard set in fablib/vagrant/init.py:

env.vagrant_host = '192.168.33.10'

When I edit this line to have the custom IP address I set in Vagrantfile, fab works splendidly:

$ fab vagrant_create_db:wordpress
Creating database: wordpress
[localhost] local: mysql -s --host=192.168.33.55 --user=root --password=root -e "create database wordpress;"
Warning: Using a password on the command line interface can be insecure.
Finished creating database!

Done.

This is a problem when I try to use deploy-tools on the same computer for more than one project at a time.

nrrb avatar Jul 16 '14 16:07 nrrb

Ideally, this knowledge would be stored in one place and used throughout the deploy tools.

I'm not sure how to address this. Maybe the IP address can be omitted from the Vagrantfile and retrieved programmatically in fabfile.py? Maybe fabfile.py can somehow be the source of this info for vagrant? Maybe we need a separate configuration file, but hopefully not.

This related to issue #7 in that both will need to be fixed if we plan on being able to run more than one instance of vagrant (via deploy tools) on a machine at once.

rnagle avatar Jul 18 '14 13:07 rnagle