Exemplo n.º 1
0
func (s *UsersCommandSuite) TestEnvUsersFormatJson(c *gc.C) {
	context, err := testing.RunCommand(c, environment.NewUsersCommand(s.fake), "--format", "json")
	c.Assert(err, jc.ErrorIsNil)
	c.Assert(testing.Stdout(context), gc.Equals, "["+
		`{"user-name":"admin@local","date-created":"2014-07-20","last-connection":"2015-03-20"},`+
		`{"user-name":"bob@local","date-created":"2015-02-15","last-connection":"2015-03-01"},`+
		`{"user-name":"*****@*****.**","date-created":"2015-02-15","last-connection":"never connected"}`+
		"]\n")
}
Exemplo n.º 2
0
func (s *UsersCommandSuite) TestEnvUsers(c *gc.C) {
	context, err := testing.RunCommand(c, environment.NewUsersCommand(s.fake))
	c.Assert(err, jc.ErrorIsNil)
	c.Assert(testing.Stdout(context), gc.Equals, ""+
		"NAME                DATE CREATED  LAST CONNECTION\n"+
		"admin@local         2014-07-20    2015-03-20\n"+
		"bob@local           2015-02-15    2015-03-01\n"+
		"[email protected]  2015-02-15    never connected\n"+
		"\n")
}
Exemplo n.º 3
0
func (s *UsersCommandSuite) TestUserInfoFormatYaml(c *gc.C) {
	context, err := testing.RunCommand(c, environment.NewUsersCommand(s.fake), "--format", "yaml")
	c.Assert(err, jc.ErrorIsNil)
	c.Assert(testing.Stdout(context), gc.Equals, ""+
		"- user-name: admin@local\n"+
		"  date-created: 2014-07-20\n"+
		"  last-connection: 2015-03-20\n"+
		"- user-name: bob@local\n"+
		"  date-created: 2015-02-15\n"+
		"  last-connection: 2015-03-01\n"+
		"- user-name: [email protected]\n"+
		"  date-created: 2015-02-15\n"+
		"  last-connection: never connected\n")
}
Exemplo n.º 4
0
func (s *UsersCommandSuite) TestUnrecognizedArg(c *gc.C) {
	_, err := testing.RunCommand(c, environment.NewUsersCommand(s.fake), "whoops")
	c.Assert(err, gc.ErrorMatches, `unrecognized args: \["whoops"\]`)
}
Exemplo n.º 5
0
Arquivo: main.go Projeto: imoapps/juju
// registerCommands registers commands in the specified registry.
func registerCommands(r commandRegistry, ctx *cmd.Context) {
	// Creation commands.
	r.Register(newBootstrapCommand())
	r.Register(newDeployCommand())
	r.Register(newAddRelationCommand())

	// Destruction commands.
	r.Register(newRemoveRelationCommand())
	r.Register(newRemoveServiceCommand())
	r.Register(newRemoveUnitCommand())

	// Reporting commands.
	r.Register(status.NewStatusCommand())
	r.Register(newSwitchCommand())
	r.Register(newEndpointCommand())
	r.Register(newAPIInfoCommand())
	r.Register(status.NewStatusHistoryCommand())

	// Error resolution and debugging commands.
	r.Register(newRunCommand())
	r.Register(newSCPCommand())
	r.Register(newSSHCommand())
	r.Register(newResolvedCommand())
	r.Register(newDebugLogCommand())
	r.Register(newDebugHooksCommand())

	// Configuration commands.
	r.Register(newInitCommand())
	r.Register(common.NewGetConstraintsCommand())
	r.Register(common.NewSetConstraintsCommand())
	r.Register(newExposeCommand())
	r.Register(newSyncToolsCommand())
	r.Register(newUnexposeCommand())
	r.Register(newUpgradeJujuCommand(nil))
	r.Register(newUpgradeCharmCommand())

	// Charm publishing commands.
	r.Register(newPublishCommand())

	// Charm tool commands.
	r.Register(newHelpToolCommand())

	// Manage backups.
	r.Register(backups.NewSuperCommand())

	// Manage authorized ssh keys.
	r.Register(newAuthorizedKeysCommand())

	// Manage users and access
	r.Register(user.NewAddCommand())
	r.Register(user.NewChangePasswordCommand())
	r.Register(user.NewCredentialsCommand())
	r.Register(user.NewShowUserCommand())
	r.Register(user.NewListCommand())
	r.Register(user.NewEnableCommand())
	r.Register(user.NewDisableCommand())

	// Manage cached images
	r.Register(cachedimages.NewSuperCommand())

	// Manage machines
	r.Register(machine.NewSuperCommand())
	r.RegisterSuperAlias("add-machine", "machine", "add", nil)
	r.RegisterSuperAlias("remove-machine", "machine", "remove", nil)
	r.RegisterSuperAlias("destroy-machine", "machine", "remove", nil)
	r.RegisterSuperAlias("terminate-machine", "machine", "remove", nil)

	// Mangage environment
	r.Register(environment.NewGetCommand())
	r.Register(environment.NewSetCommand())
	r.Register(environment.NewUnsetCommand())
	r.Register(environment.NewRetryProvisioningCommand())
	r.Register(environment.NewDestroyCommand())

	r.Register(environment.NewShareCommand())
	r.Register(environment.NewUnshareCommand())
	r.Register(environment.NewUsersCommand())

	// Manage and control actions
	r.Register(action.NewSuperCommand())

	// Manage state server availability
	r.Register(newEnsureAvailabilityCommand())

	// Manage and control services
	r.Register(service.NewSuperCommand())
	r.RegisterSuperAlias("add-unit", "service", "add-unit", nil)
	r.RegisterSuperAlias("get", "service", "get", nil)
	r.RegisterSuperAlias("set", "service", "set", nil)
	r.RegisterSuperAlias("unset", "service", "unset", nil)

	// Operation protection commands
	r.Register(block.NewSuperBlockCommand())
	r.Register(block.NewUnblockCommand())

	// Manage storage
	r.Register(storage.NewSuperCommand())

	// Manage spaces
	r.Register(space.NewSuperCommand())

	// Manage subnets
	r.Register(subnet.NewSuperCommand())

	// Manage controllers
	r.Register(controller.NewCreateEnvironmentCommand())
	r.Register(controller.NewDestroyCommand())
	r.Register(controller.NewEnvironmentsCommand())
	r.Register(controller.NewKillCommand())
	r.Register(controller.NewListCommand())
	r.Register(controller.NewListBlocksCommand())
	r.Register(controller.NewLoginCommand())
	r.Register(controller.NewRemoveBlocksCommand())
	r.Register(controller.NewUseEnvironmentCommand())

	// Commands registered elsewhere.
	for _, newCommand := range registeredCommands {
		command := newCommand()
		r.Register(command)
	}
	for _, newCommand := range registeredEnvCommands {
		command := newCommand()
		r.Register(envcmd.Wrap(command))
	}
}