"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "monasca_api/common/policy/policy_engine.py" between
monasca-api-5.0.0.tar.gz and monasca-api-6.0.0.tar.gz

About: OpenStack Monasca API is a RESTful API server that is designed with a layered architecture and supports Monitoring as a Service (MONaaS).
The "Wallaby" series (latest release).

policy_engine.py  (monasca-api-5.0.0):policy_engine.py  (monasca-api-6.0.0)
skipping to change at line 24 skipping to change at line 24
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import copy import copy
import re import re
import sys import sys
import logging import logging
from oslo_config import cfg from oslo_config import cfg
from oslo_policy import opts
from oslo_policy import policy from oslo_policy import policy
from monasca_api.common.policy.i18n import _LW from monasca_api.common.policy.i18n import _LW
CONF = cfg.CONF CONF = cfg.CONF
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
POLICIES = None POLICIES = None
USER_BASED_RESOURCES = ['os-keypairs'] USER_BASED_RESOURCES = ['os-keypairs']
KEY_EXPR = re.compile(r'%\((\w+)\)s') KEY_EXPR = re.compile(r'%\((\w+)\)s')
_ENFORCER = None _ENFORCER = None
# oslo_policy will read the policy configuration file again when the file # oslo_policy will read the policy configuration file again when the file
# is changed in runtime so the old policy rules will be saved to # is changed in runtime so the old policy rules will be saved to
# saved_file_rules and used to compare with new rules to determine # saved_file_rules and used to compare with new rules to determine
# whether the rules were updated. # whether the rules were updated.
saved_file_rules = [] saved_file_rules = []
# TODO(gmann): Remove setting the default value of config policy_file
# once oslo_policy change the default value to 'policy.yaml'.
# https://github.com/openstack/oslo.policy/blob/a626ad12fe5a3abd49d70e3e5b95589d
279ab578/oslo_policy/opts.py#L49
DEFAULT_POLICY_FILE = 'policy.yaml'
opts.set_defaults(cfg.CONF, DEFAULT_POLICY_FILE)
def reset(): def reset():
"""Reset Enforcer class.""" """Reset Enforcer class."""
global _ENFORCER global _ENFORCER
if _ENFORCER: if _ENFORCER:
_ENFORCER.clear() _ENFORCER.clear()
_ENFORCER = None _ENFORCER = None
def init(policy_file=None, rules=None, default_rule=None, use_conf=True): def init(policy_file=None, rules=None, default_rule=None, use_conf=True):
"""Init an Enforcer class. """Init an Enforcer class.
 End of changes. 2 change blocks. 
0 lines changed or deleted 8 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)