Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MySQL Dump target should not have hardcoded path #224

Open
ShaunaGordon opened this issue Jun 17, 2015 · 9 comments
Open

MySQL Dump target should not have hardcoded path #224

ShaunaGordon opened this issue Jun 17, 2015 · 9 comments

Comments

@ShaunaGordon
Copy link

The code in mysql/main.yml hard codes "/vagrant/" into the dump target path:

mysql_db: target=/vagrant/{{ mysql.dump }}

This fails when the input path is absolute, or if the share root is different from "/vagrant/". This should probably be configurable and/or autodetected when generating the file.

@naxhh
Copy link
Contributor

naxhh commented Jun 17, 2015

I've never used this feature.. can you tell me how do you use it?
When you say absolute path you use always te document root path or do you specify a new shared folder in the vagrantfile and then you specify that path?

@ShaunaGordon
Copy link
Author

phansible.com provides a "sql dump" field, but doesn't give any indication whether it should be an absolute or relative path, so I put in the absolute path.

In my case, I have my host vagrant folder mapped to /var/www/project in the vagrant box, so my MySQL dump location is something like /var/www/project/myDump.sql. With the "/vagrant/" hardcoded, Ansible sees it as "/vagrant//var/www/project/myDump.sql" which obviously fails.

I can see a few of ways of dealing with this:

  1. Notify users on input to fill in the field with a path relative to /vagrant.
  2. Remove the /vagrant/ hardcoding and have the user put in an absolute or relative path (and note to where it's relative on the website)
  3. Auto-detect whether it's an absolute or relative path and adjust the playbook file accordingly (this is probably a little more involved, but can allow for a future feature of allowing the vm-side sync folder to be customized from within the Phansible interface if desired).

@naxhh
Copy link
Contributor

naxhh commented Jun 17, 2015

hmm

I think the more flexible solution is to force the user to specify the full path (also tell him that the full path is expected)

This way you can map a new folder for the dumps or create a specific app task that copy the dumps from one place to that folder. And you are not required to keep them with your codebase, but you can if you want...

Will that fit your use case?
I'll also wait for some input from other people to see if there are more points of view from this :)

@mikeSimonson
Copy link
Contributor

I also think forcing the full path is the simplest solution.

@ShaunaGordon
Copy link
Author

Agreed. The full path was what I defaulted to when not given indication of how it should be entered, so it follows my use case.

@naxhh
Copy link
Contributor

naxhh commented Dec 7, 2015

As a summary the task should be:

@naxhh naxhh modified the milestones: 0.7.4, 0.7.3 Dec 7, 2015
@debo
Copy link
Member

debo commented Feb 16, 2016

@naxhh wouldn't be actually better to inherit the path from the shared folder one?

@naxhh
Copy link
Contributor

naxhh commented Feb 17, 2016

I don't normally keep the sql dumps in the same place as the code. So for me is better to give flexibility on this.
I do create a new shared path and load sql from them. But maybe the most common case will be to use the default path and allow it to change from the options.

I let the decision to you. The main priority of the task thought is to add an explanation if full or relative path should be added.

@debo
Copy link
Member

debo commented Feb 17, 2016

What I meant is that at present we have two shared path, the default shared one and the document root, I generally share the code in the document root and everything else in the main shared folder. But yes I think it's all down to make clearer what's what.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants