Exemplo n.º 1
0
Arquivo: uniter.go Projeto: bac/juju
// BeginActions marks the actions represented by the passed in Tags as running.
func (u *UniterAPIV3) BeginActions(args params.Entities) (params.ErrorResults, error) {
	canAccess, err := u.accessUnit()
	if err != nil {
		return params.ErrorResults{}, err
	}

	actionFn := common.AuthAndActionFromTagFn(canAccess, u.st.ActionByTag)
	return common.BeginActions(args, actionFn), nil
}
Exemplo n.º 2
0
func (s *actionsSuite) TestBeginActions(c *gc.C) {
	args := entities("success", "fail", "invalid")
	expectErr := errors.New("explosivo")
	actionFn := makeGetActionByTagString(map[string]state.Action{
		"success": fakeAction{},
		"fail":    fakeAction{beginErr: expectErr},
	})

	results := common.BeginActions(args, actionFn)

	c.Assert(results, jc.DeepEquals, params.ErrorResults{
		[]params.ErrorResult{
			{},
			{common.ServerError(expectErr)},
			{common.ServerError(actionNotFoundErr)},
		},
	})
}
Exemplo n.º 3
0
// BeginActions marks the actions represented by the passed in Tags as running.
func (f *Facade) BeginActions(args params.Entities) params.ErrorResults {
	actionFn := common.AuthAndActionFromTagFn(f.accessMachine, f.backend.ActionByTag)
	return common.BeginActions(args, actionFn)
}