From da54ea555ef8e49585ef7c63057e2c8c6f3d9bc2 Mon Sep 17 00:00:00 2001 From: Guillaume Abrioux Date: Tue, 10 Aug 2021 16:11:37 +0200 Subject: [PATCH] Vagrantfile: fallback on 'varant_variables.yml.sample' When using a vagrant command from the root directory of the repo, it throws an error if no 'vagrant_variables.yml' file is present. ``` Message: Errno::ENOENT: No such file or directory @ rb_sysopen - /home/guits/workspaces/ceph-ansible/vagrant_variables.yml ``` Signed-off-by: Guillaume Abrioux (cherry picked from commit 3d27f9e7dc7ee775be57c27c3620009f9935ddcc) --- Vagrantfile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Vagrantfile b/Vagrantfile index 1398c4c9f0..c5434bb82e 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -4,7 +4,13 @@ require 'yaml' VAGRANTFILE_API_VERSION = '2' -config_file=File.expand_path(File.join(File.dirname(__FILE__), 'vagrant_variables.yml')) +if File.file?(File.join(File.dirname(__FILE__), 'vagrant_variables.yml')) then + vagrant_variables_file = 'vagrant_variables.yml' +else + vagrant_variables_file = 'vagrant_variables.yml.sample' +end + +config_file=File.expand_path(File.join(File.dirname(__FILE__), vagrant_variables_file)) settings=YAML.load_file(config_file)