Commit 85694b4f authored by Volodymyr Yurchenko's avatar Volodymyr Yurchenko
Browse files

Check if there is default mount rule

This commit adds a check for a requester mount policy with the hardcoded
name "default". Requester mount rule with this name must be present on
eoscta instance to pass this check
parent 817da140
...@@ -40,6 +40,8 @@ ...@@ -40,6 +40,8 @@
#include <ctype.h> #include <ctype.h>
#include <memory> #include <memory>
#include <time.h> #include <time.h>
#include <sys/types.h>
#include <grp.h>
namespace cta { namespace cta {
namespace catalogue { namespace catalogue {
...@@ -7311,11 +7313,16 @@ uint64_t RdbmsCatalogue::checkAndGetNextArchiveFileId(const std::string &diskIns ...@@ -7311,11 +7313,16 @@ uint64_t RdbmsCatalogue::checkAndGetNextArchiveFileId(const std::string &diskIns
const auto groupMountPolicy = getCachedRequesterGroupMountPolicy(Group(diskInstanceName, user.group)); const auto groupMountPolicy = getCachedRequesterGroupMountPolicy(Group(diskInstanceName, user.group));
if(!groupMountPolicy) { if(!groupMountPolicy) {
exception::UserError ue;
ue.getMessage() << "No mount rules for the requester or their group:" const auto defaultMountPolicy = getCachedRequesterMountPolicy(User(diskInstanceName, "default"));
" storageClass=" << storageClassName << " requester=" << diskInstanceName << ":" << user.name << ":" <<
user.group; if(!defaultMountPolicy) {
throw ue; exception::UserError ue;
ue.getMessage() << "No mount rules for the requester or their group:"
" storageClass=" << storageClassName << " requester=" << diskInstanceName << ":" << user.name << ":" <<
user.group;
throw ue;
}
} }
} }
...@@ -7364,10 +7371,14 @@ common::dataStructures::ArchiveFileQueueCriteria RdbmsCatalogue::getArchiveFileQ ...@@ -7364,10 +7371,14 @@ common::dataStructures::ArchiveFileQueueCriteria RdbmsCatalogue::getArchiveFileQ
mountPolicy = getCachedRequesterGroupMountPolicy(Group(diskInstanceName, user.group)); mountPolicy = getCachedRequesterGroupMountPolicy(Group(diskInstanceName, user.group));
if(!mountPolicy) { if(!mountPolicy) {
exception::UserError ue; mountPolicy = getCachedRequesterMountPolicy(User(diskInstanceName, "default"));
ue.getMessage() << "No mount rules for the requester or their group: storageClass=" << storageClassName <<
" requester=" << diskInstanceName << ":" << user.name << ":" << user.group; if(!mountPolicy) {
throw ue; exception::UserError ue;
ue.getMessage() << "No mount rules for the requester or their group: storageClass=" << storageClassName <<
" requester=" << diskInstanceName << ":" << user.name << ":" << user.group;
throw ue;
}
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment