Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(65)  |  Call(50)  |  Derive(0)  |  Import(15)
<comment-ja>
??????????????????????????????
@param path:????????????
@param group:?????????????ID
@return: ????True?????False
@rtype: bool
</comment-ja>
<comment-en>
TODO: English Comment
</comment-en>

        def r_chgrp(path,group):
    """
    ??????????????????????????????
    @param path:????????????
    @param group:?????????????ID
    @return: ????True?????False
    @rtype: bool
    
    
    TODO: English Comment
    
    """
    group = str(group)
    if not os.path.exists(path):
        return False

    statinfo = os.stat(path)
    uid = statinfo.st_uid

    if is_int(group) is not True:
        try:
            gr = grp.getgrnam(group)
        except:
            return False
    else:
        try:
            gr = grp.getgrgid(int(group))
        except:
            return False
    gid = gr[2]

    if os.path.isfile(path) or os.path.islink(path):
        try:
            os.chown(path,uid,gid)
        except:
            return False

    elif os.path.isdir(path):
        try:
            os.chown(path,uid,gid)
        except:
            return False

        for name in os.listdir(path):
            sub_path = os.path.join(path, name)
            r_chgrp(sub_path,group)

    return True
        


src/k/a/karesansui-HEAD/karesansui/lib/virt/virt.py   karesansui(Download)
from karesansui.lib.utils import copy_file            as CopyFile
from karesansui.lib.net.http import wget              as DownloadFile
from karesansui.lib.utils import is_uuid, get_ifconfig_info, r_chgrp, r_chmod, \
  getfilesize_str, get_filesize_MB, get_disk_img_info, available_virt_uris, \
  is_iso9660_filesystem_format, is_windows_bootable_iso, is_darwin_bootable_iso, \
        self.logger = logging.getLogger('karesansui.virt')
        if os.getuid() == 0:
            r_chgrp(VIRT_LIBVIRT_DATA_DIR,KARESANSUI_GROUP)
            r_chmod(VIRT_DOMAINS_DIR,"o-rwx")
 
            self.logger = logging.getLogger('karesansui.virt')
            if os.getuid() == 0:
                r_chgrp(self.config_dir,KARESANSUI_GROUP)
        except:
            pass
                    ConfigFile(xml_file).write(dom.XMLDesc(0))
                    if os.getuid() == 0 and os.path.exists(xml_file):
                        r_chgrp(xml_file,KARESANSUI_GROUP)
            #param.load_xml_config(xml_file)
            param.load_xml_config(dom.XMLDesc(VIR_DOMAIN_XML_INACTIVE))
                    ConfigFile(xml_file).write(dom.XMLDesc(0))
                    if os.getuid() == 0 and os.path.exists(xml_file):
                        r_chgrp(xml_file,KARESANSUI_GROUP)
            #param.load_xml_config(xml_file)
            param.load_xml_config(dom.XMLDesc(VIR_DOMAIN_XML_INACTIVE))

src/k/a/karesansui-HEAD/karesansui/lib/conf.py   karesansui(Download)
                                 CONFIGURE_COMMAND_READ, CONFIGURE_COMMAND_WRITE
from karesansui.lib.dict_op import DictOp
from karesansui.lib.utils import preprint_r, r_chmod, r_chown, r_chgrp, base64_encode
 
CONF_TMP_DIR = "%s/tmp/.conf" % (KARESANSUI_DATA_DIR,)
        r_chmod(CONF_TMP_DIR,0770)
        r_chown(CONF_TMP_DIR,KARESANSUI_USER)
        r_chgrp(CONF_TMP_DIR,KARESANSUI_GROUP)
 
    serial = time.strftime("%Y%m%d%H%M%S",time.localtime())
            r_chmod(filename,0660)
            r_chown(filename,KARESANSUI_USER)
            r_chgrp(filename,KARESANSUI_GROUP)
            w_modules.append(_module)
            w_files.append(filename)

src/k/a/karesansui-HEAD/karesansui/lib/iptables.py   karesansui(Download)
 
import karesansui
from karesansui.lib.utils import preprint_r, r_chmod, r_chown, r_chgrp
from karesansui.lib.const import KARESANSUI_PREFIX, KARESANSUI_DATA_DIR, \
                                 KARESANSUI_USER, KARESANSUI_GROUP
        r_chmod(CONF_TMP_DIR,0770)
        r_chown(CONF_TMP_DIR,KARESANSUI_USER)
        r_chgrp(CONF_TMP_DIR,KARESANSUI_GROUP)
 
    seconds = 10 * 60
    r_chmod(filename,0660)
    r_chown(filename,KARESANSUI_USER)
    r_chgrp(filename,KARESANSUI_GROUP)
 
    return iptables_lint(filename, webobj, machine, delete=True)

src/k/a/karesansui-HEAD/karesansui/lib/virt/config.py   karesansui(Download)
                                 KVM_KARESANSUI_TMP_DIR
 
from karesansui.lib.utils import get_xml_xpath as XMLXpath, \
     get_nums_xml_xpath as XMLXpathNum, \
     get_xml_parse as XMLParse, \
        r_chmod(filename,"g+rw")
        if os.getuid() == 0:
            r_chgrp(filename,KARESANSUI_GROUP)
 
    def copycfg(self,src_dir):
        r_chmod(filename,"g+rw")
        if os.getuid() == 0:
            r_chgrp(filename,KARESANSUI_GROUP)
 
    def removecfg(self, config_dir=None):
        r_chmod(filename,"g+rw")
        if os.getuid() == 0:
            r_chgrp(filename,KARESANSUI_GROUP)
 
    def copycfg(self,src_dir):
        r_chmod(filename,"g+rw")
        if os.getuid() == 0:
            r_chgrp(filename,KARESANSUI_GROUP)
 
    def removecfg(self, config_dir=None):

src/k/a/karesansui-HEAD/karesansui/lib/collectd/action/script.py   karesansui(Download)
from karesansui.lib.const import KARESANSUI_PREFIX, KARESANSUI_DATA_DIR, \
                                 KARESANSUI_USER, KARESANSUI_GROUP
from karesansui.lib.utils import execute_command, r_chmod, r_chown, r_chgrp
from karesansui.lib.collectd.utils import append_line
 
        r_chmod(SCRIPT_TMP_DIR,0770)
        r_chown(SCRIPT_TMP_DIR,KARESANSUI_USER)
        r_chgrp(SCRIPT_TMP_DIR,KARESANSUI_GROUP)
        append_line(logfile,"[%s] Create directory '%s'." % (func_name,SCRIPT_TMP_DIR,))
 

src/k/a/karesansui-HEAD/karesansui/lib/virt/snapshot.py   karesansui(Download)
from karesansui.lib.utils import get_xml_xpath        as XMLXpath
from karesansui.lib.utils import get_nums_xml_xpath   as XMLXpathNum
from karesansui.lib.utils import get_inspect_stack, preprint_r, r_chgrp, r_chmod
from karesansui.lib.const import VIRT_XML_CONFIG_DIR, VIRT_SNAPSHOT_DIR, KARESANSUI_GROUP
from karesansui.lib.file.configfile import ConfigFile
                if os.path.exists(xml_path):
                    if os.getuid() == 0:
                        r_chgrp(xml_path,KARESANSUI_GROUP)
                        r_chmod(xml_path,"g+rw")
                        r_chmod(xml_path,"o-rwx")

src/k/a/karesansui-HEAD/karesansui/lib/virt/config_storage.py   karesansui(Download)
from karesansui.lib.utils import get_xml_parse        as XMLParse
from karesansui.lib.utils import get_xml_xpath        as XMLXpath
from karesansui.lib.utils import r_chgrp, r_chmod, symlink2real
from karesansui.lib.file.configfile import ConfigFile
 
        r_chmod(filename,"g+rw")
        if os.getuid() == 0:
            r_chgrp(filename,KARESANSUI_GROUP)
 
class StoragePoolXMLConfigGenerator(StorageXMLGenerator):

src/k/a/karesansui-HEAD/karesansui/lib/service/config.py   karesansui(Download)
import karesansui
 
from karesansui.lib.utils import get_xml_xpath as XMLXpath, \
     get_nums_xml_xpath as XMLXpathNum, \
     get_xml_parse as XMLParse, \
 
        if os.getuid() == 0:
            r_chgrp(self.config_path, KARESANSUI_GROUP)
 
    def generate_xml_tree(self, config):

src/k/a/karesansui-HEAD/karesansui/lib/virt/config_export.py   karesansui(Download)
import karesansui
 
from karesansui.lib.utils import get_xml_xpath as XMLXpath, \
     get_nums_xml_xpath as XMLXpathNum, \
     get_xml_parse as XMLParse, \
 
        if os.getuid() == 0:
            r_chgrp(self.path, KARESANSUI_GROUP)
 
    def generate_xml_tree(self, config):

src/k/a/karesansui-HEAD/karesansui/lib/virt/config_network.py   karesansui(Download)
from karesansui.lib.utils import get_xml_parse        as XMLParse
from karesansui.lib.utils import get_xml_xpath        as XMLXpath
from karesansui.lib.utils import r_chgrp, r_chmod
from karesansui.lib.networkaddress import NetworkAddress
from karesansui.lib.file.configfile import ConfigFile
        r_chmod(filename,"g+rw")
        if os.getuid() == 0:
            r_chgrp(filename,KARESANSUI_GROUP)
 
 

  1 | 2  Next