~ubuntu-branches/ubuntu/vivid/ironic/vivid-updates

« back to all changes in this revision

Viewing changes to ironic/openstack/common/fileutils.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2015-03-30 11:14:57 UTC
  • mfrom: (1.2.6)
  • Revision ID: package-import@ubuntu.com-20150330111457-kr4ju3guf22m4vbz
Tags: 2015.1~b3-0ubuntu1
* New upstream release.
  + d/control: 
    - Align with upstream dependencies.
    - Add dh-python to build-dependencies.
    - Add psmisc as a dependency. (LP: #1358820)
  + d/p/fix-requirements.patch: Rediffed.
  + d/ironic-conductor.init.in: Fixed typos in LSB headers,
    thanks to JJ Asghar. (LP: #1429962)

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
import errno
18
18
import logging
19
19
import os
 
20
import stat
20
21
import tempfile
21
22
 
22
 
from oslo.utils import excutils
 
23
from oslo_utils import excutils
23
24
 
24
25
LOG = logging.getLogger(__name__)
25
26
 
26
27
_FILE_CACHE = {}
27
 
 
28
 
 
29
 
def ensure_tree(path):
 
28
DEFAULT_MODE = stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO
 
29
 
 
30
 
 
31
def ensure_tree(path, mode=DEFAULT_MODE):
30
32
    """Create a directory (and any ancestor directories required)
31
33
 
32
34
    :param path: Directory to create
 
35
    :param mode: Directory creation permissions
33
36
    """
34
37
    try:
35
 
        os.makedirs(path)
 
38
        os.makedirs(path, mode)
36
39
    except OSError as exc:
37
40
        if exc.errno == errno.EEXIST:
38
41
            if not os.path.isdir(path):