コード例 #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
ファイル: constraint.py プロジェクト: akanouras/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([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
    ])