예제 #1
0
파일: remote.go 프로젝트: paultag/minion
func remoteRun(config minion.MinionConfig, cmd *Command, args []string) {
	conn, err := service.DialFromKeys(
		fmt.Sprintf("%s:%d", config.Host, config.Port),
		config.Cert, config.Key, config.CaCert,
	)
	if err != nil {
		log.Fatalf("Error! %s\n", err)
	}
	proxy := minion.CoordinatorProxy{service.Client(conn)}

	if len(args) == 0 {
		log.Fatalf("No subcommand given")
	}

	switch args[0] {
	case "backfill":
		Backfill(config, proxy, args[1:])
	case "status":
		Status(config, proxy, args[1:])
	case "binNMU":
		BinNMU(config, proxy, args[1:])
	default:
		log.Fatalf("Unknown command :(")
	}
}
예제 #2
0
파일: reprepro.go 프로젝트: paultag/minion
func repreproRun(config minion.MinionConfig, cmd *Command, args []string) {
	incoming := Incoming{}
	incoming.Parse(args)
	if incoming.Type != "add" {
		return
	}

	conn, err := service.DialFromKeys(
		fmt.Sprintf("%s:%d", config.Host, config.Port),
		config.Cert, config.Key, config.CaCert,
	)
	if err != nil {
		log.Fatalf("Error! %s\n", err)
	}
	proxy := minion.CoordinatorProxy{service.Client(conn)}
	log.Printf("Queueing build\n")

	archiveRoot := fmt.Sprintf("http://%s", path.Join(*fqdn, *archive))

	repo := reprepro.GetWorkingRepo()
	buildNeeding, err := repo.BuildNeeding(incoming.Suite, "any", &incoming.Package)
	if err != nil {
		log.Fatalf("Error! %s\n", err)
	}

	for _, build := range buildNeeding {
		dscPath := fmt.Sprintf("%s/%s", archiveRoot, build.Location)
		build := minion.NewBuild(
			*fqdn,
			*archive,
			incoming.Suite,
			incoming.Component,
			build.Arch,
			dscPath,
		)
		proxy.QueueBuild(build)
	}
	log.Printf("Queued\n")
}