getdave / grunt-deployments

MYSQL database deployments using GruntJS
MIT License
72 stars 34 forks source link

Error: Missing argument, -n or --name is required #44

Open davemac opened 10 years ago

davemac commented 10 years ago

I'm testing the feature/advanced-search-replace branch and when I run:

grunt db_pull --src="production" --dest="local"

I get the following error:

Error: Missing argument, -n or --name is required

I realise that argument is required by advanced-search-replace, but shouldn't the script already have that info from the Gruntfile?

I tried `grunt db_pull --src="production" --dest="local" -n {database-name} and a few combinations of that, but now get:

>> Local Npm module "{database-name}" not found. Is it installed?

davemac commented 10 years ago

This is still an issue even, when #43 is resolved.

davemac commented 10 years ago

Here's what happens:

$ grunt db_pull --src="production" --dest="local"

Running "db_pull" task

Pulling database from 'Production' into Local
Creating dump of Production database
>> Database dump succesfully exported to:
>> backups/production/20140514/15-15-41/db_backup.sql
Creating dump of Local database
Enter password: 
>> Database dump succesfully exported to:
>> backups/local/20140514/15-15-41/db_backup.sql
Importing into Local database
Enter password: 
>> Database imported succesfully
Replacing 'www.deadlys.com.au' with 'deadlys.localhost' in the database

Error: Missing argument, -n or --name is required.
Please enter the missing arguments.
>> Database references succesfully updated.

Operations completed

Done, without errors.

The production database has been pulled down and the local one backed up, but the search replace hasn't happened.

getdave commented 10 years ago

Initial look

This is the param that's missing.

The param is included in the LoDash template which is used by Grunt Deployments (see here)

Your error suggests that the database param isn't being passed into the LoDash template from the task. If we look here we see the database param is passed via the config object.

The config object is in turn supplied to the dbReplace function (see here).

This config in turn comes from here.

Hopefully this breaks things down a little. Are you sure you have the correct options supplied in the task config block in your Gruntfile? Specifically have you provided the database?

I hope that helps a bit.

davemac commented 10 years ago

Thanks Dave, but yes I have supplied the database as far as I can see.

As I mentioned, it is actually pulling the production database down to my local machine. So the credentials, as far as I know, are OK:

deployments: {
            options: {

            },
            local: {
                "title": "Local",
                "database": "hhmc-new",
                "user": "root",
                "pass": "",
                "host": "localhost",
                "url": "hhmc-new.localhost"
            },
            production: {
                "title": "Production",
                "database": "{I have the database name here}",
                "user": "{I have the database user here}",
                "pass": "{I have the database password here}",
                "host": "{I have my database host URL here}",
                "url": "{I have production URL here}",
                "ssh_user": "{I have my SSH user here}", 
                "ssh_host": "{I have my SSH host here}"
            }
        },