Esempio n. 1
0
func (h *Handler) SetTemplates(w *WrappedParms) {
	for k, _ := range w.Packages {
		template := templates.NewTemplate()
		var v, ok = w.GetHost()
		if ok {
			template.Host = v
		}
		v, ok = w.GetUserName()
		if ok {
			template.UserName = v
		}
		v, ok = w.GetPassword()
		if ok {
			template.Password = v
		}
		template.Name = strings.Title(h.platform) + k
		template.Options = w.Options
		template.Maps = w.Maps
		h.templates = append(h.templates, template)
	}
}
Esempio n. 2
0
func (h *Handler) SetTemplates(packages map[string]string, options map[string]string) {
	for k, _ := range packages {
		template := templates.NewTemplate()
		for ko, vo := range options {
			if ko == HOST {
				template.Host = vo
			}
			if ko == USERNAME {
				template.UserName = vo
			}
			if ko == PASSWORD {
				template.Password = vo
			}
			if ko == BRIDGENAME {
				template.Bridgename = vo
			}
			if ko == NETWORK_IF {
				template.Networkif = vo
			}
		}
		template.Name = strings.Title(h.platform) + k
		h.templates = append(h.templates, template)
	}
}