Skip to content

Commit

Permalink
Vagrantfile: fallback on 'varant_variables.yml.sample'
Browse files Browse the repository at this point in the history
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 3d27f9e)
  • Loading branch information
guits authored and dsavineau committed Aug 18, 2021
1 parent 492c2b5 commit da54ea5
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit da54ea5

Please sign in to comment.