示例#1
0
文件: acl.py 项目: tradej/pcs
def acl_show(argv):
    dom = utils.get_cib_dom()

    properties = prop.get_set_properties(defaults=prop.get_default_properties())
    acl_enabled = properties.get("enable-acl", "").lower()
    if utils.is_cib_true(acl_enabled):
        print("ACLs are enabled")
    else:
        print("ACLs are disabled, run 'pcs acl enable' to enable")
    print()

    print_targets(dom)
    print_groups(dom)
    print_roles(dom)
示例#2
0
文件: acl.py 项目: ingted/pcs
def acl_show(argv):
    dom = utils.get_cib_dom()

    properties = prop.get_set_properties(
        defaults=prop.get_default_properties())
    acl_enabled = properties.get("enable-acl", "").lower()
    if utils.is_cib_true(acl_enabled):
        print "ACLs are enabled"
    else:
        print "ACLs are disabled, run 'pcs acl enable' to enable"
    print

    print_targets(dom)
    print_groups(dom)
    print_roles(dom)
示例#3
0
def order_el_to_string(ord_loc, showDetail=False):
    oc_resource1 = ord_loc.getAttribute("first")
    oc_resource2 = ord_loc.getAttribute("then")
    first_action = ord_loc.getAttribute("first-action")
    then_action = ord_loc.getAttribute("then-action")
    oc_id = ord_loc.getAttribute("id")
    oc_score = ord_loc.getAttribute("score")
    oc_kind = ord_loc.getAttribute("kind")
    oc_sym = ""
    oc_id_out = ""
    oc_options = ""
    if (
        ord_loc.getAttribute("symmetrical")
        and
        not utils.is_cib_true(ord_loc.getAttribute("symmetrical"))
    ):
        oc_sym = "(non-symmetrical)"
    if oc_kind != "":
        score_text = "(kind:" + oc_kind + ")"
    elif oc_kind == "" and oc_score == "":
        score_text = "(kind:Mandatory)"
    else:
        score_text = "(score:" + oc_score + ")"
    if showDetail:
        oc_id_out = "(id:"+oc_id+")"
    already_processed_attrs = (
        "first", "then", "first-action", "then-action", "id", "score", "kind",
        "symmetrical"
    )
    oc_options = " ".join([
        "{0}={1}".format(name, value)
        for name, value in ord_loc.attributes.items()
        if name not in already_processed_attrs
    ])
    if oc_options:
        oc_options = "(Options: " + oc_options + ")"
    return " ".join([arg for arg in [
        first_action, oc_resource1, "then", then_action, oc_resource2,
        score_text, oc_sym, oc_options, oc_id_out
    ] if arg])
示例#4
0
文件: constraint.py 项目: tradej/pcs
def order_el_to_string(ord_loc, showDetail=False):
    oc_resource1 = ord_loc.getAttribute("first")
    oc_resource2 = ord_loc.getAttribute("then")
    first_action = ord_loc.getAttribute("first-action")
    then_action = ord_loc.getAttribute("then-action")
    oc_id = ord_loc.getAttribute("id")
    oc_score = ord_loc.getAttribute("score")
    oc_kind = ord_loc.getAttribute("kind")
    oc_sym = ""
    oc_id_out = ""
    oc_options = ""
    if (ord_loc.getAttribute("symmetrical")
            and not utils.is_cib_true(ord_loc.getAttribute("symmetrical"))):
        oc_sym = "(non-symmetrical)"
    if oc_kind != "":
        score_text = "(kind:" + oc_kind + ")"
    elif oc_kind == "" and oc_score == "":
        score_text = "(kind:Mandatory)"
    else:
        score_text = "(score:" + oc_score + ")"
    if showDetail:
        oc_id_out = "(id:" + oc_id + ")"
    already_processed_attrs = ("first", "then", "first-action", "then-action",
                               "id", "score", "kind", "symmetrical")
    oc_options = " ".join([
        "{0}={1}".format(name, value)
        for name, value in ord_loc.attributes.items()
        if name not in already_processed_attrs
    ])
    if oc_options:
        oc_options = "(Options: " + oc_options + ")"
    return " ".join([
        _f for _f in [
            first_action, oc_resource1, "then", then_action, oc_resource2,
            score_text, oc_sym, oc_options, oc_id_out
        ] if _f
    ])