Add log-enable to OSC
This change adds database support to the python-openstackclient project for the log-enable command The trove command log-enable is now: openstack database log enable Change-Id: Ia5bb395264946f79673970336e4c1f23857bb77d Partially-Implements: blueprint trove-support-in-python-openstackclient
This commit is contained in:
parent
62c41641c0
commit
34dbc53ec2
@ -0,0 +1,5 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
The command ``trove log-enable`` is now available to use in
|
||||
the python-openstackclient CLI as ``openstack database log enable``.
|
@ -68,6 +68,7 @@ openstack.database.v1 =
|
||||
database_limit_list = troveclient.osc.v1.database_limits:ListDatabaseLimits
|
||||
database_quota_show = troveclient.osc.v1.database_quota:ShowDatabaseQuota
|
||||
database_quota_update = troveclient.osc.v1.database_quota:UpdateDatabaseQuota
|
||||
database_log_enable = troveclient.osc.v1.database_limits:EnableDatabaseInstanceLog
|
||||
database_root_disable = troveclient.osc.v1.database_root:DisableDatabaseRoot
|
||||
database_root_enable = troveclient.osc.v1.database_root:EnableDatabaseRoot
|
||||
database_root_show = troveclient.osc.v1.database_root:ShowDatabaseRoot
|
||||
|
@ -447,6 +447,33 @@ class UpgradeDatabaseInstance(command.Command):
|
||||
db_instances.upgrade(instance, parsed_args.datastore_version)
|
||||
|
||||
|
||||
class EnableDatabaseInstanceLog(command.Command):
|
||||
|
||||
_description = _("Instructs Trove guest to start collecting log details.")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(EnableDatabaseInstanceLog, self).get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'instance',
|
||||
metavar='<instance>',
|
||||
type=str,
|
||||
help=_('Id or Name of the instance.')
|
||||
)
|
||||
parser.add_argument(
|
||||
'log_name',
|
||||
metavar='<log_name>',
|
||||
type=str,
|
||||
help=_('Name of log to publish.')
|
||||
)
|
||||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
db_instances = self.app.client_manager.database.instances
|
||||
instance = osc_utils.find_resource(db_instances,
|
||||
parsed_args.instance)
|
||||
db_instances.log_enable(instance, parsed_args.log_name)
|
||||
|
||||
|
||||
class ResizeDatabaseInstanceVolume(command.Command):
|
||||
|
||||
_description = _("Resizes the volume size of an instance.")
|
||||
|
@ -265,3 +265,21 @@ class TestDatabaseInstanceForceDelete(TestInstances):
|
||||
self.assertRaises(exceptions.CommandError,
|
||||
self.cmd.take_action,
|
||||
parsed_args)
|
||||
|
||||
|
||||
class TestDatabaseInstanceEnableLog(TestInstances):
|
||||
|
||||
def setUp(self):
|
||||
super(TestDatabaseInstanceEnableLog, self).setUp()
|
||||
self.cmd = database_instances.EnableDatabaseInstanceLog(self.app,
|
||||
None)
|
||||
|
||||
@mock.patch.object(utils, 'find_resource')
|
||||
def test_instance_enable_log(self, mock_find):
|
||||
args = ['instance1', 'log_name']
|
||||
mock_find.side_effect = ['instance1']
|
||||
parsed_args = self.check_parser(self.cmd, args, [])
|
||||
result = self.cmd.take_action(parsed_args)
|
||||
self.instance_client.log_enable.assert_called_with('instance1',
|
||||
'log_name')
|
||||
self.assertIsNone(result)
|
||||
|
Loading…
Reference in New Issue
Block a user