NDAR / nda-tools

Python package for interacting with NDA web services. Used to validate, submit, and download data to and from NDA.
MIT License
47 stars 22 forks source link

Validation does not work without -b flag #53

Closed tashrifbillah closed 1 year ago

tashrifbillah commented 1 year ago

For this line to act i.e. the vtcmd.py script to read my password from keyring: https://github.com/NDAR/nda-tools/blob/6e8255f0ede03638a44549f7e5f7d40c07d96f7f/NDATools/clientscripts/vtcmd.py#L123

it appears that I need to use the -b flag:

https://github.com/NDAR/nda-tools/blob/6e8255f0ede03638a44549f7e5f7d40c07d96f7f/NDATools/clientscripts/vtcmd.py#L46-L47

Is this your expected design? I thought validation should work without any password let alone -b flag.

nmuncy commented 1 year ago

I have the same issue.

Also, can anyone provide guidance on using this tool via python (3.8) or terminal (Ubuntu 20.04)? My keying responds with the correct password when I use keyring get nda-tools <username>, but I'm not sure what else is needed in the vtcmd call to get this working.

Trying to validate:

(ndar-upload) [Nathan: cycle_2022-12-01]vtcmd affim01_dataset.csv 
Running NDATools Version 0.2.21
-u/--username argument not provided. Using default value of 'nm[redacted]' which was saved in /home/Nathan/.NDATools/settings.cfg

Validating files...
  0%|                                                                                                  | 0/1 [00:00<?, ?it/s]Bad credentials

Exit signal received, shutting down...

Same everything, but now with -b:

(ndar-upload) [Nathan: cycle_2022-12-01]vtcmd affim01_dataset.csv -b
Running NDATools Version 0.2.21
-u/--username argument not provided. Using default value of 'nm[redacted]' which was saved in /home/Nathan/.NDATools/settings.cfg

Validating files...
100%|██████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:06<00:00,  6.01s/it]
Validation report output to: /home/Nathan/NDA/nda-tools/vtcmd/validation_results/validation_results_20221220T180253.csv

Note: Your data has warnings. To save warnings, run again with -w argument.

All files have finished validating.

The following files passed validation:
UUID 28b34277-2fa1-4c32-9298-0706abbc556f: affim01_dataset.csv
Enter title for dataset name:

I'll also provide my config file in case I am doing something wrong:

(ndar-upload) [Nathan: cycle_2022-12-01]cat ~/.NDATools/settings.cfg 
[Endpoints]
user = https://nda.nih.gov/api/user
package = https://nda.nih.gov/api/package
validation = https://nda.nih.gov/api/validation
submission_package = https://nda.nih.gov/api/submission-package
submission = https://nda.nih.gov/api/submission
validationtool = https://nda.nih.gov/api/validationtool/v2
datadictionary = https://nda.nih.gov/api/datadictionary/datastructure

[User]
username = nm[redacted]
access_key = 
secret_key = 
session_token = 

(ndar-upload) [Nathan: cycle_2022-12-01]
tashrifbillah commented 1 year ago
import keyring
keyring.set_password('nda-tools','nm[redacted]','password')
# check if it has been saved
keyring.get_password('nda-tools','nm[redacted]')
# you should see password printout on the console

If successful, try vtcmd affim01_dataset.csv -b -u nm[redacted].

gregmagdits commented 1 year ago

I think we will be fast-tracking a hotfix for this issue. Ill post an update here when we have a better idea of when it will be available

gregmagdits commented 1 year ago

The fix for this has been deployed. NDA credentials do not need to be provided when validating. The -b flag does not need to be provided to avoid the bad-credentials error