Project Vagrantfile's now use relative paths. This enables distribution of project's without having to mess with paths.

This commit is contained in:
thomashaw
2017-04-11 11:46:44 +01:00
parent d437d839df
commit 07eaad8199
4 changed files with 8 additions and 5 deletions

View File

@@ -24,9 +24,6 @@ BUILDS_SCHEMA_FILE = "#{ROOT_DIR}/lib/schemas/build_metadata_schema.xsd"
# Path to projects directory
PROJECTS_DIR = "#{ROOT_DIR}/projects"
# Path to environments directory
ENVIRONMENTS_DIR = "#{ROOT_DIR}/modules/build/environments"
# Path to modules directories
MODULES_DIR = "#{ROOT_DIR}/modules/"
VULNERABILITIES_DIR = "#{MODULES_DIR}vulnerabilities/"

View File

@@ -34,6 +34,7 @@ class ProjectFilesCreator
def write_files
FileUtils.mkpath "#{@out_dir}" unless File.exists?("#{@out_dir}")
FileUtils.mkpath "#{@out_dir}/puppet/" unless File.exists?("#{@out_dir}/puppet/")
FileUtils.mkpath "#{@out_dir}/environments/production/" unless File.exists?("#{@out_dir}/environments/production/")
threads = []
# for each system, create a puppet modules directory using librarian-puppet
@@ -48,6 +49,11 @@ class ProjectFilesCreator
GemExec.exe('librarian-puppet', path, 'install')
end
# Create environments/production/environment.conf - Required in Puppet 4+
efile = "#{@out_dir}/environments/production/environment.conf"
Print.std "Creating Puppet Environent file: #{efile}"
FileUtils.touch(efile)
vfile = "#{@out_dir}/Vagrantfile"
Print.std "Creating Vagrant file: #{vfile}"
template_based_file_write(VAGRANT_TEMPLATE_FILE, vfile)

View File

@@ -78,10 +78,10 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
}
<% end -%>
<%=module_name%>.module_path = "<%="puppet/#{system.name}/modules"%>"
<%=module_name%>.environment_path = "<%="#{ENVIRONMENTS_DIR}"%>"
<%=module_name%>.environment_path = "environments/"
<%=module_name%>.environment = "production"
<%=module_name%>.synced_folder_type = "rsync"
<%=module_name%>.manifests_path = "<%="#{ROOT_DIR}/#{selected_module.module_path}/"%>"
<%=module_name%>.manifests_path = "<%="puppet/#{system.name}/modules/#{selected_module.module_path_end}"%>"
<%=module_name%>.manifest_file = "<%="#{selected_module.module_path_end}.pp"%>"
end
<% end -%>