Changeset 2033
- Timestamp:
- 07/13/12 14:10:17 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
monitoring/plugins/mpi/check_clarin_saml.py
r2028 r2033 57 57 check_saml_metadata_file_path = os.path.join(CLARIN_server_root_directory_path, "aai/check-saml-metadata/check_saml_metadata.sh") 58 58 59 with tempfile.NamedTemporaryFile(mode = 'wb', 60 delete = False) as temporary_file : 61 temporary_file.write(data) 62 XML_response_metadata_file_path = temporary_file.name 59 temporary_file = tempfile.NamedTemporaryFile(mode = 'wb') 60 temporary_file.write(data) 61 temporary_file.flush() 62 63 XML_response_metadata_file_path = temporary_file.name 64 63 65 64 66 command = [check_saml_metadata_file_path, XML_response_metadata_file_path] 67 65 68 66 69 process = subprocess.Popen(command, … … 70 73 stdout, stderr = process.communicate() 71 74 75 temporary_file.close() 76 72 77 interpretation_tuple = (interpret_for_well_formedness(stdout), interpret_for_validity(stdout),) 73 78 74 os.unlink(XML_response_metadata_file_path)79 #os.unlink(XML_response_metadata_file_path) 75 80 76 81 return(interpretation_tuple) … … 78 83 79 84 def check_condition(host) : 85 80 86 UP_URL = '/aai/clarin-sp-metadata.xml' 81 87 … … 108 114 "message" : 'Host %s, service %s is up and returns well-formed, but invalid XML data.' % (host, DESCRIPTION) 109 115 } 116 else : 117 return { 118 "code" : "CRITICAL", 119 "message" : 'Host %s, service %s is up but returns non-well-formed XML data.' % (host, DESCRIPTION) 120 } 110 121 else : 111 122 return { … … 115 126 116 127 def test_case(host) : 117 withopen(os.path.join(CLARIN_server_root_directory_path, "aai/clarin-sp-metadata.xml"),128 metadata_file = open(os.path.join(CLARIN_server_root_directory_path, "aai/clarin-sp-metadata.xml"), 118 129 mode = "r+", 119 buffering = 0) as metadata_file :130 buffering = 0) 120 131 121 data = metadata_file.read() 132 data = metadata_file.read() 133 134 metadata_file.close() 122 135 123 136 interpretation_tuple = check_response_data_validity(data)
Note: See TracChangeset
for help on using the changeset viewer.