コード例 #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
ファイル: test_console_report.py プロジェクト: dchirikov/pcs
 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
ファイル: console_report.py プロジェクト: HideoYamauchi/pcs
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
ファイル: test_console_report.py プロジェクト: dchirikov/pcs
 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"})
     )