Esempio n. 1
0
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 :(")
	}
}
Esempio n. 2
0
func minionRunServe(config minion.MinionConfig) {
	log.Printf("Diling coordinator\n")
	conn, err := service.DialFromKeys(
		fmt.Sprintf("%s:%d", config.Host, config.Port),
		config.Cert, config.Key, config.CaCert,
	)
	if err != nil {
		log.Printf("Error! %s\n", err)
		return
	}
	log.Printf("Doing what they say!\n")
	service.ServeConn(conn)
}
Esempio n. 3
0
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")
}