示例#1
0
 def test_prepare_options_with_id(self):
     self.assertEqual(["a=b", "c=d", '(id:some_id)'],
                      console_report.prepare_options({
                          "c": "d",
                          "a": "b",
                          "id": "some_id"
                      }))
示例#2
0
 def test_prepare_options_without_id(self):
     self.assertEqual(
         ["a=b", "c=d"],
         console_report.prepare_options(
             {"c": "d", "a": "b", "id":"some_id"},
             with_id=False
         )
     )
示例#3
0
 def test_prepare_options_without_id(self):
     self.assertEqual(["a=b", "c=d"],
                      console_report.prepare_options(
                          {
                              "c": "d",
                              "a": "b",
                              "id": "some_id"
                          },
                          with_id=False))
示例#4
0
def constraint_plain(constraint_info, with_id=False):
    """
    dict constraint_info  see constraint in pcs/lib/exchange_formats.md
    bool with_id have to show id with options_dict
    """
    options = constraint_info["options"]
    role = options.get("rsc-role", "")
    role_prefix = "{0} ".format(role) if role else ""

    return role_prefix + " ".join([options.get("rsc", "")] + prepare_options(
        dict((name, value) for name, value in options.items()
             if name not in ["rsc-role", "rsc"]), with_id))
示例#5
0
def constraint_plain(constraint_info, with_id=False):
    """
    dict constraint_info  see constraint in pcs/lib/exchange_formats.md
    bool with_id have to show id with options_dict
    """
    options = constraint_info["options"]
    role = options.get("rsc-role", "")
    role_prefix = "{0} ".format(role) if role else ""

    return role_prefix + " ".join([options.get("rsc", "")] + prepare_options(
        dict(
            (name, value) for name, value in options.items()
            if name not in ["rsc-role", "rsc"]
        ),
        with_id
    ))
示例#6
0
 def test_prepare_options_with_id(self):
     self.assertEqual(
         ["a=b", "c=d", '(id:some_id)'],
         console_report.prepare_options({"c": "d", "a": "b", "id":"some_id"})
     )