summaryrefslogtreecommitdiff
path: root/trove/extensions
diff options
context:
space:
mode:
Diffstat (limited to 'trove/extensions')
-rw-r--r--trove/extensions/cassandra/__init__.py0
-rw-r--r--trove/extensions/cassandra/service.py28
-rw-r--r--trove/extensions/common/service.py12
-rw-r--r--trove/extensions/mysql/service.py10
-rw-r--r--trove/extensions/postgresql/__init__.py0
-rw-r--r--trove/extensions/postgresql/service.py29
-rw-r--r--trove/extensions/redis/service.py4
7 files changed, 9 insertions, 74 deletions
diff --git a/trove/extensions/cassandra/__init__.py b/trove/extensions/cassandra/__init__.py
deleted file mode 100644
index e69de29b..00000000
--- a/trove/extensions/cassandra/__init__.py
+++ /dev/null
diff --git a/trove/extensions/cassandra/service.py b/trove/extensions/cassandra/service.py
deleted file mode 100644
index ffffab07..00000000
--- a/trove/extensions/cassandra/service.py
+++ /dev/null
@@ -1,28 +0,0 @@
-# Copyright 2015 Tesora Inc.
-# All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-from trove.common.db.cassandra import models as guest_models
-from trove.extensions.common.service import DefaultRootController
-from trove.extensions.mysql import models
-
-
-class CassandraRootController(DefaultRootController):
-
- def _find_root_user(self, context, instance_id):
- user = guest_models.CassandraUser.root()
- # TODO(pmalik): Using MySQL model until we have datastore specific
- # extensions (bug/1498573).
- return models.User.load(
- context, instance_id, user.name, user.host, root_user=True)
diff --git a/trove/extensions/common/service.py b/trove/extensions/common/service.py
index 3b248241..75a65941 100644
--- a/trove/extensions/common/service.py
+++ b/trove/extensions/common/service.py
@@ -116,12 +116,9 @@ class DefaultRootController(BaseDatastoreRootController):
LOG.info("Disabling root for instance '%s'.", instance_id)
LOG.info("req : '%s'\n\n", req)
context = req.environ[wsgi.CONTEXT_KEY]
- try:
- found_user = self._find_root_user(context, instance_id)
- except (ValueError, AttributeError) as e:
- raise exception.BadRequest(message=str(e))
- if not found_user:
- raise exception.UserNotFound(uuid="root")
+ is_root_enabled = models.Root.load(context, instance_id)
+ if not is_root_enabled:
+ raise exception.RootHistoryNotFound()
models.Root.delete(context, instance_id)
return wsgi.Result(None, 200)
@@ -238,7 +235,8 @@ class RootController(ExtensionController):
return root_controller.root_delete(req, tenant_id,
instance_id, is_cluster)
else:
- raise NoSuchOptError
+ opt = 'root_controller'
+ raise NoSuchOptError(opt, group='datastore_manager')
def _get_datastore(self, tenant_id, instance_or_cluster_id):
"""
diff --git a/trove/extensions/mysql/service.py b/trove/extensions/mysql/service.py
index 306ebd6f..f68e1c7f 100644
--- a/trove/extensions/mysql/service.py
+++ b/trove/extensions/mysql/service.py
@@ -29,7 +29,6 @@ from trove.common.notification import StartNotification
from trove.common import pagination
from trove.common.utils import correct_id_with_req
from trove.common import wsgi
-from trove.extensions.common.service import DefaultRootController
from trove.extensions.common.service import ExtensionController
from trove.extensions.mysql.common import populate_users
from trove.extensions.mysql.common import populate_validated_databases
@@ -372,12 +371,3 @@ class SchemaController(ExtensionController):
self.authorize_target_action(
context, 'database:show', instance_id)
raise webob.exc.HTTPNotImplemented()
-
-
-class MySQLRootController(DefaultRootController):
-
- def _find_root_user(self, context, instance_id):
- user = guest_models.MySQLUser.root()
- return models.User.load(context, instance_id,
- user.name, user.host,
- root_user=True)
diff --git a/trove/extensions/postgresql/__init__.py b/trove/extensions/postgresql/__init__.py
deleted file mode 100644
index e69de29b..00000000
--- a/trove/extensions/postgresql/__init__.py
+++ /dev/null
diff --git a/trove/extensions/postgresql/service.py b/trove/extensions/postgresql/service.py
deleted file mode 100644
index 316641e2..00000000
--- a/trove/extensions/postgresql/service.py
+++ /dev/null
@@ -1,29 +0,0 @@
-# Copyright 2015 Tesora Inc.
-# All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-from trove.common.db.postgresql import models as guest_models
-from trove.extensions.common.service import DefaultRootController
-from trove.extensions.mysql import models
-
-
-class PostgreSQLRootController(DefaultRootController):
-
- def _find_root_user(self, context, instance_id):
- user = guest_models.PostgreSQLUser.root()
- # This is currently using MySQL model.
- # MySQL extension *should* work for now, but may lead to
- # future bugs (incompatible input validation, unused field etc).
- return models.User.load(
- context, instance_id, user.name, user.host, root_user=True)
diff --git a/trove/extensions/redis/service.py b/trove/extensions/redis/service.py
index f5be1d8d..0f5451d1 100644
--- a/trove/extensions/redis/service.py
+++ b/trove/extensions/redis/service.py
@@ -88,6 +88,10 @@ class RedisRootController(DefaultRootController):
LOG.info("req : '%s'\n\n", req)
context = req.environ[wsgi.CONTEXT_KEY]
+ is_root_enabled = RedisRoot.load(context, instance_id)
+ if not is_root_enabled:
+ raise exception.RootHistoryNotFound()
+
original_auth_password = self._get_original_auth_password(
context, instance_id)