Changeset View
Changeset View
Standalone View
Standalone View
swh/icinga_plugins/vault.py
Show First 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | def _pick_uncached_directory(self): | ||||
return dir_id | return dir_id | ||||
def main(self): | def main(self): | ||||
try: | try: | ||||
dir_id = self._pick_uncached_directory() | dir_id = self._pick_uncached_directory() | ||||
except NoDirectory: | except NoDirectory: | ||||
self.print_result( | self.print_result( | ||||
'CRITICAL', | 'CRITICAL', | ||||
'No directory exists in the archive') | 'No directory exists in the archive.') | ||||
return 2 | return 2 | ||||
start_time = time.time() | start_time = time.time() | ||||
total_time = 0 | total_time = 0 | ||||
response = requests.post(self._url_for_dir(dir_id)) | response = requests.post(self._url_for_dir(dir_id)) | ||||
assert response.status_code == 200, (response, response.text) | assert response.status_code == 200, (response, response.text) | ||||
result = response.json() | result = response.json() | ||||
while result['status'] in ('new', 'pending'): | while result['status'] in ('new', 'pending'): | ||||
Show All 38 Lines |