Use espera script de Vagrantfile para provisionamento - problema com arquivo não existente durante a execução

0

É possível usar o script de espera do Vagrantfile para provisionamento?

Parece que o arquivo dentro do script installOracle.exp não está presente no momento apropriado (consulte o log de erros):

spawn "/var/wminst/vm_provision/oracle_installer/installOracleDatabase.sh"

Arquivo está lá!:)

[vagrant@wemdbc01 ~]$ ls -la /var/wminst/vm_provision/oracle_installer/installOracleDatabase.sh
-rwxrwxrwx. 1 vagrant vagrant 541 May 25 08:43 /var/wminst/vm_provision/oracle_installer/installOracleDatabase.sh

Parte relacionada do meu Vagrantfile:

  [...]
  db.vm.synced_folder ".", "/vagrant", disabled: true
  db.vm.synced_folder "C:/Installers", "/var/wminst"
  db.vm.provision :shell, :inline  => "yum -y install expect"
  db.vm.provision :shell, :inline => "expect /var/wminst/vm_provision/oracle_installer/installOracle.exp" 
end

installOracle.exp:

#!/usr/bin/env expect

set timeout 20

spawn "/var/wminst/vm_provision/oracle_installer/installOracleDatabase.sh"

expect "replace Disk1/upgrade/gen_inst.sql?" { send "N\r" }
expect "Specify the HTTP port that will be used for Oracle Application Express" { send "\r" }
expect "Specify a port that will be used for the database listener" { send "\r" }
expect "initial configuration:" { send "root\r" }
expect "Confirm the password:" { send "root\r" }
expect "Do you want Oracle Database 11g Express Edition to be started on boot" { send "y\r" }
expect eof
expect eof
expect "Installation completed successfully." { send "\r" }
expect eof

Erro:

==> wemdbc01: Running provisioner: shell...
    wemdbc01: Running: inline script
==> wemdbc01: spawn /var/wminst/vm_provision/oracle_installer/installOracleDatabase.sh
==> wemdbc01: couldn't execute "/var/wminst/vm_provision/oracle_installer/installOracleDatabase.sh": no such file or directory
==> wemdbc01:     while executing
==> wemdbc01: "spawn "/var/wminst/vm_provision/oracle_installer/installOracleDatabase.sh""
==> wemdbc01:     (file "/var/wminst/vm_provision/oracle_installer/installOracle.exp" line 5)
The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what
went wrong.

Editar 1: Mudou:

#!/bin/bash

para

#!/usr/bin/env bash

Registro de erros agora:

==> wemdbc01: Running provisioner: shell...
    wemdbc01: Running: inline script
==> wemdbc01: spawn /var/wminst/vm_provision/oracle_installer/installOracleDatabase.sh
: No such file or directory bash
==> wemdbc01: expect: spawn id exp5 not open
==> wemdbc01:     while executing
==> wemdbc01: "expect "Specify the HTTP port that will be used for Oracle Application Express" { send "\r" }"
==> wemdbc01:     (file "/var/wminst/vm_provision/oracle_installer/installOracle.exp" line 8)
The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what
went wrong.
    
por Paweł Banach 25.05.2017 / 15:06

1 resposta

2

O script problemático foi produzido no Windows, o que significa que ele tinha novas linhas do DOS. Isso fez com que o script falhasse na execução da VM Unix.

O fato de a VM estar sendo executada no Windows não é um problema.

    
por 25.05.2017 / 16:34