コード例 #1
0
ファイル: ui_resource.py プロジェクト: icclab/crmsh
 def do_scores(self, context):
     "usage: scores"
     if utils.is_program('crm_simulate'):
         utils.ext_cmd('crm_simulate -sL')
     elif utils.is_program('ptest'):
         utils.ext_cmd('ptest -sL')
     else:
         context.fatal_error("Need crm_simulate or ptest in path to display scores")
コード例 #2
0
 def do_scores(self, context):
     "usage: scores"
     if utils.is_program('crm_simulate'):
         utils.ext_cmd('crm_simulate -sL')
     elif utils.is_program('ptest'):
         utils.ext_cmd('ptest -sL')
     else:
         context.fatal_error("Need crm_simulate or ptest in path to display scores")
コード例 #3
0
 def requires(self):
     # see the configure ptest/simulate command
     has_ptest = utils.is_program('ptest')
     has_simulate = utils.is_program('crm_simulate')
     if not has_ptest:
         vars.simulate_programs["ptest"] = "crm_simulate"
     if not has_simulate:
         vars.simulate_programs["simulate"] = "ptest"
     if not (has_ptest or has_simulate):
         common_warn("neither ptest nor crm_simulate exist, check your installation")
         vars.simulate_programs["ptest"] = ""
         vars.simulate_programs["simulate"] = ""
     return True
コード例 #4
0
ファイル: ui_configure.py プロジェクト: lge/crmsh
 def requires(self):
     if not cib_factory.initialize():
         return False
     # see the configure ptest/simulate command
     has_ptest = utils.is_program('ptest')
     has_simulate = utils.is_program('crm_simulate')
     if not has_ptest:
         constants.simulate_programs["ptest"] = "crm_simulate"
     if not has_simulate:
         constants.simulate_programs["simulate"] = "ptest"
     if not (has_ptest or has_simulate):
         common_warn("neither ptest nor crm_simulate exist, check your installation")
         constants.simulate_programs["ptest"] = ""
         constants.simulate_programs["simulate"] = ""
     return True
コード例 #5
0
 def is_lrmd_accessible(self):
     if not (is_program(lrmadmin_prog) and is_process("lrmd")):
         return False
     cmd = add_sudo(">/dev/null 2>&1 %s -C" % lrmadmin_prog)
     if options.regression_tests:
         print ".EXT", cmd
     return subprocess.call(cmd, shell=True) == 0
コード例 #6
0
 def requires(self):
     if not cib_factory.initialize():
         return False
     # see the configure ptest/simulate command
     has_ptest = utils.is_program('ptest')
     has_simulate = utils.is_program('crm_simulate')
     if not has_ptest:
         constants.simulate_programs["ptest"] = "crm_simulate"
     if not has_simulate:
         constants.simulate_programs["simulate"] = "ptest"
     if not (has_ptest or has_simulate):
         common_warn(
             "neither ptest nor crm_simulate exist, check your installation"
         )
         constants.simulate_programs["ptest"] = ""
         constants.simulate_programs["simulate"] = ""
     return True
コード例 #7
0
ファイル: ra.py プロジェクト: ingted/clusterLab
 def is_lrmd_accessible(self):
     if not (is_program(lrmadmin_prog) and is_process("lrmd")):
         return False
     cmd = add_sudo(">/dev/null 2>&1 %s -C" % lrmadmin_prog)
     if options.regression_tests:
         print ".EXT", cmd
     return subprocess.call(
         cmd,
         shell=True) == 0
コード例 #8
0
ファイル: ra.py プロジェクト: icclab/crmsh
def prog_meta(prog):
    '''
    Do external program metadata.
    '''
    if is_program(prog):
        rc, l = stdout2list("%s metadata" % prog)
        if rc == 0:
            return l
        common_debug("%s metadata exited with code %d" % (prog, rc))
    return []
コード例 #9
0
def prog_meta(prog):
    '''
    Do external program metadata.
    '''
    prog = is_program(prog)
    if prog:
        rc, l = stdout2list("%s metadata" % prog)
        if rc == 0:
            return l
        common_debug("%s metadata exited with code %d" % (prog, rc))
    return []
コード例 #10
0
def prog_meta(prog):
    '''
    Do external program metadata.
    '''
    l = []
    if is_program(prog):
        rc, l = stdout2list("%s metadata" % prog)
        if rc != 0:
            common_debug("%s metadata exited with code %d" % (prog, rc))
            l = []
    return l
コード例 #11
0
ファイル: ui_report.py プロジェクト: aomoriringo/crmsh
def create_report(context, args):
    toolopts = [os.path.join(config.path.sharedir, 'hb_report'),
                'hb_report',
                'crm_report']
    extcmd = None
    for tool in toolopts:
        if utils.is_program(tool):
            extcmd = tool
            break
    if not extcmd:
        context.fatal_error("No reporting tool found")
    cmd = [extcmd] + list(args)
    if options.regression_tests:
        print ".EXT", cmd
    return subprocess.call(cmd, shell=False, preexec_fn=lambda: signal(SIGPIPE, SIG_DFL))
コード例 #12
0
ファイル: ra.py プロジェクト: jonnary/crmsh
def prog_meta(prog):
    '''
    Do external program metadata.
    '''
    if prog == "crmd" and os.path.isfile(os.path.join(config.path.crm_daemon_dir, 'crmd')):
        prog = os.path.join(config.path.crm_daemon_dir, 'crmd')
        rc, l = stdout2list("%s metadata" % prog)
        if rc == 0:
            return l
        common_debug("%s metadata exited with code %d" % (prog, rc))
    elif is_program(prog):
        rc, l = stdout2list("%s metadata" % prog)
        if rc == 0:
            return l
        common_debug("%s metadata exited with code %d" % (prog, rc))
    return []
コード例 #13
0
def can_use_lrmadmin():
    from distutils import version
    # after this glue release all users can get meta-data and
    # similar from lrmd
    minimum_glue = "1.0.10"
    rc, glue_ver = get_stdout("%s -v" % lrmadmin_prog, stderr_on=False)
    if not glue_ver:  # lrmadmin probably not found
        return False
    v_min = version.LooseVersion(minimum_glue)
    v_this = version.LooseVersion(glue_ver)
    if v_this < v_min:
        return False
    if userdir.getuser() not in ("root", config.path.crm_daemon_user):
        return False
    if not (is_program(lrmadmin_prog) and is_process("lrmd")):
        return False
    return utils.ext_cmd(">/dev/null 2>&1 %s -C" % lrmadmin_prog) == 0
コード例 #14
0
ファイル: ra.py プロジェクト: icclab/crmsh
def can_use_lrmadmin():
    from distutils import version
    # after this glue release all users can get meta-data and
    # similar from lrmd
    minimum_glue = "1.0.10"
    rc, glue_ver = get_stdout("%s -v" % lrmadmin_prog, stderr_on=False)
    if not glue_ver:  # lrmadmin probably not found
        return False
    v_min = version.LooseVersion(minimum_glue)
    v_this = version.LooseVersion(glue_ver)
    if v_this < v_min:
        return False
    if userdir.getuser() not in ("root", config.path.crm_daemon_user):
        return False
    if not (is_program(lrmadmin_prog) and is_process("lrmd")):
        return False
    return utils.ext_cmd(">/dev/null 2>&1 %s -C" % lrmadmin_prog) == 0
コード例 #15
0
ファイル: cmd_status.py プロジェクト: jonnary/crmsh
def crm_mon(opts=''):
    """
    Run 'crm_mon -1'
    opts: Additional options to pass to crm_mon
    returns: rc, stdout
    """
    global _crm_mon
    if _crm_mon is None:
        if not utils.is_program("crm_mon"):
            raise IOError("crm_mon not available, check your installation")
        _, out = utils.get_stdout("crm_mon --help")
        if "--pending" in out:
            _crm_mon = "crm_mon -1 -j"
        else:
            _crm_mon = "crm_mon -1"

    status_cmd = "%s %s" % (_crm_mon, opts)
    return utils.get_stdout(utils.add_sudo(status_cmd))
コード例 #16
0
def create_report(context, args):
    toolopts = [
        os.path.join(config.path.sharedir, 'hb_report'), 'hb_report',
        'crm_report'
    ]
    extcmd = None
    for tool in toolopts:
        if utils.is_program(tool):
            extcmd = tool
            break
    if not extcmd:
        context.fatal_error("No reporting tool found")
    cmd = [extcmd] + list(args)
    if options.regression_tests:
        print ".EXT", cmd
    return subprocess.call(cmd,
                           shell=False,
                           preexec_fn=lambda: signal(SIGPIPE, SIG_DFL))
コード例 #17
0
ファイル: cmd_status.py プロジェクト: HideoYamauchi/crmsh
def crm_mon(opts=''):
    """
    Run 'crm_mon -1'
    opts: Additional options to pass to crm_mon
    returns: rc, stdout
    """
    global _crm_mon
    if _crm_mon is None:
        prog = utils.is_program("crm_mon")
        if not prog:
            raise IOError("crm_mon not available, check your installation")
        _, out = utils.get_stdout("%s --help" % (prog))
        if "--pending" in out:
            _crm_mon = "%s -1 -j" % (prog)
        else:
            _crm_mon = "%s -1" % (prog)

    status_cmd = "%s %s" % (_crm_mon, opts)
    return utils.get_stdout(utils.add_sudo(status_cmd))
コード例 #18
0
 def requires(self):
     for program in ('crm_resource', 'crm_attribute'):
         if not utils.is_program(program):
             no_prog_err(program)
             return False
     return True
コード例 #19
0
def check_tools():
    return all(
        utils.is_program(p) for p in
        ['corosync-cfgtool', 'corosync-quorumtool', 'corosync-cmapctl'])
コード例 #20
0
 def requires(self):
     for p in ('cibadmin', 'crm_attribute'):
         if not utils.is_program(p):
             no_prog_err(p)
             return False
     return True
コード例 #21
0
ファイル: ui_cib.py プロジェクト: lge/crmsh
 def requires(self):
     if not utils.is_program('crm_shadow'):
         no_prog_err('crm_shadow')
         return False
     return True
コード例 #22
0
ファイル: corosync.py プロジェクト: lge/crmsh
def check_tools():
    return all(utils.is_program(p)
               for p in ['corosync-cfgtool', 'corosync-quorumtool', 'corosync-cmapctl'])
コード例 #23
0
ファイル: cmd_status.py プロジェクト: icclab/crmsh
def has_crm_mon():
    p = crm_mon_prog
    if not utils.is_program(p):
        raise IOError("%s not available, check your installation" % crm_mon_prog)
コード例 #24
0
def has_crm_mon():
    p = crm_mon_prog
    if not utils.is_program(p):
        raise IOError("%s not available, check your installation" %
                      crm_mon_prog)
コード例 #25
0
ファイル: ui_resource.py プロジェクト: icclab/crmsh
 def requires(self):
     for program in ('crm_resource', 'crm_attribute'):
         if not utils.is_program(program):
             no_prog_err(program)
             return False
     return True
コード例 #26
0
 def requires(self):
     if not utils.is_program('crm_shadow'):
         no_prog_err('crm_shadow')
         return False
     return True