diff --git a/protos/PublicDefs.proto b/protos/PublicDefs.proto index 216e6fb9..8f5647f3 100644 --- a/protos/PublicDefs.proto +++ b/protos/PublicDefs.proto @@ -415,8 +415,8 @@ enum ErrCode { ERR_MAX_JOB_COUNT_PER_USER = 65; ERR_USER_NO_PRIVILEGE = 66; - ERR_ALLOWEDLIST_MISSING = 67; // The current account is not in the allowed account list for the partition. - ERR_DENYLIST_HIT = 68; // The current account has been explicitly added to the deny list for the partition. + ERR_NOT_IN_ALLOWED_LIST = 67; // The current account is not in the allowed account list for the partition. + ERR_IN_DENIED_LIST = 68; // The current account has been explicitly added to the deny list for the partition. } enum EntityType { diff --git a/src/CraneCtld/CraneCtld.cpp b/src/CraneCtld/CraneCtld.cpp index c13c48e8..d66b77e5 100644 --- a/src/CraneCtld/CraneCtld.cpp +++ b/src/CraneCtld/CraneCtld.cpp @@ -470,17 +470,17 @@ void ParseConfig(int argc, char** argv) { auto allowed_accounts_str = partition["AllowedAccounts"].as(); std::vector allowed_accounts = - absl::StrSplit(absl::StripAsciiWhitespace(allowed_accounts_str).data(), ","); + absl::StrSplit(allowed_accounts_str.data(), ","); for (const auto& account_name : allowed_accounts) { - part.allowed_accounts.insert(account_name); + part.allowed_accounts.insert(absl::StripAsciiWhitespace(account_name).data()); } } if (partition["DeniedAccounts"] && !partition["DeniedAccounts"].IsNull()) { auto denied_accounts_str = partition["DeniedAccounts"].as(); - std::vector denied_accounts = absl::StrSplit(absl::StripAsciiWhitespace(denied_accounts_str).data(), ","); + std::vector denied_accounts = absl::StrSplit(denied_accounts_str, ","); for (const auto& account_name : denied_accounts) { - part.denied_accounts.insert(account_name); + part.denied_accounts.insert(absl::StripAsciiWhitespace(account_name).data()); } } diff --git a/src/CraneCtld/CranedMetaContainer.cpp b/src/CraneCtld/CranedMetaContainer.cpp index fda0eda6..11ea86ec 100644 --- a/src/CraneCtld/CranedMetaContainer.cpp +++ b/src/CraneCtld/CranedMetaContainer.cpp @@ -648,7 +648,7 @@ CraneExpected CranedMetaContainer::CheckIfAccountIsAllowedInPartition( "The account {} is not in the AllowedAccounts of the partition {}" "specified for the task, submission of the task is prohibited.", account_name, partition_name); - return std::unexpected(CraneErrCode::ERR_ALLOWEDLIST_MISSING); + return std::unexpected(CraneErrCode::ERR_NOT_IN_ALLOWED_LIST); } } else if (!denied_accounts.empty()) { if (denied_accounts.contains(account_name)) { @@ -656,7 +656,7 @@ CraneExpected CranedMetaContainer::CheckIfAccountIsAllowedInPartition( "The account {} is in the DeniedAccounts of the partition {}" "specified for the task, submission of the task is prohibited.", account_name, partition_name); - return std::unexpected(CraneErrCode::ERR_DENYLIST_HIT); + return std::unexpected(CraneErrCode::ERR_IN_DENIED_LIST); } }