Beispiel #1
0
func ShowFacts() {
	allFacts, err := facts.FindFacts().ToPrettyJson()
	if err != nil {
		panic(err)
	}
	fmt.Printf("%s\n", allFacts)
}
Beispiel #2
0
func initJavascript() {
	js = otto.New()

	f := facts.FindFacts()
	// TODO: log error
	factsAsJson, err := f.ToJson()
	if err == nil {
		js.Object(`facts = ` + string(factsAsJson))
	}

	// Create javascript functions
	js.Set("directory", directory)
	js.Set("symlink", symlink)
	js.Set("template", template)
	js.Set("apt", apt)
	js.Set("yum", yum)
	js.Set("command", command)
	js.Set("user", user)
	js.Set("pg_user", pgUser)
	js.Set("pg_database", pgDatabase)
	js.Set("mysql_user", mysqlUser)
	js.Set("mysql_database", mysqlDatabase)
	js.Set("sleep", sleep)
	js.Set("upstart", upstart)
	js.Set("file", file)
	js.Set("include", include)
}