Skip to content

Commit 5b37ce4

Browse files
authored
Minio admin healthcheck fix (#61)
* minor fixes to admin health checks Signed-off-by: Lillie Dae <[email protected]>
1 parent 73c593e commit 5b37ce4

File tree

4 files changed

+5
-9
lines changed

4 files changed

+5
-9
lines changed

src/Plugins/MinIO/LoggerMethods.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ namespace Monai.Deploy.Storage.MinIO
2020
{
2121
public static partial class LoggerMethods
2222
{
23-
[LoggerMessage(EventId = 20000, Level = LogLevel.Error, Message = "Error listing objects in bucket '{bucketName}'.")]
24-
public static partial void ListObjectError(this ILogger logger, string bucketName);
23+
[LoggerMessage(EventId = 20000, Level = LogLevel.Error, Message = "Error listing objects in bucket '{bucketName}' with error: {error}")]
24+
public static partial void ListObjectError(this ILogger logger, string bucketName, string error);
2525

2626
[LoggerMessage(EventId = 20001, Level = LogLevel.Error, Message = "File '{path}' could not be found in '{bucketName}'.")]
2727
public static partial void FileNotFoundError(this ILogger logger, string bucketName, string path);

src/Plugins/MinIO/MinIoStorageService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ private async Task<IList<VirtualFileInfo>> ListObjectsUsingClient(MinioClient cl
339339
},
340340
error =>
341341
{
342-
_logger.ListObjectError(bucketName);
342+
_logger.ListObjectError(bucketName, error.Message);
343343
},
344344
() => completedEvent.Set(), cancellationToken);
345345

src/Plugins/MinIO/StorageAdminService.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -169,17 +169,13 @@ private Process CreateProcess(string cmd)
169169
public async Task<bool> HasConnectionAsync()
170170
{
171171
var result = await GetConnectionAsync().ConfigureAwait(false);
172-
return result.Any(r => r.Equals(_serviceName));
172+
return result.Any(r => r.Trim().Equals(_serviceName));
173173
}
174174

175175
public async Task<List<string>> GetConnectionAsync() => await ExecuteAsync(_get_connections_cmd).ConfigureAwait(false);
176176

177177
public async Task<bool> SetConnectionAsync()
178178
{
179-
if (await HasConnectionAsync().ConfigureAwait(false))
180-
{
181-
return true;
182-
}
183179
var result = await ExecuteAsync(_set_connection_cmd).ConfigureAwait(false);
184180
if (result.Any(r => r.Contains($"Added `{_serviceName}` successfully.")))
185181
{

src/Storage/IServiceCollectionExtension.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public static IServiceCollection AddMonaiDeployStorageService(
6262
this IServiceCollection services,
6363
string fullyQualifiedTypeName,
6464
IFileSystem fileSystem,
65-
HealthCheckOptions healthCheckOptions = HealthCheckOptions.ServiceHealthCheck & HealthCheckOptions.AdminServiceHealthCheck,
65+
HealthCheckOptions healthCheckOptions = HealthCheckOptions.ServiceHealthCheck | HealthCheckOptions.AdminServiceHealthCheck,
6666
HealthStatus? failureStatus = null,
6767
IEnumerable<string>? tags = null,
6868
TimeSpan? timeout = null)

0 commit comments

Comments
 (0)