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

dev-env import sql requires user input #1561

Closed
ethitter opened this issue Nov 18, 2023 · 3 comments · Fixed by #1615
Closed

dev-env import sql requires user input #1561

ethitter opened this issue Nov 18, 2023 · 3 comments · Fixed by #1615
Assignees

Comments

@ethitter
Copy link

Expected/Desired Behavior

Run vip dev-env import sql without user input.

Actual Behavior

Command prompts if ES should be reindexed after import, even when environment was created with --elasticsearch=false flag.

Steps to Reproduce the Problem

  1. Run vip dev-env create (with or without --elasticsearch=false flag
  2. Run vip dev-env import sql [FILE]
  3. Observe that you're prompted to reindex ES.

Additional notes

I'm working on an automation that uses vip dev-env to set up an environment, import a database backup that VIP shipped to our S3 bucket, and run various WP-CLI commands against the environment. The ES-indexing prompt breaks the automation by requiring user input.

@sjinks sjinks self-assigned this Dec 8, 2023
@sjinks
Copy link
Member

sjinks commented Dec 8, 2023

What version of VIP CLI are you using?

This is what I see with the latest one:

$ vip dev-env info
Running validation steps...
✓ Check for Docker installation 
✓ Check for docker-compose installation 
✓ Check Docker connectivity 
✓ Check DNS resolution 
 SLUG              vip-local                                                                                               
 LOCATION          /home/volodymyr/.local/share/vip/dev-environment/vip-local                                              
 SERVICES          devtools, nginx, php, database, memcached, wordpress, vip-mu-plugins, demo-app-code                     
 NGINX URLS        http://vip-local.vipdev.lndo.site:8000/                                                                 
                   https://vip-local.vipdev.lndo.site:444/                                                                 
 DATABASE          127.0.0.1:32818                                                                                         
 STATUS            UP                                                                                                      
 LOGIN URL         http://vip-local.vipdev.lndo.site:8000/wp-admin/?vip-dev-autologin=8ec227b0-fc46-4486-b3ce-af6a09ce7bd8 
 DEFAULT USERNAME  vipgo                                                                                                   
 DEFAULT PASSWORD  password                                                                                                
 DOCUMENTATION     https://docs.wpvip.com/technical-references/vip-local-development-environment/                          

$ vip dev-env import sql data.sql
Running validation steps...
Finished processing 446 lines.

✅ SET @@SESSION.sql_log_bin statement was found 0 times.
✅ TRIGGER statement was found 0 times.
✅ DROP DATABASE statement was found 0 times.
✅ USE <DATABASE_NAME> statement was found 0 times.
✅ ALTER USER statement was found 0 times.
✅ DROP TABLE was found 13 times.
✅ CREATE TABLE was found 13 times.
 - wp_ prefix tables found: 13 
✅ ALTER TABLE statement was found 0 times.
✅ SET UNIQUE_CHECKS = 0 was found 0 times.
siteurl
✅ Siteurl/home options not pointing to lando domain was found 0 times.
✅ ENGINE != InnoDB was found 0 times.

mysql: [Warning] Using a password on the command line interface can be insecure.
Success: Database imported.
Success: The cache was flushed.
User "vipgo" already exits. Skipping creating it.

@sjinks
Copy link
Member

sjinks commented Dec 8, 2023

The prompt is shown only when Elasticsearch is enabled. This could also happen if you have VIP_ENABLE_VIP_SEARCH and VIP_ENABLE_VIP_SEARCH_QUERY_INTEGRATION constants defined.

@sjinks
Copy link
Member

sjinks commented Dec 8, 2023

You can run vip dev-env import sql data.sql < /dev/null to suppress prompts. When the stdin is not a TTY, the app won't prompt for reindex confirmation.

@sjinks sjinks linked a pull request Dec 8, 2023 that will close this issue
7 tasks
sjinks added a commit that referenced this issue Jan 12, 2024
feat(dev-env): add quiet mode for "import sql"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants