forked from DavidBerg-MSFT/G-object-storage
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun-cleanup.php
More file actions
executable file
·36 lines (34 loc) · 1.57 KB
/
Copy pathrun-cleanup.php
File metadata and controls
executable file
·36 lines (34 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/php -q
<?php
/**
* this script removes the test container, objects and/or files if needed
* following testing. It utilizes the following exit status codes:
* 0 Initialization successful
* 1 Unable to initialize storage controller
* 2 Unable to cleanup test objects
* 3 Unable to cleanup container
*/
require_once(dirname(__FILE__) . '/api/ObjectStorageController.php');
$status = 0;
ObjectStorageController::log(sprintf('Initializing for test run %d', getenv('bm_run_id')), 'run-cleanup.php', __LINE__);
if ($controller =& ObjectStorageController::getInstance()) {
ObjectStorageController::log(sprintf('%s storage controller initialized successfully. Cleaning up objects/files', $controller->getApi()), 'run-cleanup.php', __LINE__);
if ($controller->cleanupObjects()) {
ObjectStorageController::log(sprintf('Objects/files cleaned up succcessfully'), 'run-cleanup.php', __LINE__);
if ($controller->cleanupContainer()) ObjectStorageController::log(sprintf('Container %s cleaned up successfully', $controller->getContainer()), 'run-cleanup.php', __LINE__);
else {
$status = 3;
ObjectStorageController::log(sprintf('Unable to clean up container %s', $controller->getContainer()), 'run-cleanup.php', __LINE__, TRUE);
}
}
else {
$status = 2;
ObjectStorageController::log(sprintf('Unable to cleanup objects'), 'run-cleanup.php', __LINE__, TRUE);
}
}
else {
$status = 1;
ObjectStorageController::log(sprintf('Unable to get instance of %s storage controller', getenv('bm_param_api')), 'run-cleanup.php', __LINE__, TRUE);
}
exit($status);
?>