Exemplo n.º 1
0
func (s *agentSuite) TestAgentFailsWithNonMachineAgentUser(c *C) {
	auth := s.authorizer
	auth.MachineAgent = false
	api, err := machine.NewAgentAPI(s.State, auth)
	c.Assert(err, NotNil)
	c.Assert(api, IsNil)
	c.Assert(err, ErrorMatches, "permission denied")
}
Exemplo n.º 2
0
func (s *agentSuite) SetUpTest(c *gc.C) {
	s.commonSuite.SetUpTest(c)

	// Create a machiner API for machine 1.
	api, err := machine.NewAgentAPI(s.State, s.authorizer)
	c.Assert(err, gc.IsNil)
	s.agent = api
}
Exemplo n.º 3
0
// MachineAgent returns an object that provides access to the machine
// agent API.  The id argument is reserved for future use and must currently
// be empty.
func (r *srvRoot) MachineAgent(id string) (*machine.AgentAPI, error) {
	if id != "" {
		return nil, common.ErrBadId
	}
	return machine.NewAgentAPI(r.srv.state, r)
}