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

NC | CLI | Small fixes in Health and Account Delete CLI command #8364

Merged
merged 1 commit into from
Sep 16, 2024

Conversation

romayalon
Copy link
Contributor

Explain the changes

  1. health tests were not working as expected - the async in the describe + a bug in the inner global describe section caused the whole describe + tests to be skipped, no failures were observed, removed the async and fixed the bugs in the health tests (NC | ConfigFS | Create prepare for schema functions and some manage_nsfs refactoring #8297)
  2. The non failing test caused us to not discover a bug in the health script, we accessed .name but we changed this code so it had to be changed as well (NC | Config Dir Restructure #8279)
  3. Another issue in the delete account CLI - trying to unlink access key 'undefined.symlink' on accounts without access keys (needs an editing of the file because we still can not create users without access keys) because we put on fetch_account_data() a default - [{access_key: undefined, secret_key: undefined}] and not [], changed the default to [].

this needs to be backported to 4.17 branch.

Issues: Fixed #xxx / Gap #xxx

Testing Instructions:

  1. sudo NC_CORETEST=true node --trace-warnings ./node_modules/mocha/bin/mocha /noobaa-core/src/test/unit_tests/test_nc_nsfs_health.js expect 20 tests to succeed and not 5.
  • Doc added/updated
  • Tests added

@shirady
Copy link
Contributor

shirady commented Sep 16, 2024

@romayalon I will share that I looked at the change in get_access_keys

-            let access_keys = [{
-        access_key: undefined,
-        secret_key: undefined,
-    }];
+        let access_keys = [];

I did what you suggested on master branch:

  1. I created an account with the CLI: sudo node src/cmd/manage_nsfs account add --name shira-1003 --new_buckets_path /tmp/nsfs_root1 --access_key <access-key> --secret_key <secret-key> --uid 1003 --gid 1003 (new_buckets_path was already existing by running: sudo mkdir -p /tmp/nsfs_root1 and sudo chmod -R 777 /tmp/nsfs_root1/).
  2. I manually deleted its access keys: sudo rm /etc/noobaa.conf.d/access_keys/<access-key>.symlink and edit the account config file sudo vi /etc/noobaa.conf.d/identities/<account-id>/identity.json (leaving the access_keys to be an empty array).
  3. I tried to delete the account with the CLI: sudo node src/cmd/manage_nsfs account delete --name shira-1003 --debug 5
    Currently - we see an InternalError error and in logs we can see:

Sep-16 11:40:51.665 [/65947] [WARN] core.sdk.config_fs:: Config file name is missing - undefined
2024-09-16 11:40:51.665619 [PID-65947/TID-259] [L1] FS::FSWorker::Begin: RealPath _path=/etc/noobaa.conf.d/access_keys/undefined.symlink
2024-09-16 11:40:51.665638 [PID-65947/TID-8195] [L1] FS::FSWorker::Execute: RealPath _path=/etc/noobaa.conf.d/access_keys/undefined.symlink _uid=0 _gid=0 _backend=
2024-09-16 11:40:51.665663 [PID-65947/TID-8195] [L1] FS::FSWorker::Execute: RealPath _path=/etc/noobaa.conf.d/access_keys/undefined.symlink _uid=0 _gid=0 geteuid()=0 getegid()=0 getuid()=0 getgid()=0
2024-09-16 11:40:51.665727 [PID-65947/TID-8195] [L1] FS::FSWorker::Execute: RealPath _path=/etc/noobaa.conf.d/access_keys/undefined.symlink took: 0.05175 ms
2024-09-16 11:40:51.665765 [PID-65947/TID-259] [L1] FS::FSWorker::OnError: RealPath _path=/etc/noobaa.conf.d/access_keys/undefined.symlink error.Message()=No such file or directory

After checkout this branch change, the account was deleted.

Copy link
Contributor

@shirady shirady left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

src/manage_nsfs/health.js Outdated Show resolved Hide resolved
@romayalon romayalon merged commit cb6beec into noobaa:master Sep 16, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants