aboutsummaryrefslogtreecommitdiffstats
path: root/moonv4/moon_db
diff options
context:
space:
mode:
Diffstat (limited to 'moonv4/moon_db')
-rw-r--r--moonv4/moon_db/Changelog4
-rw-r--r--moonv4/moon_db/MANIFEST.in2
-rw-r--r--moonv4/moon_db/Vagrantfile71
-rw-r--r--moonv4/moon_db/moon_db/__init__.py18
-rw-r--r--moonv4/moon_db/moon_db/core.py6
-rw-r--r--moonv4/moon_db/moon_db/db_manager.py4
-rw-r--r--moonv4/moon_db/moon_db/exception.py410
-rw-r--r--moonv4/moon_db/moon_db/migrate_repo/versions/001_moon.py2
8 files changed, 9 insertions, 508 deletions
diff --git a/moonv4/moon_db/Changelog b/moonv4/moon_db/Changelog
index 47e3c5f7..b69bdaef 100644
--- a/moonv4/moon_db/Changelog
+++ b/moonv4/moon_db/Changelog
@@ -10,3 +10,7 @@ CHANGES
0.1.0
-----
- First version of the moon_db library.
+
+1.0.0
+-----
+- First public version of the moon_db library.
diff --git a/moonv4/moon_db/MANIFEST.in b/moonv4/moon_db/MANIFEST.in
index 24ccc449..ba8a657e 100644
--- a/moonv4/moon_db/MANIFEST.in
+++ b/moonv4/moon_db/MANIFEST.in
@@ -7,5 +7,5 @@ include README.rst
include LICENSE
include setup.py
include requirements.txt
-graft tests
+# graft tests
graft bin \ No newline at end of file
diff --git a/moonv4/moon_db/Vagrantfile b/moonv4/moon_db/Vagrantfile
deleted file mode 100644
index 488d8aef..00000000
--- a/moonv4/moon_db/Vagrantfile
+++ /dev/null
@@ -1,71 +0,0 @@
-# -*- mode: ruby -*-
-# vi: set ft=ruby :
-
-# All Vagrant configuration is done below. The "2" in Vagrant.configure
-# configures the configuration version (we support older styles for
-# backwards compatibility). Please don't change it unless you know what
-# you're doing.
-Vagrant.configure("2") do |config|
- # The most common configuration options are documented and commented below.
- # For a complete reference, please see the online documentation at
- # https://docs.vagrantup.com.
-
- # Every Vagrant development environment requires a box. You can search for
- # boxes at https://atlas.hashicorp.com/search.
- config.vm.box = "gbarbieru/xenial"
-
- # Disable automatic box update checking. If you disable this, then
- # boxes will only be checked for updates when the user runs
- # `vagrant box outdated`. This is not recommended.
- # config.vm.box_check_update = false
-
- # Create a forwarded port mapping which allows access to a specific port
- # within the machine from a port on the host machine. In the example below,
- # accessing "localhost:8080" will access port 80 on the guest machine.
- # config.vm.network "forwarded_port", guest: 80, host: 8080
-
- # Create a private network, which allows host-only access to the machine
- # using a specific IP.
- # config.vm.network "private_network", ip: "192.168.33.10"
-
- # Create a public network, which generally matched to bridged network.
- # Bridged networks make the machine appear as another physical device on
- # your network.
- # config.vm.network "public_network"
-
- # Share an additional folder to the guest VM. The first argument is
- # the path on the host to the actual folder. The second argument is
- # the path on the guest to mount the folder. And the optional third
- # argument is a set of non-required options.
- # config.vm.synced_folder "../data", "/vagrant_data"
-
- # Provider-specific configuration so you can fine-tune various
- # backing providers for Vagrant. These expose provider-specific options.
- # Example for VirtualBox:
- #
- # config.vm.provider "virtualbox" do |vb|
- # # Display the VirtualBox GUI when booting the machine
- # vb.gui = true
- #
- # # Customize the amount of memory on the VM:
- # vb.memory = "1024"
- # end
- #
- # View the documentation for the provider you are using for more
- # information on available options.
-
- # Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
- # such as FTP and Heroku are also available. See the documentation at
- # https://docs.vagrantup.com/v2/push/atlas.html for more information.
- # config.push.define "atlas" do |push|
- # push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
- # end
-
- # Enable provisioning with a shell script. Additional provisioners such as
- # Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
- # documentation for more information about their specific syntax and use.
- # config.vm.provision "shell", inline: <<-SHELL
- # apt-get update
- # apt-get install -y apache2
- # SHELL
-end
diff --git a/moonv4/moon_db/moon_db/__init__.py b/moonv4/moon_db/moon_db/__init__.py
index 64e88e23..578e22af 100644
--- a/moonv4/moon_db/moon_db/__init__.py
+++ b/moonv4/moon_db/moon_db/__init__.py
@@ -3,21 +3,5 @@
# license which can be found in the file 'LICENSE' in this package distribution
# or at 'http://www.apache.org/licenses/LICENSE-2.0'.
-
-# try:
-# from moon_utilities import options # noqa
-# except ImportError:
-# # mandatory when we just want to execute the setup.py
-# options = None
-
-# try:
-# from moon_db.core import IntraExtensionRootManager, IntraExtensionAdminManager, IntraExtensionAuthzManager # noqa
-# except ImportError:
-# # mandatory when we just want to execute the setup.py
-# IntraExtensionRootManager, IntraExtensionAdminManager, IntraExtensionAuthzManager = None, None, None
-
-# from moon_utilities import options # noqa
-# from moon_db.core import IntraExtensionRootManager, IntraExtensionAdminManager, IntraExtensionAuthzManager # noqa
-
-__version__ = "0.1.0"
+__version__ = "1.0.0"
diff --git a/moonv4/moon_db/moon_db/core.py b/moonv4/moon_db/moon_db/core.py
index 09c87e0b..cf233ab2 100644
--- a/moonv4/moon_db/moon_db/core.py
+++ b/moonv4/moon_db/moon_db/core.py
@@ -8,7 +8,7 @@ from oslo_log import log as logging
from oslo_config import cfg
from stevedore.driver import DriverManager
from moon_utilities import options # noqa
-from moon_db.api import model, policy, pdp, tenants, keystone
+from moon_db.api import model, policy, pdp, keystone
CONF = cfg.CONF
LOG = logging.getLogger(__name__)
@@ -218,10 +218,6 @@ KeystoneManager = keystone.KeystoneManager(
KeystoneDriver(CONF.database.driver, CONF.database.url)
)
-# ConfigurationManager = configuration.ConfigurationManager(
-# ConfigurationDriver(CONF.database_configuration.driver, CONF.database_configuration.url)
-# )
-
ModelManager = model.ModelManager(
ModelDriver(CONF.database.driver, CONF.database.url)
)
diff --git a/moonv4/moon_db/moon_db/db_manager.py b/moonv4/moon_db/moon_db/db_manager.py
index 1b0034ee..1c10aa22 100644
--- a/moonv4/moon_db/moon_db/db_manager.py
+++ b/moonv4/moon_db/moon_db/db_manager.py
@@ -6,16 +6,14 @@
"""
import os
-import sys
import glob
-import argparse
import importlib
from oslo_config import cfg
from oslo_log import log as logging
from sqlalchemy import create_engine
from moon_db.migrate_repo import versions
-# Note (dthom): The next line must be called before the next import
+# Note (asteroide): The next line must be called before the next import
# aka before registering all the options
cfg.CONF.register_cli_opt(cfg.StrOpt('command', positional=True,
help="The command to execute (upgrade, downgrade)"))
diff --git a/moonv4/moon_db/moon_db/exception.py b/moonv4/moon_db/moon_db/exception.py
deleted file mode 100644
index 21b6dd62..00000000
--- a/moonv4/moon_db/moon_db/exception.py
+++ /dev/null
@@ -1,410 +0,0 @@
-# Copyright 2015 Open Platform for NFV Project, Inc. and its contributors
-# This software is distributed under the terms and conditions of the 'Apache-2.0'
-# license which can be found in the file 'LICENSE' in this package distribution
-# or at 'http://www.apache.org/licenses/LICENSE-2.0'.
-
-# from keystone.common import dependency
-# from keystone.exception import Error
-# from keystone.i18n import _, _LW
-import logging
-# from oslo_log import log
-import logging
-
-LOG = logging.getLogger(__name__)
-_ = str
-
-
-class Error(Exception):
- pass
-
-
-class MoonErrorMetaClass(type):
-
- def __init__(cls, name, bases, dct):
- super(MoonErrorMetaClass, cls).__init__(name, bases, dct)
- cls.hierarchy += "/"+str(name)
-
-
-class MoonError(Error):
- __metaclass__ = MoonErrorMetaClass
- hierarchy = ""
- message_format = _("There is an error requesting the Moon platform.")
- code = 400
- title = 'Moon Error'
- logger = "ERROR"
-
- def __init__(self, message=""):
- if message:
- self.message_format = message
- super(MoonError, self).__init__()
-
- def __del__(self):
- message = "{} ({})".format(self.hierarchy, self.message_format)
- if self.logger == "ERROR":
- LOG.error(message)
- elif self.logger == "WARNING":
- LOG.warning(message)
- elif self.logger == "CRITICAL":
- LOG.critical(message)
- elif self.logger == "AUTHZ":
- LOG.error(message)
- else:
- LOG.info(message)
-
-
-# Exceptions for Tenant
-
-class TenantException(MoonError):
- message_format = _("There is an error requesting this tenant.")
- code = 400
- title = 'Tenant Error'
- logger = "ERROR"
-
-
-class TenantUnknown(TenantException):
- message_format = _("The tenant is unknown.")
- code = 400
- title = 'Tenant Unknown'
- logger = "ERROR"
-
-
-class TenantAddedNameExisting(TenantException):
- message_format = _("The tenant name is existing.")
- code = 400
- title = 'Added Tenant Name Existing'
- logger = "ERROR"
-
-
-class TenantNoIntraExtension(TenantException):
- message_format = _("The tenant has not intra_extension.")
- code = 400
- title = 'Tenant No Intra_Extension'
- logger = "ERROR"
-
-
-class TenantNoIntraAuthzExtension(TenantNoIntraExtension):
- message_format = _("The tenant has not intra_admin_extension.")
- code = 400
- title = 'Tenant No Intra_Admin_Extension'
- logger = "ERROR"
-
-# Exceptions for IntraExtension
-
-
-class IntraExtensionException(MoonError):
- message_format = _("There is an error requesting this IntraExtension.")
- code = 400
- title = 'Extension Error'
-
-
-class IntraExtensionUnknown(IntraExtensionException):
- message_format = _("The intra_extension is unknown.")
- code = 400
- title = 'Intra Extension Unknown'
- logger = "Error"
-
-
-class RootExtensionUnknown(IntraExtensionUnknown):
- message_format = _("The root_extension is unknown.")
- code = 400
- title = 'Root Extension Unknown'
- logger = "Error"
-
-
-class RootExtensionNotInitialized(IntraExtensionException):
- message_format = _("The root_extension is not initialized.")
- code = 400
- title = 'Root Extension Not Initialized'
- logger = "Error"
-
-
-class IntraExtensionCreationError(IntraExtensionException):
- message_format = _("The arguments for the creation of this Extension were malformed.")
- code = 400
- title = 'Intra Extension Creation Error'
-
-
-# Authz exceptions
-
-class AuthzException(MoonError):
- message_format = _("There is an authorization error requesting this IntraExtension.")
- code = 403
- title = 'Authz Exception'
- logger = "AUTHZ"
-
-
-# Admin exceptions
-
-class AdminException(MoonError):
- message_format = _("There is an error requesting this Authz IntraExtension.")
- code = 400
- title = 'Authz Exception'
- logger = "AUTHZ"
-
-
-class AdminMetaData(AdminException):
- code = 400
- title = 'Metadata Exception'
-
-
-class AdminPerimeter(AdminException):
- code = 400
- title = 'Perimeter Exception'
-
-
-class AdminScope(AdminException):
- code = 400
- title = 'Scope Exception'
-
-
-class AdminAssignment(AdminException):
- code = 400
- title = 'Assignment Exception'
-
-
-class AdminMetaRule(AdminException):
- code = 400
- title = 'Aggregation Algorithm Exception'
-
-
-class AdminRule(AdminException):
- code = 400
- title = 'Rule Exception'
-
-
-class SubjectCategoryNameExisting(AdminMetaData):
- message_format = _("The given subject category name is existing.")
- code = 400
- title = 'Subject Category Name Existing'
- logger = "ERROR"
-
-
-class ObjectCategoryNameExisting(AdminMetaData):
- message_format = _("The given object category name is existing.")
- code = 400
- title = 'Object Category Name Existing'
- logger = "ERROR"
-
-
-class ActionCategoryNameExisting(AdminMetaData):
- message_format = _("The given action category name is existing.")
- code = 400
- title = 'Action Category Name Existing'
- logger = "ERROR"
-
-
-class SubjectCategoryUnknown(AdminMetaData):
- message_format = _("The given subject category is unknown.")
- code = 400
- title = 'Subject Category Unknown'
- logger = "ERROR"
-
-
-class ObjectCategoryUnknown(AdminMetaData):
- message_format = _("The given object category is unknown.")
- code = 400
- title = 'Object Category Unknown'
- logger = "ERROR"
-
-
-class ActionCategoryUnknown(AdminMetaData):
- message_format = _("The given action category is unknown.")
- code = 400
- title = 'Action Category Unknown'
- logger = "ERROR"
-
-
-class SubjectUnknown(AdminPerimeter):
- message_format = _("The given subject is unknown.")
- code = 400
- title = 'Subject Unknown'
- logger = "ERROR"
-
-
-class ObjectUnknown(AdminPerimeter):
- message_format = _("The given object is unknown.")
- code = 400
- title = 'Object Unknown'
- logger = "ERROR"
-
-
-class ActionUnknown(AdminPerimeter):
- message_format = _("The given action is unknown.")
- code = 400
- title = 'Action Unknown'
- logger = "ERROR"
-
-
-class SubjectNameExisting(AdminPerimeter):
- message_format = _("The given subject name is existing.")
- code = 400
- title = 'Subject Name Existing'
- logger = "ERROR"
-
-
-class ObjectNameExisting(AdminPerimeter):
- message_format = _("The given object name is existing.")
- code = 400
- title = 'Object Name Existing'
- logger = "ERROR"
-
-
-class ActionNameExisting(AdminPerimeter):
- message_format = _("The given action name is existing.")
- code = 400
- title = 'Action Name Existing'
- logger = "ERROR"
-
-
-class ObjectsWriteNoAuthorized(AdminPerimeter):
- message_format = _("The modification on Objects is not authorized.")
- code = 400
- title = 'Objects Write No Authorized'
- logger = "AUTHZ"
-
-
-class ActionsWriteNoAuthorized(AdminPerimeter):
- message_format = _("The modification on Actions is not authorized.")
- code = 400
- title = 'Actions Write No Authorized'
- logger = "AUTHZ"
-
-
-class SubjectScopeUnknown(AdminScope):
- message_format = _("The given subject scope is unknown.")
- code = 400
- title = 'Subject Scope Unknown'
- logger = "ERROR"
-
-
-class ObjectScopeUnknown(AdminScope):
- message_format = _("The given object scope is unknown.")
- code = 400
- title = 'Object Scope Unknown'
- logger = "ERROR"
-
-
-class ActionScopeUnknown(AdminScope):
- message_format = _("The given action scope is unknown.")
- code = 400
- title = 'Action Scope Unknown'
- logger = "ERROR"
-
-
-class SubjectScopeNameExisting(AdminScope):
- message_format = _("The given subject scope name is existing.")
- code = 400
- title = 'Subject Scope Name Existing'
- logger = "ERROR"
-
-
-class ObjectScopeNameExisting(AdminScope):
- message_format = _("The given object scope name is existing.")
- code = 400
- title = 'Object Scope Name Existing'
- logger = "ERROR"
-
-
-class ActionScopeNameExisting(AdminScope):
- message_format = _("The given action scope name is existing.")
- code = 400
- title = 'Action Scope Name Existing'
- logger = "ERROR"
-
-
-class SubjectAssignmentUnknown(AdminAssignment):
- message_format = _("The given subject assignment value is unknown.")
- code = 400
- title = 'Subject Assignment Unknown'
- logger = "ERROR"
-
-
-class ObjectAssignmentUnknown(AdminAssignment):
- message_format = _("The given object assignment value is unknown.")
- code = 400
- title = 'Object Assignment Unknown'
- logger = "ERROR"
-
-
-class ActionAssignmentUnknown(AdminAssignment):
- message_format = _("The given action assignment value is unknown.")
- code = 400
- title = 'Action Assignment Unknown'
- logger = "ERROR"
-
-
-class SubjectAssignmentExisting(AdminAssignment):
- message_format = _("The given subject assignment value is existing.")
- code = 400
- title = 'Subject Assignment Existing'
- logger = "ERROR"
-
-
-class ObjectAssignmentExisting(AdminAssignment):
- message_format = _("The given object assignment value is existing.")
- code = 400
- title = 'Object Assignment Existing'
- logger = "ERROR"
-
-
-class ActionAssignmentExisting(AdminAssignment):
- message_format = _("The given action assignment value is existing.")
- code = 400
- title = 'Action Assignment Existing'
- logger = "ERROR"
-
-
-class AggregationAlgorithmNotExisting(AdminMetaRule):
- message_format = _("The given aggregation algorithm is not existing.")
- code = 400
- title = 'Aggregation Algorithm Not Existing'
- logger = "ERROR"
-
-
-class AggregationAlgorithmUnknown(AdminMetaRule):
- message_format = _("The given aggregation algorithm is unknown.")
- code = 400
- title = 'Aggregation Algorithm Unknown'
- logger = "ERROR"
-
-
-class SubMetaRuleAlgorithmNotExisting(AdminMetaRule):
- message_format = _("The given sub_meta_rule algorithm is unknown.")
- code = 400
- title = 'Sub_meta_rule Algorithm Unknown'
- logger = "ERROR"
-
-
-class SubMetaRuleUnknown(AdminMetaRule):
- message_format = _("The given sub meta rule is unknown.")
- code = 400
- title = 'Sub Meta Rule Unknown'
- logger = "ERROR"
-
-
-class SubMetaRuleNameExisting(AdminMetaRule):
- message_format = _("The sub meta rule name already exists.")
- code = 400
- title = 'Sub Meta Rule Name Existing'
- logger = "ERROR"
-
-
-class SubMetaRuleExisting(AdminMetaRule):
- message_format = _("The sub meta rule already exists.")
- code = 400
- title = 'Sub Meta Rule Existing'
- logger = "ERROR"
-
-
-class RuleExisting(AdminRule):
- message_format = _("The rule already exists.")
- code = 400
- title = 'Rule Existing'
- logger = "ERROR"
-
-
-class RuleUnknown(AdminRule):
- message_format = _("The rule for that request doesn't exist.")
- code = 400
- title = 'Rule Unknown'
- logger = "ERROR"
diff --git a/moonv4/moon_db/moon_db/migrate_repo/versions/001_moon.py b/moonv4/moon_db/moon_db/migrate_repo/versions/001_moon.py
index 73170ef0..2cc36140 100644
--- a/moonv4/moon_db/moon_db/migrate_repo/versions/001_moon.py
+++ b/moonv4/moon_db/moon_db/migrate_repo/versions/001_moon.py
@@ -211,6 +211,6 @@ def downgrade(migrate_engine):
table = sql.Table(_table, meta, autoload=True)
table.drop(migrate_engine, checkfirst=True)
except Exception as e:
- print(e.message)
+ print(e)