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

All Samples(21)  |  Call(12)  |  Derive(0)  |  Import(9)
<comment-ja>
??????????????????????????????
????????????????????????
@param modules: ???????????
@param webobj: 
@param machine: 
@type modules: list
@rtype: object dict_op
@return: ????????????
</comment-ja>(more...)

        def read_conf(modules, webobj=None, machine=None, extra_args={}):
    """
    ??????????????????????????????
    ????????????????????????
    @param modules: ???????????
    @param webobj: 
    @param machine: 
    @type modules: list
    @rtype: object dict_op
    @return: ????????????
    
    
    TODO: English Comment
    
    """

    if type(modules) == str:
        modules = [modules]

    options = {"module" : ":".join(modules)}

    try:
        options['include'] = extra_args['include']
    except:
        pass

    #cmd_name = u"Get Settings - %s" % ":".join(modules)
    cmd_name = u"Get Settings"

    if type(webobj) == types.InstanceType:
        from karesansui.db.model._2pysilhouette import Job, JobGroup, \
                                                       JOBGROUP_TYPE
        from karesansui.db.access._2pysilhouette import jg_findby1, jg_save,corp
        from karesansui.db.access._2pysilhouette import save_job_collaboration
        from karesansui.db.access.machine2jobgroup import new as m2j_new
        from pysilhouette.command import dict2command

        _cmd = dict2command(
            "%s/%s" % (karesansui.config['application.bin.dir'],
                       CONFIGURE_COMMAND_READ), options)

        jobgroup = JobGroup(cmd_name, karesansui.sheconf['env.uniqkey'])
        jobgroup.jobs.append(Job('%s command' % cmd_name, 0, _cmd))
        jobgroup.type = JOBGROUP_TYPE['PARALLEL']

        _machine2jobgroup = m2j_new(machine=machine,
                                jobgroup_id=-1,
                                uniq_key=karesansui.sheconf['env.uniqkey'],
                                created_user=webobj.me,
                                modified_user=webobj.me,
                                )

        if corp(webobj.orm, webobj.pysilhouette.orm,_machine2jobgroup, jobgroup) is False:
            webobj.logger.debug("%s command failed. Return to timeout" % (cmd_name))
            return False

        cmd_res = jobgroup.jobs[0].action_stdout

    else:
        from karesansui.lib.utils import execute_command

        opts_str = ""
        for x in options.keys():
            if options[x] is None:
                opts_str += "--%s " % x 
            else:
                opts_str += "--%s=%s " % (x, options[x])

        _cmd = "%s/bin/%s %s" % (KARESANSUI_PREFIX, CONFIGURE_COMMAND_READ, opts_str.strip(),)

        command_args = _cmd.strip().split(" ")
        (rc,res) = execute_command(command_args)
        if rc != 0:
            return False

        cmd_res = "\n".join(res)

    dop = DictOp()
    try:
        exec(cmd_res)
    except Exception:
        return False

    for module in modules:
        try:
            exec("dop.addconf('%s',Config_Dict_%s)" % (module,module,))
        except:
            pass

    return dop
        


src/k/a/karesansui-HEAD/karesansui/gadget/hostby1watchby1.py   karesansui(Download)
    get_partition_info, get_ifconfig_info, get_fs_info
 
from karesansui.lib.conf import read_conf, write_conf
 
from karesansui.lib.collectd.utils import plugin_selector_to_dict, \
        extra_args = {'include':'^threshold_'}
        #extra_args = {}
        dop = read_conf(modules, webobj=self, machine=host, extra_args=extra_args)
        if dop is False:
            self.logger.debug("Change watch failed. Failed read conf.")
        ## read config and delete threashold
        extra_args = {'include':'^threshold_'}
        dop = read_conf(modules, webobj=self, machine=host, extra_args=extra_args)
        if dop is False:
            self.logger.debug("Delete watch failed. Failed read conf.")

src/k/a/karesansui-HEAD/karesansui/gadget/hostby1watch.py   karesansui(Download)
    get_partition_info, get_ifconfig_info, get_fs_info
 
from karesansui.lib.conf import read_conf, write_conf
from karesansui.lib.collectd.config import set_threshold
from karesansui.db.access.machine import findbyhost1 as m_findbyhost1, \
        extra_args = {'include':'^threshold_'}
        #extra_args = {}
        dop = read_conf(modules, webobj=self, machine=host, extra_args=extra_args)
        if dop is False:
            self.logger.debug("Set watch failed. Failed read conf.")

src/k/a/karesansui-HEAD/karesansui/gadget/hostby1staticrouteby1.py   karesansui(Download)
from karesansui.lib.utils import preprint_r, base64_encode, base64_decode
 
from karesansui.lib.conf import read_conf, write_conf
from karesansui.lib.parser.staticroute import staticrouteParser as Parser
from karesansui.lib.networkaddress import NetworkAddress
        modules = ["staticroute"]
 
        dop = read_conf(modules, self, host)
        if dop is False:
            return web.internalerror('Internal Server Error. (Timeout)')

src/k/a/karesansui-HEAD/karesansui/gadget/hostby1networksettingsnicby1.py   karesansui(Download)
 
from karesansui.lib.utils import get_ifconfig_info, dict_ksort, get_bonding_info, is_param
from karesansui.lib.conf import read_conf, write_conf
from karesansui.lib.networkaddress import NetworkAddress
from karesansui.lib.const import BONDING_COMMAND_DELETE
 
        host = findbyhost1(self.orm, host_id)
        dop = read_conf(modules,self,host)
        if dop is False:
            self.logger.error("Get nic info failed. Failed read conf.")
 
        modules = ["ifcfg"]
        dop = read_conf(modules, self, host)
        if dop is False:
            self.logger.error("Change nic failed. Failed read conf.")

src/k/a/karesansui-HEAD/karesansui/gadget/hostby1networksettingsgeneral.py   karesansui(Download)
from karesansui.db.access.machine import findbyhost1
from karesansui.lib.utils import get_ifconfig_info, dict_ksort, is_param
from karesansui.lib.conf import read_conf, write_conf
from karesansui.lib.const import FQDN_MIN_LENGTH, \
    FQDN_MAX_LENGTH
 
        host = findbyhost1(self.orm, host_id)
        dop = read_conf(modules, self, host)
        if dop is False:
            return web.internalerror('Internal Server Error. (Timeout)')
 
        host = findbyhost1(self.orm, host_id)
        dop = read_conf(modules, self, host)
        if dop is False:
            self.logger.error("Change network general failed. Failed read conf.")

src/k/a/karesansui-HEAD/karesansui/lib/collectd/config.py   karesansui(Download)
import types
 
from karesansui.lib.conf import read_conf, write_conf
from karesansui.lib.utils import uniq_sort
from karesansui.lib.utils import preprint_r
def _get_collectd_config(webobj=None, host=None):
    modules = ["collectd","collectdplugin"]
 
    dop = read_conf(modules, webobj, host)
    if dop is False:

src/k/a/karesansui-HEAD/karesansui/gadget/hostby1staticroute.py   karesansui(Download)
from karesansui.lib.networkaddress import NetworkAddress
from karesansui.lib.parser.staticroute import staticrouteParser as Parser
from karesansui.lib.conf import read_conf, write_conf
 
def validates_staticroute(obj):
        modules = ["staticroute"]
 
        dop = read_conf(modules, self, host)
        if dop is False:
            return web.internalerror('Internal Server Error. (Timeout)')

src/k/a/karesansui-HEAD/karesansui/gadget/hostby1iptables.py   karesansui(Download)
from karesansui.db.access.machine import findbyhost1
from karesansui.lib.utils import get_ifconfig_info, dict_ksort, is_param
from karesansui.lib.conf import read_conf, write_conf
from karesansui.lib.iptables import iptables_lint_contents
 
 
        host = findbyhost1(self.orm, host_id)
        dop = read_conf(modules, self, host)
        if dop is False:
            return web.internalerror('Internal Server Error. (Timeout)')

src/k/a/karesansui-HEAD/karesansui/lib/collectd/notification.py   karesansui(Download)
 
    try:
        from karesansui.lib.conf import read_conf
        modules = ["collectd"]
        dop = read_conf(modules)