Пример #1
0
// Render generates the packer.json and Autounattend.xml files used by Packer
func (e *engine) Render(tc tpl.TemplateContainer) error {
	if err := e.createOutputDir(); err != nil {
		return err
	}
	for _, t := range tc.ListTemplates() {
		if err := e.writeTemplate(t); err != nil {
			return err
		}
	}
	return nil
}
Пример #2
0
import (
	"bytes"
	"io/ioutil"
	"os"
	"path/filepath"
	"strings"

	"github.com/joefitzgerald/inductor/tpl"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("Tpl", func() {
	var (
		err       error
		osName    string
		tmpDir    string
		templates tpl.TemplateContainer
	)
	BeforeEach(func() {
		tmpDir, err = ioutil.TempDir("", "inductor")
		Expect(err).NotTo(HaveOccurred())
		createTemplateFile(tmpDir, "nano/Autounattend.xml.disks.partial")
		createTemplateFile(tmpDir, "nano/packer.json.provisioners.partial")
		createTemplateFile(tmpDir, "windowsxp/Autounattend.xml.template")
		createTemplateFile(tmpDir, "scripts/win-updates.ps1")
		createTemplateFile(tmpDir, "scripts/nano/SetupComplete.cmd")
		createTemplateFile(tmpDir, "inductor.json")
		createTemplateFile(tmpDir, "README.md")
		createTemplateFile(tmpDir, "Autounattend.xml.template")
		createTemplateFile(tmpDir, "Autounattend.xml.oobe.partial")
		createTemplateFile(tmpDir, "Autounattend.xml.disks.partial")