// Execute displays orphaned volumes
776229
func (c *CheckOrphans) Execute(args []string) error {
	App.initializeLogging()
	directory := GetDefaultDriver(string(c.Args.Path))
	if err := verifyOptions(App.Options.Options); err != nil {
		log.Fatal(err.Error())
	}
	dmd, err := InitDriverIfExists(directory)
	if err != nil {
		return err
	}
	drv, ok := dmd.(*devicemapper.DeviceMapperDriver)
	if !ok {
		log.Fatal("This only works on devicemapper devices")
	}

	//  we retrieve the list of all devices that CC has access to
	var ccDevices []string
	for _, v := range drv.ListTenants() {
		_vol, err := drv.Get(v)
		if err != nil {
			return err
		}
		vol, ok := _vol.(*devicemapper.DeviceMapperVolume)
		if !ok {
			log.Fatal("Volume", v, "is not of DeviceMapper type.")
		}
		ccDevices = append(ccDevices, vol.Metadata.CurrentDevice())
		for _, dHash := range vol.Metadata.Snapshots {
			ccDevices = append(ccDevices, dHash)
		}
	}

	// next we compare CC-visible device hashes to the device hashes stored by the device driver
	var orphans []string
	for _, d := range drv.DeviceSet.List() {
		found := false
		for _, c := range ccDevices {
			// (*devicemapper.DeviceMapperDriver).DeviceSet.List() will contain an empty string for the base device
			if d == c || d == "" {
				found = true
				break
			}
		}
		if !found {
			orphans = append(orphans, d)
		}
	}

	if len(orphans) > 0 {
		fmt.Println("Orphaned devices were found")
		// delete the actual devices
		for _, v := range orphans {
			if c.Clean {
				if err := drv.DeviceSet.DeleteDevice(v, false); err != nil {
					log.WithError(err).Error("An error occurred while attempting to remove the device:")
				} else {
					fmt.Println("Removed orphaned snapshot", v)
				}
			} else {
				fmt.Println(v)
			}
		}
	} else {
		fmt.Println("No orphaned devices found.")
	}
	return nil
}
631281
func Execute(v string) {
	version = v
	if err := rootCmd.Execute(); err != nil {
		log.Fatal(err)
	}
}
1198552
func (j *JSONPath) Execute(wr io.Writer, data interface{}) error {
	fullResults, err := j.FindResults(data)
	if err != nil {
		return err
	}
	for ix := range fullResults {
		if err := j.PrintResults(wr, fullResults[ix]); err != nil {
			return err
		}
	}
	return nil
}
70669
func (w *ResourcesWriter) Execute(data *ResourceData) error {
	return w.ExecuteTemplate("resource", resourceT, nil, data)
}
455129
func (c *Client) Execute(cmd Command) error {
	return c.cluster.Execute(cmd)
}
579312
func (ec *ServiceManager) execute(service RunnableInterface) {
	service.Run()
	defer ec.wg.Done()
}
930851
func (del *Delete) Execute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool) (*sqltypes.Result, error) {
	if del.QueryTimeout != 0 {
		cancel := vcursor.SetContextTimeout(time.Duration(del.QueryTimeout) * time.Millisecond)
		defer cancel()
	}

	switch del.Opcode {
	case DeleteUnsharded:
		return del.execDeleteUnsharded(vcursor, bindVars)
	case DeleteEqual:
		return del.execDeleteEqual(vcursor, bindVars)
	case DeleteScatter:
		return del.execDeleteByDestination(vcursor, bindVars, key.DestinationAllShards{})
	case DeleteByDestination:
		return del.execDeleteByDestination(vcursor, bindVars, del.TargetDestination)
	default:
		// Unreachable.
		return nil, fmt.Errorf("unsupported opcode: %v", del)
	}
}
1284630
func (a *Astilectron) execute() (err error) {
	// Log
	astilog.Debug("Executing...")

	// Create command
	var ctx, _ = a.canceller.NewContext()
	var singleInstance string
	if a.options.SingleInstance == true {
		singleInstance = "true"
	} else {
		singleInstance = "false"
	}
	var cmd = exec.CommandContext(ctx, a.paths.AppExecutable(), append([]string{a.paths.AstilectronApplication(), a.listener.Addr().String(), singleInstance}, a.options.ElectronSwitches...)...)
	a.stderrWriter = astiexec.NewStdWriter(func(i []byte) { astilog.Debugf("Stderr says: %s", i) })
	a.stdoutWriter = astiexec.NewStdWriter(func(i []byte) { astilog.Debugf("Stdout says: %s", i) })
	cmd.Stderr = a.stderrWriter
	cmd.Stdout = a.stdoutWriter

	// Execute command
	if err = a.executeCmd(cmd); err != nil {
		return errors.Wrap(err, "executing cmd failed")
	}
	return
}
922941
func (c *PreparedQuery) Execute(queryIDOrName string, q *QueryOptions) (*PreparedQueryExecuteResponse, *QueryMeta, error) {
	var out *PreparedQueryExecuteResponse
	qm, err := c.c.query("/v1/query/"+queryIDOrName+"/execute", &out, q)
	if err != nil {
		return nil, nil, err
	}
	return out, qm, nil
}
88199
func (e *remoteExecutor) Execute(command []string, in io.Reader, out, errOut io.Writer) error {
	klog.V(3).Infof("Remote executor running command: %s", strings.Join(command, " "))
	execOptions := &kexec.ExecOptions{
		StreamOptions: kexec.StreamOptions{
			Namespace:     e.Namespace,
			PodName:       e.PodName,
			ContainerName: e.ContainerName,
			IOStreams: genericclioptions.IOStreams{
				In:     in,
				Out:    out,
				ErrOut: errOut,
			},
			Stdin: in != nil,
		},
		SuggestedCmdUsage: e.SuggestedCmdUsage,
		Executor:          &kexec.DefaultRemoteExecutor{},
		PodClient:         e.Client.CoreV1(),
		Config:            e.Config,
		Command:           command,
	}
	err := execOptions.Validate()
	if err != nil {
		klog.V(4).Infof("Error from remote command validation: %v", err)
		return err
	}
	err = execOptions.Run()
	if err != nil {
		klog.V(4).Infof("Error from remote execution: %v", err)
	}
	return err
}
297534
func (command *ClientCommand) Execute() error {
	log.Debug("Generating a rest client for ", command.Language)
	apiDef := new(raml.APIDefinition)
	err := raml.ParseFile(command.RamlFile, apiDef)
	if err != nil {
		return err
	}
	conf := codegen.ClientConfig{
		Dir:                      command.Dir,
		PackageName:              command.PackageName,
		Lang:                     command.Language,
		RootImportPath:           command.ImportPath,
		Kind:                     command.Kind,
		LibRootURLs:              strings.Split(command.LibRootURLs, ","),
		PythonUnmarshallResponse: command.PythonUnmarshallResponse,
	}

	return codegen.GenerateClient(apiDef, conf)
}
477633
func (c *Cluster) Execute(cmd *Command) (*Reply, error) {
	if len(cmd.args) < 1 {
		return nil, ErrNoKey
	}
	key := string(convertString(cmd.args[0]))
	pool := c.shards[DefaultShardStrategy(key, len(c.shards))]
	conn, err := pool.Acquire()
	if err != nil {
		return nil, err
	}
	if conn == nil {
		return nil, ErrNotConnected
	}
	defer pool.Release(conn)
	return cmd.Run(conn)
}
117026
func (c *QueryRange) Execute(args []string) error {
	return c.doQueryOp(ShellQueryClient.Range, c.Args.EntityName, c.Args.Queries, c.Limit)
}
284359
func (c *Context) Execute(ctx context.Context, sql string) ([]sqlexec.RecordSet, error) {
	return nil, errors.Errorf("Not Support.")
}
624668
func (db *DB) Execute(stmt Executable, args ...interface{}) (sql.Result, error) {
	s, params, err := db.compile(stmt)
	if err != nil {
		return nil, err
	}

	// Use any arguments given to Execute() over compiled arguments
	if len(args) == 0 {
		args = params.args
	}
	return db.conn.Exec(s, args...)
}
1147395
func (a SyncAction) Execute(
	ctx context.Context, c libkbfs.Config, fb data.FolderBranch,
	h *tlfhandle.Handle) (err error) {
	if fb == (data.FolderBranch{}) {
		panic("zero fb in SyncAction.Execute")
	}

	// Ensure the TLF is initialized by getting the root node first.
	_, _, err = c.KBFSOps().GetRootNode(ctx, h, data.MasterBranch)
	if err != nil {
		return err
	}

	switch a {
	case SyncEnable:
		_, err = c.KBFSOps().SetSyncConfig(
			ctx, fb.Tlf, keybase1.FolderSyncConfig{
				Mode: keybase1.FolderSyncMode_ENABLED,
			})

	case SyncDisable:
		_, err = c.KBFSOps().SetSyncConfig(
			ctx, fb.Tlf, keybase1.FolderSyncConfig{
				Mode: keybase1.FolderSyncMode_DISABLED,
			})

	default:
		return fmt.Errorf("Unknown action %s", a)
	}
	if err != nil {
		return err
	}
	// Re-trigger prefetches.
	_, _, err = c.KBFSOps().GetRootNode(ctx, h, fb.Branch)
	return err
}
1002921
func (e *Env) Execute(src string) (interface{}, error) {
	return e.ExecuteContext(context.Background(), src)
}