mirror of
https://github.com/sstent/Vagrant_Openstack.git
synced 2026-01-26 07:03:04 +00:00
adding new vcsrepo
This commit is contained in:
34
modules/vcsrepo/lib/puppet/provider/vcsrepo.rb
Normal file
34
modules/vcsrepo/lib/puppet/provider/vcsrepo.rb
Normal file
@@ -0,0 +1,34 @@
|
||||
require 'tmpdir'
|
||||
require 'digest/md5'
|
||||
require 'fileutils'
|
||||
|
||||
# Abstract
|
||||
class Puppet::Provider::Vcsrepo < Puppet::Provider
|
||||
|
||||
private
|
||||
|
||||
def set_ownership
|
||||
owner = @resource.value(:owner) || nil
|
||||
group = @resource.value(:group) || nil
|
||||
FileUtils.chown_R(owner, group, @resource.value(:path))
|
||||
end
|
||||
|
||||
def path_exists?
|
||||
File.directory?(@resource.value(:path))
|
||||
end
|
||||
|
||||
# Note: We don't rely on Dir.chdir's behavior of automatically returning the
|
||||
# value of the last statement -- for easier stubbing.
|
||||
def at_path(&block) #:nodoc:
|
||||
value = nil
|
||||
Dir.chdir(@resource.value(:path)) do
|
||||
value = yield
|
||||
end
|
||||
value
|
||||
end
|
||||
|
||||
def tempdir
|
||||
@tempdir ||= File.join(Dir.tmpdir, 'vcsrepo-' + Digest::MD5.hexdigest(@resource.value(:path)))
|
||||
end
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user