Example #1
0
// ModelInfo returns information on the model needed by the undertaker worker.
func (u *UndertakerAPI) ModelInfo() (params.UndertakerModelInfoResult, error) {
	result := params.UndertakerModelInfoResult{}
	env, err := u.st.Model()

	if err != nil {
		return result, errors.Trace(err)
	}

	result.Result = params.UndertakerModelInfo{
		UUID:       env.UUID(),
		GlobalName: env.Owner().String() + "/" + env.Name(),
		Name:       env.Name(),
		IsSystem:   u.st.IsController(),
		Life:       params.Life(env.Life().String()),
	}

	return result, nil
}
Example #2
0
// ModelInfo returns information on the model needed by the undertaker worker.
func (u *UndertakerAPI) ModelInfo() (params.UndertakerModelInfoResult, error) {
	result := params.UndertakerModelInfoResult{}
	env, err := u.st.Model()

	if err != nil {
		return result, errors.Trace(err)
	}
	tod := env.TimeOfDeath()

	result.Result = params.UndertakerModelInfo{
		UUID:        env.UUID(),
		GlobalName:  env.Owner().String() + "/" + env.Name(),
		Name:        env.Name(),
		IsSystem:    u.st.IsStateServer(),
		Life:        params.Life(env.Life().String()),
		TimeOfDeath: &tod,
	}
	if tod.IsZero() {
		result.Result.TimeOfDeath = nil
	}

	return result, nil
}