Esempio n. 1
0
func convert(results datastore.Results) ([]Service, error) {
	svcs := make([]Service, results.Len())
	for idx := range svcs {
		var svc Service
		err := results.Get(idx, &svc)
		if err != nil {
			return nil, err
		}
		fillConfig(&svc)
		svcs[idx] = svc
	}
	return svcs, nil
}
func convert(results datastore.Results) ([]AddressAssignment, error) {
	assignments := make([]AddressAssignment, results.Len())
	for idx := range assignments {
		var aa AddressAssignment
		err := results.Get(idx, &aa)
		if err != nil {
			return nil, err
		}

		assignments[idx] = aa
	}
	return assignments, nil
}
Esempio n. 3
0
func convert(results datastore.Results) ([]Host, error) {
	hosts := make([]Host, results.Len())
	glog.V(4).Infof("Results are %v", results)
	for idx := range hosts {
		var host Host
		err := results.Get(idx, &host)
		if err != nil {
			return nil, err
		}
		glog.V(4).Infof("Adding %v to hosts", host)
		hosts[idx] = host
	}
	return hosts, nil
}
Esempio n. 4
0
func convert(results datastore.Results) ([]*ServiceTemplate, error) {
	templates := make([]*ServiceTemplate, results.Len())
	for idx := range templates {
		var stw serviceTemplateWrapper
		if err := results.Get(idx, &stw); err != nil {
			return []*ServiceTemplate{}, err
		}
		st, err := FromJSON(stw.Data)
		if err != nil {
			return []*ServiceTemplate{}, err
		}
		templates[idx] = st
	}
	return templates, nil
}