コード例 #1
0
ファイル: fileutils.py プロジェクト: isabella232/meniscus
#
#    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.

import contextlib
import errno
import os

from meniscus.openstack.common import excutils
from meniscus.openstack.common.gettextutils import _
from meniscus.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
コード例 #2
0
ファイル: env.py プロジェクト: thomdixon/meniscus
def get_logger(logger_name):
    return logging.getLogger(logger_name)
コード例 #3
0
ファイル: env.py プロジェクト: jbenito/meniscus
def get_logger(logger_name):
    return logging.getLogger(logger_name)
コード例 #4
0
ファイル: fileutils.py プロジェクト: ProjectMeniscus/meniscus
#    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.


import contextlib
import errno
import os

from meniscus.openstack.common import excutils
from meniscus.openstack.common.gettextutils import _
from meniscus.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