Add support for alternative modulepath
This commit is contained in:
10
Rakefile
10
Rakefile
@@ -8,21 +8,24 @@
|
|||||||
require 'puppet'
|
require 'puppet'
|
||||||
|
|
||||||
repo_file = 'other_repos.yaml'
|
repo_file = 'other_repos.yaml'
|
||||||
|
default_modulepath = '/etc/puppet/modules'
|
||||||
|
|
||||||
namespace :modules do
|
namespace :modules do
|
||||||
desc 'clone all required modules'
|
desc 'clone all required modules'
|
||||||
task :clone do
|
task :clone do
|
||||||
repo_hash = YAML.load_file(File.join(File.dirname(__FILE__), repo_file))
|
repo_hash = YAML.load_file(File.join(File.dirname(__FILE__), repo_file))
|
||||||
repos = (repo_hash['repos'] || {})
|
repos = (repo_hash['repos'] || {})
|
||||||
|
modulepath = (repo_hash['modulepath'] || default_modulepath)
|
||||||
repos_to_clone = (repos['repo_paths'] || {})
|
repos_to_clone = (repos['repo_paths'] || {})
|
||||||
branches_to_checkout = (repos['checkout_branches'] || {})
|
branches_to_checkout = (repos['checkout_branches'] || {})
|
||||||
repos_to_clone.each do |remote, local|
|
repos_to_clone.each do |remote, local|
|
||||||
# I should check to see if the file is there?
|
# I should check to see if the file is there?
|
||||||
output = `git clone #{remote} #{local}`
|
outpath = File.join(modulepath, local)
|
||||||
|
output = `git clone #{remote} #{outpath}`
|
||||||
Puppet.debug(output)
|
Puppet.debug(output)
|
||||||
end
|
end
|
||||||
branches_to_checkout.each do |local, branch|
|
branches_to_checkout.each do |local, branch|
|
||||||
Dir.chdir(local) do
|
Dir.chdir(File.join(modulepath, local)) do
|
||||||
output = `git checkout #{branch}`
|
output = `git checkout #{branch}`
|
||||||
end
|
end
|
||||||
# Puppet.debug(output)
|
# Puppet.debug(output)
|
||||||
@@ -33,11 +36,12 @@ namespace :modules do
|
|||||||
task 'status' do
|
task 'status' do
|
||||||
repo_hash = YAML.load_file(File.join(File.dirname(__FILE__), repo_file))
|
repo_hash = YAML.load_file(File.join(File.dirname(__FILE__), repo_file))
|
||||||
repos = (repo_hash['repos'] || {})
|
repos = (repo_hash['repos'] || {})
|
||||||
|
modulepath = (repo_hash['modulepath'] || default_modulepath)
|
||||||
repos_to_clone = (repos['repo_paths'] || {})
|
repos_to_clone = (repos['repo_paths'] || {})
|
||||||
branches_to_checkout = (repos['checkout_branches'] || {})
|
branches_to_checkout = (repos['checkout_branches'] || {})
|
||||||
repos_to_clone.each do |remote, local|
|
repos_to_clone.each do |remote, local|
|
||||||
# I should check to see if the file is there?
|
# I should check to see if the file is there?
|
||||||
Dir.chdir(local) do
|
Dir.chdir(File.join(modulepath, local)) do
|
||||||
puts "Checking status of #{local}"
|
puts "Checking status of #{local}"
|
||||||
puts `git status`
|
puts `git status`
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user