コード例 #1
0
ファイル: alert.py プロジェクト: idevat/pcs
def remove_alert(lib_env, alert_id):
    """
    Remove alert with specified id.

    lib_env -- LibraryEnvironment
    alert_id -- id of alert which should be removed
    """
    cib = lib_env.get_cib(REQUIRED_CIB_VERSION)
    alert.remove_alert(cib, alert_id)
    lib_env.push_cib(cib)
コード例 #2
0
ファイル: alert.py プロジェクト: jmartign/pcs
def remove_alert(lib_env, alert_id):
    """
    Remove alert with specified id.

    lib_env -- LibraryEnvironment
    alert_id -- id of alert which should be removed
    """
    cib = lib_env.get_cib(REQUIRED_CIB_VERSION)
    alert.remove_alert(cib, alert_id)
    lib_env.push_cib(cib)
コード例 #3
0
 def test_success(self):
     alert.remove_alert(self.tree, "alert")
     assert_xml_equal(
         """
         <cib>
             <configuration>
                 <alerts>
                     <alert id="alert-1" path="/next"/>
                 </alerts>
             </configuration>
         </cib>
         """,
         etree.tostring(self.tree).decode())
コード例 #4
0
ファイル: test_alert.py プロジェクト: tomjelinek/pcs
 def test_success(self):
     alert.remove_alert(self.tree, "alert")
     assert_xml_equal(
         """
         <cib>
             <configuration>
                 <alerts>
                     <alert id="alert-1" path="/next"/>
                 </alerts>
             </configuration>
         </cib>
         """,
         etree.tostring(self.tree).decode()
     )
コード例 #5
0
ファイル: alert.py プロジェクト: rriifftt/pcs
def remove_alert(lib_env, alert_id_list):
    """
    Remove alerts with specified ids.

    lib_env -- LibraryEnvironment
    alert_id_list -- list of alerts ids which should be removed
    """
    cib = lib_env.get_cib(REQUIRED_CIB_VERSION)
    report_list = []
    for alert_id in alert_id_list:
        try:
            alert.remove_alert(cib, alert_id)
        except LibraryError as e:
            report_list += e.args
    lib_env.report_processor.process_list(report_list)
    lib_env.push_cib(cib)
コード例 #6
0
def remove_alert(lib_env, alert_id_list):
    """
    Remove alerts with specified ids.

    lib_env -- LibraryEnvironment
    alert_id_list -- list of alerts ids which should be removed
    """
    cib = lib_env.get_cib(REQUIRED_CIB_VERSION)
    report_list = []
    for alert_id in alert_id_list:
        try:
            alert.remove_alert(cib, alert_id)
        except LibraryError as e:
            report_list += e.args
    lib_env.report_processor.process_list(report_list)
    lib_env.push_cib(cib)
コード例 #7
0
ファイル: test_alert.py プロジェクト: cwjenkins/pcs
 def test_not_existing_id(self):
     assert_raise_library_error(
         lambda: alert.remove_alert(self.tree, "not-existing-id"),
         (severities.ERROR, report_codes.ID_NOT_FOUND, {
             "id": "not-existing-id",
             "context_type": "alerts",
             "context_id": "",
             "id_description": "alert"
         }))
コード例 #8
0
 def test_not_existing_id(self):
     assert_raise_library_error(
         lambda: alert.remove_alert(self.tree, "not-existing-id"),
         (severities.ERROR, report_codes.ID_NOT_FOUND, {
             "id": "not-existing-id",
             "expected_types": ["alert"],
             "context_type": "alerts",
             "context_id": "",
         }, None))
コード例 #9
0
ファイル: test_alert.py プロジェクト: dchirikov/pcs
 def test_not_existing_id(self):
     assert_raise_library_error(
         lambda: alert.remove_alert(self.tree, "not-existing-id"),
         (
             severities.ERROR,
             report_codes.CIB_ALERT_NOT_FOUND,
             {"alert": "not-existing-id"}
         )
     )
コード例 #10
0
ファイル: alert.py プロジェクト: vvidic/pcs
def remove_alert(lib_env: LibraryEnvironment, alert_id_list):
    """
    Remove alerts with specified ids.

    lib_env -- LibraryEnvironment
    alert_id_list -- list of alerts ids which should be removed
    """
    cib = lib_env.get_cib()
    report_list: ReportItemList = []
    for alert_id in alert_id_list:
        try:
            alert.remove_alert(cib, alert_id)
        except LibraryError as e:
            report_list += e.args

    if lib_env.report_processor.report_list(report_list).has_errors:
        raise LibraryError()
    lib_env.push_cib()
コード例 #11
0
ファイル: test_alert.py プロジェクト: HideoYamauchi/pcs
 def test_not_existing_id(self):
     assert_raise_library_error(
         lambda: alert.remove_alert(self.tree, "not-existing-id"),
         (
             severities.ERROR,
             report_codes.ID_NOT_FOUND,
             {
                 "id": "not-existing-id",
                 "context_type": "alerts",
                 "context_id": "",
                 "id_description": "alert"
             }
         )
     )
コード例 #12
0
ファイル: test_alert.py プロジェクト: tomjelinek/pcs
 def test_not_existing_id(self):
     assert_raise_library_error(
         lambda: alert.remove_alert(self.tree, "not-existing-id"),
         (
             severities.ERROR,
             report_codes.ID_NOT_FOUND,
             {
                 "id": "not-existing-id",
                 "expected_types": ["alert"],
                 "context_type": "alerts",
                 "context_id": "",
             },
             None
         )
     )
コード例 #13
0
 def test_not_existing_id(self):
     assert_raise_library_error(
         lambda: alert.remove_alert(self.tree, "not-existing-id"),
         (severities.ERROR, report_codes.CIB_ALERT_NOT_FOUND, {
             "alert": "not-existing-id"
         }))