src/admin_toolbelt/storage/__init__.py
def create_path(path, owner, group, mode=0o700, copy_files=[], usage_quota=None, inode_quota=None):
    """Creates a directory with the given attributes if it doesn't exist."""
    logging.info(('create_path(' + 
        'path={}, owner={}, group={}, mode={}, copy_files={}, usage_quota={}, inode_quota={}' + 
        ')').format(path, owner, group, mode, copy_files, usage_quota, inode_quota)
    )
    if not os.path.exists(path):
        logging.info('%s: Path does not exist, creating...', path)
        mnt = get_mount_info(path)
        os.mkdir(path)

        for src, dest in copy_files:
            shutil.copyfile(src, os.path.join(path, dest))

        run_cmd('chown -R {0}:{1} {2}'.format(owner, group, path))
        os.chmod(path, mode)
        
        if usage_quota or inode_quota:
            run_cmd(set_quota_cmd(
                owner, mnt.file, fstype=mnt.vfstype, usage=usage_quota, inode=inode_quota
            ))

        logging.info('... done.')
Creates a directory with the given attributes if it doesn't exist.
Creates a directory with the given attributes if it doesn't exist.
Creates a directory with the given attributes if it doesn ' t exist .
def create_path(path, owner, group, mode=0o700, copy_files=[], usage_quota=None, inode_quota=None):
    logging.info(('create_path(' + 
        'path={}, owner={}, group={}, mode={}, copy_files={}, usage_quota={}, inode_quota={}' + 
        ')').format(path, owner, group, mode, copy_files, usage_quota, inode_quota)
    )
    if not os.path.exists(path):
        logging.info('%s: Path does not exist, creating...', path)
        mnt = get_mount_info(path)
        os.mkdir(path)
        for src, dest in copy_files:
            shutil.copyfile(src, os.path.join(path, dest))
        run_cmd('chown -R {0}:{1} {2}'.format(owner, group, path))
        os.chmod(path, mode)
        if usage_quota or inode_quota:
            run_cmd(set_quota_cmd(
                owner, mnt.file, fstype=mnt.vfstype, usage=usage_quota, inode=inode_quota
            ))
        logging.info('... done.')
def create_path ( path , owner , group , mode = 0o700 , copy_files = [ ] , usage_quota = None , inode_quota = None ) : logging . info ( ( 'create_path(' + 'path={}, owner={}, group={}, mode={}, copy_files={}, usage_quota={}, inode_quota={}' + ')' ) . format ( path , owner , group , mode , copy_files , usage_quota , inode_quota ) ) if not os . path . exists ( path ) : logging . info ( '%s: Path does not exist, creating...' , path ) mnt = get_mount_info ( path ) os . mkdir ( path ) for src , dest in copy_files : shutil . copyfile ( src , os . path . join ( path , dest ) ) run_cmd ( 'chown -R {0}:{1} {2}' . format ( owner , group , path ) ) os . chmod ( path , mode ) if usage_quota or inode_quota : run_cmd ( set_quota_cmd ( owner , mnt . file , fstype = mnt . vfstype , usage = usage_quota , inode = inode_quota ) ) logging . info ( '... done.' )
Creates a directory with the given attributes if it doesn't exist.
Creates a directory with the given attributes if it doesn ' t exist .
"""Creates a directory with the given attributes if it doesn't exist."""
path
owner
group
mode
copy_files
usage_quota
inode_quota