简体   繁体   中英

Vagrant & Puppet - error when using puphpet to import sql into mysql database

==> payments: Notice: /Stage[main]/Puphpet::Mysql::Install/Puphpet::Mysql::Databases[from puphpet::mysql::install]/Exec[users-import]/returns: sh: 1: cannot open db/dump.sql: No such file
==> payments: Error: mysql users < db/dump.sql && touch /opt/puphpet-state/db-import-users returned 2 instead of one of [0]
==> payments: Error: /Stage[main]/Puphpet::Mysql::Install/Puphpet::Mysql::Databases[from puphpet::mysql::install]/Exec[users-import]/returns: change from notrun to 0 failed: mysql users < db/dump.sql && touch /opt/puphpet-state/db-import-users returned 2 instead of one of [0]

On vagrant up I am getting the above error.

The sql import file is located within the db directory (see screenshot). I am thinking that perhaps the SQL file isn't getting copied to the VM in time? It is worth noting that I create three databases in the puphpet file and then import the sql when the last one is created. The sql file creates the tables and inserts some data.

Puphpet config for MySQL databases

databases:
    mysqlnd_b349iw3pewx1:
        name: sites
        sql: ''
    mysqlnd_b349iw3pewx2:
        name: ia
        sql: ''
    mysqlnd_b349iw3pewx3:
        name: users
        sql: '../db/dump.sql'

Directory structure

在此处输入图片说明

I am using puppet via puphpet.

If you're not sure about the path, as I mentioned in the comments just indicate the full path of the files

databases:
    mysqlnd_b349iw3pewx1:
        name: sites
        sql: ''
    mysqlnd_b349iw3pewx2:
        name: ia
        sql: ''
    mysqlnd_b349iw3pewx3:
        name: users
        sql: '/home/vagrant/db/dump.sql'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM