Skip to content

Commit 3eec299

Browse files
authored
Merge pull request #9006 from romayalon/romy-nc-lifecycle-gpfs-fixes
NC | lifecycle | Small GPFS flow fixes
2 parents 043d40c + d591e41 commit 3eec299

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/manage_nsfs/nc_lifecycle.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1236,7 +1236,7 @@ class NCLifecycle {
12361236
const { bucket_rule_id, in_bucket_path, in_bucket_internal_dir } = ilm_policy_helpers;
12371237
const mod_age_definition = `define( mod_age, (DAYS(CURRENT_TIMESTAMP) - DAYS(MODIFICATION_TIME)) )\n`;
12381238
const change_age_definition = `define( change_age, (DAYS(CURRENT_TIMESTAMP) - DAYS(CHANGE_TIME)) )\n`;
1239-
const rule_id_definition = `RULE ${bucket_rule_id} LIST ${bucket_rule_id}\n`;
1239+
const rule_id_definition = `RULE '${bucket_rule_id}' LIST '${bucket_rule_id}'\n`;
12401240
const policy_path_base = `WHERE PATH_NAME LIKE '${in_bucket_path}'\n` +
12411241
`AND PATH_NAME NOT LIKE '${in_bucket_internal_dir}'\n`;
12421242

@@ -1285,8 +1285,8 @@ class NCLifecycle {
12851285
const { object_size_greater_than = undefined, object_size_less_than = undefined, tags = undefined } = filter;
12861286
const rule_prefix = prefix || filter.prefix;
12871287
filter_policy += rule_prefix ? `AND PATH_NAME LIKE '${path.join(bucket_path, rule_prefix)}%'\n` : '';
1288-
filter_policy += object_size_greater_than ? `AND FILE_SIZE > ${object_size_greater_than}\n` : '';
1289-
filter_policy += object_size_less_than ? `AND FILE_SIZE < ${object_size_less_than}\n` : '';
1288+
filter_policy += object_size_greater_than === undefined ? '' : `AND FILE_SIZE > ${object_size_greater_than}\n`;
1289+
filter_policy += object_size_less_than === undefined ? '' : `AND FILE_SIZE < ${object_size_less_than}\n`;
12901290
filter_policy += tags ? tags.map(tag => `AND XATTR('user.noobaa.tag.${tag.key}') LIKE ${tag.value}\n`).join('') : '';
12911291
}
12921292
return filter_policy;
@@ -1434,7 +1434,7 @@ class NCLifecycle {
14341434
if (err.code === 'ENOENT') {
14351435
dbg.log2(`parse_candidates_from_gpfs_ilm_policy ilm_candidates_file_exists does not exist, no candidates to delete`);
14361436
this._set_rule_state(bucket_json, lifecycle_rule, finished_state);
1437-
return;
1437+
return [];
14381438
}
14391439
dbg.error('parse_candidates_from_gpfs_ilm_policy: error', err);
14401440
throw err;

src/test/unit_tests/jest_tests/test_nc_lifecycle_gpfs_ilm_integration.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ function get_mock_base_ilm_policy(bucket_storage_path, rule_id, lifecycle_run_st
477477
`define( change_age, (DAYS(CURRENT_TIMESTAMP) - DAYS(CHANGE_TIME)) )\n`;
478478

479479
const policy_rule_id = `${bucket_name}_${rule_id}_${lifecycle_run_status.lifecycle_run_times.run_lifecycle_start_time}`;
480-
const policy_base = `RULE ${policy_rule_id} LIST ${policy_rule_id}\n` +
480+
const policy_base = `RULE '${policy_rule_id}' LIST '${policy_rule_id}'\n` +
481481
`WHERE PATH_NAME LIKE '${bucket_storage_path}/%'\n` +
482482
`AND PATH_NAME NOT LIKE '${bucket_storage_path}/.noobaa_nsfs%/%'\n`;
483483

0 commit comments

Comments
 (0)