Skip to content

Commit

Permalink
squash. WIP - rule base files are now absolute. ISSUE: we dont know a…
Browse files Browse the repository at this point in the history
…bout errors with NREP until an API endpoint is invoked.
  • Loading branch information
korydraughn committed Oct 6, 2024
1 parent 6f09b86 commit 5d4d3fa
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
16 changes: 13 additions & 3 deletions plugins/rule_engines/irods_rule_language/src/configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,8 @@ std::string get_rule_base_path( const std::string &irb) {
}

std::string get_rule_base_path_copy( const std::string &irb, const int pid) {
return get_rule_base_path(irb) + "." + std::to_string(pid);
//return get_rule_base_path(irb) + "." + std::to_string(pid);
return irb + "." + std::to_string(pid);
}

std::vector<std::string> parse_irbSet(const std::string &irbSet) {
Expand Down Expand Up @@ -431,9 +432,11 @@ class in_memory_rulebases
explicit in_memory_rulebases(const std::vector<std::string>& _irods_rule_bases)
{
for (auto const& irb : _irods_rule_bases) {
std::ifstream ifs(get_rule_base_path(irb));
//std::ifstream ifs(get_rule_base_path(irb));
std::ifstream ifs(irb);
if (!ifs) {
log_re::error("in_memory_rulebases: input file stream [{}] failed", get_rule_base_path(irb));
//log_re::error("in_memory_rulebases: input file stream [{}] failed", get_rule_base_path(irb));
log_re::error("in_memory_rulebases: input file stream [{}] failed", irb);
// NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-array-to-pointer-decay)
THROW(RULES_FILE_READ_ERROR, fmt::format("Failed to load rulebase [{}] into memory", irb));
}
Expand Down Expand Up @@ -542,8 +545,15 @@ int loadRuleFromCacheOrFile( const char* inst_name, const char *irbSet ) {
time_type timestamp = time_type_initializer;
for (auto const& irb : irbs) {
time_type mtim;
// TODO This is where the short name for core.re and friends is converted to a absolute path.
// Soooo, this just goes away because the config will already have the absolute paths.
// The time_type_gt will be the only thing left in this loop.
#if 0
auto fn = get_rule_base_path( irb );
if ( ( res = getModifiedTime( fn.c_str(), &mtim ) ) != 0 ) {
#else
if ( ( res = getModifiedTime( irb.c_str(), &mtim ) ) != 0 ) {
#endif
return res;
}

Expand Down
6 changes: 5 additions & 1 deletion plugins/rule_engines/irods_rule_language/src/filesystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@
#include "irods/rodsConnect.h"

char *getRuleBasePath(const char *ruleBaseName, char rulesFileName[MAX_NAME_LEN] ) {
std::string cfg_file, fn( ruleBaseName );
std::string cfg_file;
std::string fn( ruleBaseName );
fn += ".re";
// This is how the NREP locates core.re and other ".re" files.
// TODO This isn't necessary anymore because the NREP will take absolute paths.
// On an upgrade to v5, we cannot assume /etc/irods because of non-pkg installs.
irods::error ret = irods::get_full_path_for_config_file( fn, cfg_file );
if ( !ret.ok() ) {
irods::log( PASS( ret ) );
Expand Down

0 comments on commit 5d4d3fa

Please sign in to comment.