Documentation

Index

Constants

This section is empty.

Variables

View Source
var AuditCmd = &subcommands.Command{
	UsageLine: "audit <sub-command>",
	ShortDesc: "Tools for auditing the lab",
	LongDesc:  "Collection of tools for use in lab auditing",
	CommandRun: func() subcommands.CommandRun {
		c := &audit{}
		return c
	},
}

    AuditCmd contains audit command specification

    View Source
    var LoglsCmd = &subcommands.Command{
    	UsageLine: "ls-logs",
    	ShortDesc: "List log of previous audits on this machine",
    	LongDesc: `Lists the details of the previous audit runs on the machine
    
    The index of each log is sorted by time from older to newer,
    so that the logs generated by rerun won't affect the previous run's index.
    
    The output of ls-logs are sorted by time reversly for easy check,
    i.e. newest log is listed first.
    	`,
    	CommandRun: func() subcommands.CommandRun {
    		c := &logls{}
    
    		c.Flags.StringVar(&c.logDir, "log-dir", getLogDir(), "Dir to store logs for any runs of scan.")
    		c.Flags.IntVar(&c.limit, "limit", 20, "Limit to latest")
    		c.Flags.IntVar(&c.index, "index", -1, `Index of the log. When set the statistics
    of that particular run are returned, including infos about successful and failed assets.`)
    		return c
    	},
    }

      LoglsCmd prints previous audit runs' info.

      View Source
      var RerunCmd = &subcommands.Command{
      	UsageLine: "rerun",
      	ShortDesc: "Run previous audit from logs",
      	LongDesc: `Runs the operations in the log of previous audits.
      	
      Please note that each rerun will generate its own logs.`,
      	CommandRun: func() subcommands.CommandRun {
      		c := &rerun{}
      		c.authFlags.Register(&c.Flags, site.DefaultAuthOptions)
      		c.envFlags.Register(&c.Flags)
      		c.Flags.StringVar(&c.logDir, "log-dir", getLogDir(), "Log directory")
      		c.Flags.IntVar(&c.idx, "index", 0, "Index of the log to run, run logls for index checking")
      
      		c.Flags.StringVar(&c.tStamp, "timestamp", "", "Timestamp of log to run")
      		return c
      	},
      }

        RerunCmd rerun a previous audit based on its log.

        View Source
        var ScannerCmd = &subcommands.Command{
        	UsageLine: "scan -l lab",
        	ShortDesc: "Audit using a barcode scanner",
        	LongDesc: `Connect the scanner and run the tool with defaults for location;
        
        	The scan order is: location => asset tag(s) => next location => asset tag(s)
        	Once the next location is scanned, the last location and its related asset
        	tags will be recorded to registration system.
        
        	Every scan will be recorded in local log file: <home>/.shivas/timestamp-log
        	Every interaction with registration system will be recorded in local res file:
        		<home>/.shivas/timestamp-res
        	`,
        	CommandRun: func() subcommands.CommandRun {
        		c := &bcScanner{}
        		c.authFlags.Register(&c.Flags, site.DefaultAuthOptions)
        		c.envFlags.Register(&c.Flags)
        		c.Flags.StringVar(&c.lab, "l", "", "Default lab")
        		c.Flags.StringVar(&c.aisle, "a", "", "Default aisle")
        		c.Flags.StringVar(&c.row, "ro", "", "Default row")
        		c.Flags.StringVar(&c.rack, "ra", "", "Default rack")
        		c.Flags.StringVar(&c.shelf, "s", "", "Default Shelf")
        		c.Flags.StringVar(&c.position, "p", "", "Default position")
        		c.Flags.StringVar(&c.zone, "z", "", "Default Zone")
        		c.Flags.StringVar(&c.logDir, "log-dir", getLogDir(), `Dir to store logs. Two types of logs
        		are stored here. Logs with <timestamp>-log filename store the asset-location inputs in order.
        		Logs with <timestamp>-res filename store the results of datastore transactions.`)
        		return c
        	},
        }

          ScannerCmd runs with the scanner to scan lab assets.

          Functions

          This section is empty.

          Types

          This section is empty.