コード例 #1
0
// Status checks if the klient is running via the Klient Service, as well as
// dialing the klient to ensure that is working..
func (r *KlientRunningRepair) Status() (bool, error) {
	if !r.KlientService.IsKlientRunning() {
		r.Stdout.Printlnf("KD Daemon is not running.")
		return false, nil
	}

	if _, err := klient.NewDialedKlient(r.KlientOptions); err != nil {
		r.Stdout.Printlnf("Unable to connect to KD Daemon.")
		return false, nil
	}

	return true, nil
}
コード例 #2
0
func (r *RemountCommand) setupKlient() error {
	if r.Klient != nil {
		return nil
	}

	k, err := klient.NewDialedKlient(r.KlientOptions)
	if err != nil {
		return fmt.Errorf("Failed to get working Klient instance.")
	}

	r.Klient = k

	return nil
}
コード例 #3
0
// setupKlient creates and dials our Kite interface *only* if it is nil. If it is
// not nil, someone else gave a kite to this Command, and it is expected to be
// dialed and working.
func (c *Command) setupKlient() error {
	// if c.klient isnt nil, don't overrite it. Another command may have provided
	// a pre-dialed klient.
	if c.Klient != nil {
		return nil
	}

	k, err := klient.NewDialedKlient(c.KlientOptions)
	if err != nil {
		return fmt.Errorf("Failed to get working Klient instance")
	}

	c.Klient = k

	return nil
}