# -*- mode: ruby -*-
# vi: set ft=ruby :

#   Licensed under the Apache License, Version 2.0 (the "License");
#   you may not use this file except in compliance with the License.
#   You may obtain a copy of the License at
#
#       http://www.apache.org/licenses/LICENSE-2.0
#
#   Unless required by applicable law or agreed to in writing, software
#   distributed under the License is distributed on an "AS IS" BASIS,
#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#   See the License for the specific language governing permissions and
#   limitations under the License.

Vagrant.configure("2") do |config|
  required_plugins = %w( vagrant-vbguest vagrant-disksize )
  _retry = false
  required_plugins.each do |plugin|
      unless Vagrant.has_plugin? plugin
          system "vagrant plugin install #{plugin}"
          _retry=true
      end
  end
  if (_retry)
      exec "vagrant " + ARGV.join(' ')
  end
  config.disksize.size = "40GB"
  config.vm.box = "osm/osm-rel7"
  config.vm.network "forwarded_port", guest: 80, host: 8080
  config.vm.provider "virtualbox" do |vb|
    vb.memory = "6144"
    vb.cpus = 2
  end
  config.vm.provision "shell", name: "Post-provisión", privileged: false, inline: <<-SHELL
    /etc/osm/update_osm_info_docker.sh  # Updates IP address for Docker Swarm
  SHELL
end
