Exemple #1
0
Fichier : id.go Projet : vosst/csi
func actionId(c *cli.Context) {
	mi, err := machine.DefaultIdentifier()
	if err == nil {
		id, err := mi.Identify()
		if err == nil {
			fmt.Fprintf(c.App.Writer, "%x\n", id)
		} else {
			fmt.Fprintf(os.Stderr, "Error determining machine id: %s\n", err)
		}
	} else {
		fmt.Fprintf(os.Stderr, "Error initializing identification infrastructure: %s\n", err)
	}

}
Exemple #2
0
func actionUpload(c *cli.Context) {
	mi, err := machine.DefaultIdentifier()

	if err != nil {
		fmt.Fprintf(os.Stderr, "Could not create default machine identifier")
		return
	}

	u, err := url.Parse(c.String(uploadFlagDest.Name))
	if err != nil {
		fmt.Fprintf(os.Stderr, "Destination needs to be a valid url")
		return
	}

	crashDir := c.String(uploadFlagCrashDir.Name)
	persister := crash.HttpReportPersister{*u, mi, &http.Client{}}

	crash.ForEachReportInDir(crashDir, UploadingVisitor{crashDir, os.Stdout, persister, c.Bool(uploadFlagCleanup.Name)})
}