Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NSFS | NC | Manage NSFS | Remove wide Property from Fetch Data #7907

Merged
merged 1 commit into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/cmd/manage_nsfs.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ async function fetch_bucket_data(action, user_input) {
owner_account: undefined,
system_owner: user_input.owner, // GAP - needs to be the system_owner (currently it is the account name)
bucket_owner: user_input.owner,
wide: _.isUndefined(user_input.wide) ? undefined : get_boolean_or_string_value(user_input.wide),
tag: undefined, // if we would add the option to tag a bucket using CLI, this should be changed
versioning: action === ACTIONS.ADD ? 'DISABLED' : undefined,
creation_date: action === ACTIONS.ADD ? new Date().toISOString() : undefined,
Expand Down Expand Up @@ -321,7 +320,8 @@ async function manage_bucket_operations(action, data, user_input) {
await delete_bucket(data);
} else if (action === ACTIONS.LIST) {
const bucket_filters = _.pick(user_input, LIST_BUCKET_FILTERS);
const buckets = await list_config_files(TYPES.BUCKET, buckets_dir_path, data.wide, undefined, bucket_filters);
const wide = get_boolean_or_string_value(user_input.wide);
const buckets = await list_config_files(TYPES.BUCKET, buckets_dir_path, wide, undefined, bucket_filters);
write_stdout_response(ManageCLIResponse.BucketList, buckets);
} else {
// we should not get here (we check it before)
Expand Down Expand Up @@ -365,7 +365,6 @@ async function fetch_account_data(action, user_input) {
name: _.isUndefined(user_input.name) ? undefined : String(user_input.name),
email: _.isUndefined(user_input.name) ? undefined : String(user_input.name), // temp, keep the email internally
creation_date: action === ACTIONS.ADD ? new Date().toISOString() : undefined,
wide: _.isUndefined(user_input.wide) ? undefined : get_boolean_or_string_value(user_input.wide),
new_name: _.isUndefined(user_input.new_name) ? undefined : String(user_input.new_name),
new_access_key,
access_keys,
Expand Down Expand Up @@ -572,7 +571,8 @@ async function manage_account_operations(action, data, show_secrets, user_input)
await delete_account(data);
} else if (action === ACTIONS.LIST) {
const account_filters = _.pick(user_input, LIST_ACCOUNT_FILTERS);
const accounts = await list_config_files(TYPES.ACCOUNT, accounts_dir_path, data.wide, show_secrets, account_filters);
const wide = get_boolean_or_string_value(user_input.wide);
shirady marked this conversation as resolved.
Show resolved Hide resolved
const accounts = await list_config_files(TYPES.ACCOUNT, accounts_dir_path, wide, show_secrets, account_filters);
write_stdout_response(ManageCLIResponse.AccountList, accounts);
} else {
// we should not get here (we check it before)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,12 @@ describe('manage nsfs cli account flow', () => {
const res = await exec_manage_cli(type, action, account_options);
expect(JSON.parse(res).response.reply.map(item => item.name))
.toEqual(expect.arrayContaining(['account3', 'account2', 'account1']));
// added additional properties that we can see with wide option (uid, new_buckets_path)
expect(JSON.parse(res).response.reply.map(item => item.nsfs_account_config.uid))
.toEqual(expect.arrayContaining([999, 888]));
expect(JSON.parse(res).response.reply.map(item => item.nsfs_account_config.new_buckets_path))
.toEqual(expect.arrayContaining([`${root_path}new_buckets_path_user1/`,
`${root_path}new_buckets_path_user2/`, `${root_path}new_buckets_path_user3/`]));
});

it('cli list wide (use the flag with value "true"', async () => {
Expand Down