Esempio n. 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"
                      }))
Esempio n. 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
         )
     )
Esempio n. 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))
Esempio n. 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))
Esempio n. 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
    ))
Esempio n. 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"})
     )