Sha256: ed57358b860fe37fa74a7c11c89ecc7f18e53d26ae480ae7ab096ebda7cf9a41

Contents?: true

Size: 898 Bytes

Versions: 5

Compression:

Stored size: 898 Bytes

Contents

require 'chef/provider/lwrp_base'
require 'chef_metal/provider_action_handler'

class Chef::Provider::VagrantCluster < Chef::Provider::LWRPBase

  include ChefMetal::ProviderActionHandler

  use_inline_resources

  def whyrun_supported?
    true
  end

  action :create do
    the_base_path = new_resource.path
    ChefMetal.inline_resource(self) do
      directory the_base_path
      file ::File.join(the_base_path, 'Vagrantfile') do
        content <<EOM
Dir.glob('#{::File.join(the_base_path, '*.vm')}') do |vm_file|
  eval(IO.read(vm_file), nil, vm_file)
end
EOM
      end
    end
  end

  action :delete do
    the_base_path = new_resource.path
    ChefMetal.inline_resource(self) do
      file ::File.join(the_base_path, 'Vagrantfile') do
        action :delete
      end
      directory the_base_path do
        action :delete
      end
    end
  end

  def load_current_resource
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
chef-metal-vagrant-0.3.1 lib/chef/provider/vagrant_cluster.rb
chef-metal-vagrant-0.3 lib/chef/provider/vagrant_cluster.rb
chef-metal-vagrant-0.2 lib/chef/provider/vagrant_cluster.rb
chef-metal-vagrant-0.1 lib/chef/provider/vagrant_cluster.rb
chef-metal-0.5 lib/chef/provider/vagrant_cluster.rb