예제 #1
0
파일: messages.py 프로젝트: kmalyjur/pcs
def _resource_move_ban_clear_master_resource_not_promotable(
    promotable_id: str,
) -> str:
    return (
        "when specifying --promoted you must use the promotable clone id{_id}"
    ).format(
        _id=format_optional(promotable_id, " ({})"),
    )
예제 #2
0
파일: messages.py 프로젝트: kmalyjur/pcs
 def message(self) -> str:
     cmd = (
         {const.PCS_COMMAND_STONITH_CREATE: "pcs stonith create"}.get(
             self._obj.command_to_use_instead
         )
         if self._obj.command_to_use_instead
         else None
     )
     additional_msg = format_optional(cmd, " Use '{}' command instead.")
     return f"{self._obj.message}{additional_msg}"
예제 #3
0
파일: nvset.py 프로젝트: CtrlZmaster/pcs
def nvset_dto_to_lines(nvset: CibNvsetDto,
                       nvset_label: str = "Options Set",
                       with_ids: bool = False) -> List[str]:
    in_effect_label = get_in_effect_label(nvset.rule) if nvset.rule else None
    heading_parts = [
        "{label}{in_effect}:{id}".format(
            label=nvset_label,
            in_effect=format_optional(in_effect_label, " ({})"),
            id=format_optional(nvset.id, " {}"),
        )
    ]
    if nvset.options:
        heading_parts.append(" ".join(
            format_name_value_list(sorted(nvset.options.items()))))

    lines = format_name_value_list(
        sorted([(nvpair.name, nvpair.value) for nvpair in nvset.nvpairs]))
    if nvset.rule:
        lines.extend(
            rule_expression_dto_to_lines(nvset.rule, with_ids=with_ids))

    return [" ".join(heading_parts)] + indent(lines)