Skip to content

Commit

Permalink
Minio admin healthcheck fix (#61)
Browse files Browse the repository at this point in the history
* minor fixes to admin health checks

Signed-off-by: Lillie Dae <[email protected]>
  • Loading branch information
lillie-dae authored Sep 1, 2022
1 parent 73c593e commit 5b37ce4
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/Plugins/MinIO/LoggerMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ namespace Monai.Deploy.Storage.MinIO
{
public static partial class LoggerMethods
{
[LoggerMessage(EventId = 20000, Level = LogLevel.Error, Message = "Error listing objects in bucket '{bucketName}'.")]
public static partial void ListObjectError(this ILogger logger, string bucketName);
[LoggerMessage(EventId = 20000, Level = LogLevel.Error, Message = "Error listing objects in bucket '{bucketName}' with error: {error}")]
public static partial void ListObjectError(this ILogger logger, string bucketName, string error);

[LoggerMessage(EventId = 20001, Level = LogLevel.Error, Message = "File '{path}' could not be found in '{bucketName}'.")]
public static partial void FileNotFoundError(this ILogger logger, string bucketName, string path);
Expand Down
2 changes: 1 addition & 1 deletion src/Plugins/MinIO/MinIoStorageService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ private async Task<IList<VirtualFileInfo>> ListObjectsUsingClient(MinioClient cl
},
error =>
{
_logger.ListObjectError(bucketName);
_logger.ListObjectError(bucketName, error.Message);
},
() => completedEvent.Set(), cancellationToken);

Expand Down
6 changes: 1 addition & 5 deletions src/Plugins/MinIO/StorageAdminService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -169,17 +169,13 @@ private Process CreateProcess(string cmd)
public async Task<bool> HasConnectionAsync()
{
var result = await GetConnectionAsync().ConfigureAwait(false);
return result.Any(r => r.Equals(_serviceName));
return result.Any(r => r.Trim().Equals(_serviceName));
}

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

public async Task<bool> SetConnectionAsync()
{
if (await HasConnectionAsync().ConfigureAwait(false))
{
return true;
}
var result = await ExecuteAsync(_set_connection_cmd).ConfigureAwait(false);
if (result.Any(r => r.Contains($"Added `{_serviceName}` successfully.")))
{
Expand Down
2 changes: 1 addition & 1 deletion src/Storage/IServiceCollectionExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public static IServiceCollection AddMonaiDeployStorageService(
this IServiceCollection services,
string fullyQualifiedTypeName,
IFileSystem fileSystem,
HealthCheckOptions healthCheckOptions = HealthCheckOptions.ServiceHealthCheck & HealthCheckOptions.AdminServiceHealthCheck,
HealthCheckOptions healthCheckOptions = HealthCheckOptions.ServiceHealthCheck | HealthCheckOptions.AdminServiceHealthCheck,
HealthStatus? failureStatus = null,
IEnumerable<string>? tags = null,
TimeSpan? timeout = null)
Expand Down

0 comments on commit 5b37ce4

Please sign in to comment.