]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
Vagrantfile: fallback on 'varant_variables.yml.sample'
authorGuillaume Abrioux <gabrioux@redhat.com>
Tue, 10 Aug 2021 14:11:37 +0000 (16:11 +0200)
committerDimitri Savineau <savineau.dimitri@gmail.com>
Wed, 18 Aug 2021 15:08:13 +0000 (11:08 -0400)
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 <gabrioux@redhat.com>
(cherry picked from commit 3d27f9e7dc7ee775be57c27c3620009f9935ddcc)

Vagrantfile

index 9493a3873225d4048b84bb1b166d2bbbf4293973..2ce4d5f8c5d9ace20bd58b6d4aa97f399120e692 100644 (file)
@@ -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)