Exemplo n.º 1
0
#    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.


import contextlib
import errno
import os
import tempfile

#from neutron.openstack.common import excutils
#from neutron.openstack.common.gettextutils import _
from charging.openstack.common import log as logging

LOG = logging.getLogger(__name__)

_FILE_CACHE = {}


def ensure_tree(path):
    """Create a directory (and any ancestor directories required)

    :param path: Directory to create
    """
    try:
        os.makedirs(path)
    except OSError as exc:
        if exc.errno == errno.EEXIST:
            if not os.path.isdir(path):
                raise
Exemplo n.º 2
0
as it allows particular rules to be explicitly disabled.
"""

import abc
import re
import urllib

import six
import urllib2

#from neutron.openstack.common.gettextutils import _
#from neutron.openstack.common import jsonutils
from charging.openstack.common import log as logging


LOG = logging.getLogger(__name__)


_rules = None
_checks = {}


class Rules(dict):
    """
    A store for rules.  Handles the default_rule setting directly.
    """

    @classmethod
    def load_json(cls, data, default_rule=None):
        """
        Allow loading of JSON rule data.