예제 #1
0
파일: alert.py 프로젝트: idevat/pcs
def remove_recipient(lib_env, recipient_id):
    """
    Remove existing recipient.

    lib_env -- LibraryEnvironment
    recipient_id -- if of recipient to be removed
    """
    cib = lib_env.get_cib(REQUIRED_CIB_VERSION)
    alert.remove_recipient(cib, recipient_id)
    lib_env.push_cib(cib)
예제 #2
0
파일: alert.py 프로젝트: jmartign/pcs
def remove_recipient(lib_env, recipient_id):
    """
    Remove existing recipient.

    lib_env -- LibraryEnvironment
    recipient_id -- if of recipient to be removed
    """
    cib = lib_env.get_cib(REQUIRED_CIB_VERSION)
    alert.remove_recipient(cib, recipient_id)
    lib_env.push_cib(cib)
예제 #3
0
 def test_success(self):
     alert.remove_recipient(self.tree, "alert-recipient-2")
     assert_xml_equal(
         """
         <cib>
             <configuration>
                 <alerts>
                     <alert id="alert" path="/path">
                         <recipient id="alert-recipient" value="test_val"/>
                     </alert>
                 </alerts>
             </configuration>
         </cib>
         """,
         etree.tostring(self.tree).decode())
예제 #4
0
파일: alert.py 프로젝트: junaruga/pcs
def remove_recipient(lib_env, recipient_id_list):
    """
    Remove specified recipients.

    lib_env -- LibraryEnvironment
    recipient_id_list -- list of recipients ids to be removed
    """
    cib = lib_env.get_cib(REQUIRED_CIB_VERSION)
    report_list = []
    for recipient_id in recipient_id_list:
        try:
            alert.remove_recipient(cib, recipient_id)
        except LibraryError as e:
            report_list += e.args
    lib_env.report_processor.process_list(report_list)
    lib_env.push_cib()
예제 #5
0
 def test_recipient_not_exists(self):
     assert_raise_library_error(
         lambda: alert.remove_recipient(self.tree, "recipient"),
         (severities.ERROR, report_codes.ID_NOT_FOUND, {
             "id": "recipient",
             "id_description": "Recipient"
         }))
예제 #6
0
 def test_success(self):
     alert.remove_recipient(self.tree, "alert-recipient-2")
     assert_xml_equal(
         """
         <cib>
             <configuration>
                 <alerts>
                     <alert id="alert" path="/path">
                         <recipient id="alert-recipient" value="test_val"/>
                     </alert>
                 </alerts>
             </configuration>
         </cib>
         """,
         etree.tostring(self.tree).decode()
     )
예제 #7
0
파일: alert.py 프로젝트: HideoYamauchi/pcs
def remove_recipient(lib_env, recipient_id_list):
    """
    Remove specified recipients.

    lib_env -- LibraryEnvironment
    recipient_id_list -- list of recipients ids to be removed
    """
    cib = lib_env.get_cib(REQUIRED_CIB_VERSION)
    report_list = []
    for recipient_id in recipient_id_list:
        try:
            alert.remove_recipient(cib, recipient_id)
        except LibraryError as e:
            report_list += e.args
    lib_env.report_processor.process_list(report_list)
    lib_env.push_cib(cib)
예제 #8
0
파일: alert.py 프로젝트: vvidic/pcs
def remove_recipient(lib_env: LibraryEnvironment, recipient_id_list):
    """
    Remove specified recipients.

    lib_env -- LibraryEnvironment
    recipient_id_list -- list of recipients ids to be removed
    """
    cib = lib_env.get_cib()
    report_list: ReportItemList = []
    for recipient_id in recipient_id_list:
        try:
            alert.remove_recipient(cib, recipient_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()
예제 #9
0
 def test_recipient_not_exists(self):
     assert_raise_library_error(
         lambda: alert.remove_recipient(self.tree, "recipient"),
         (severities.ERROR, report_codes.ID_NOT_FOUND, {
             "id": "recipient",
             "expected_types": ["recipient"],
             "context_type": "alerts",
             "context_id": "",
         }, None))
예제 #10
0
파일: test_alert.py 프로젝트: dchirikov/pcs
 def test_recipient_not_exists(self):
     assert_raise_library_error(
         lambda: alert.remove_recipient(self.tree, "recipient"),
         (
             severities.ERROR,
             report_codes.ID_NOT_FOUND,
             {
                 "id": "recipient",
                 "id_description": "Recipient"
             }
         )
     )
예제 #11
0
 def test_recipient_not_exists(self):
     assert_raise_library_error(
         lambda: alert.remove_recipient(self.tree, "recipient"),
         (
             severities.ERROR,
             report_codes.ID_NOT_FOUND,
             {
                 "id": "recipient",
                 "expected_types": ["recipient"],
                 "context_type": "alerts",
                 "context_id": "",
             },
             None
         )
     )