fix #2352 create bucket
This commit is contained in:
parent
c3b1035eaf
commit
d1c8c55930
1 changed files with 14 additions and 0 deletions
|
@ -45,6 +45,7 @@ import org.lastaflute.web.servlet.request.stream.WrittenStreamOut;
|
|||
|
||||
import io.minio.MinioClient;
|
||||
import io.minio.Result;
|
||||
import io.minio.errors.ErrorResponseException;
|
||||
import io.minio.messages.Item;
|
||||
|
||||
/**
|
||||
|
@ -216,6 +217,19 @@ public class AdminStorageAction extends FessAdminAction {
|
|||
break;
|
||||
}
|
||||
}
|
||||
} catch (final ErrorResponseException e) {
|
||||
final String code = e.errorResponse().code();
|
||||
if ("NoSuchBucket".equals(code)) {
|
||||
final MinioClient minioClient = createClient(fessConfig);
|
||||
try {
|
||||
minioClient.makeBucket(fessConfig.getStorageBucket());
|
||||
logger.info("Created bucket: {}", fessConfig.getStorageBucket());
|
||||
} catch (Exception e1) {
|
||||
logger.warn("Failed to create bucket:" + fessConfig.getStorageBucket(), e1);
|
||||
}
|
||||
} else if (logger.isDebugEnabled()) {
|
||||
logger.debug("Failed to access " + fessConfig.getStorageEndpoint(), e);
|
||||
}
|
||||
} catch (final Exception e) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Failed to access " + fessConfig.getStorageEndpoint(), e);
|
||||
|
|
Loading…
Add table
Reference in a new issue