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

[Bug] Non-numeric userid unexpectedly fails policy for instrument and inst_custodian_list relationship #56

Closed
GitBytes opened this issue Aug 9, 2019 · 0 comments · Fixed by #72 or #74

Comments

@GitBytes
Copy link

GitBytes commented Aug 9, 2019

Pacifica CLI Tool version

v0.4.0

Scenario:

Trying to do an upload.

Steps to Reproduce:

$ python3 -m pacifica.cli --config=uploader.json upload --logon dmlb2001 uploader.json 
Setting logon to dmlb2001.
Setting instrument to 54.
Setting project to 1234a.
Setting user-of-record to 10.
Setting directory-project to 1234a.
Done 10240.                                                                     
Waiting job to complete (202).                                                  
Done.
{
    "complete": true,
    "created": "2019-08-07 17:24:29.307332",
    "exception": "The server encountered an unexpected condition which prevented it from fulfilling the request. (Traceback (most recent call last):\n  File \"/usr/local/lib/python3.6/site-packages/cherrypy/_cprequest.py\", line 628, in respond\n    self._do_respond(path_info)\n  File \"/usr/local/lib/python3.6/site-packages/cherrypy/_cprequest.py\", line 687, in _do_respond\n    response.body = self.handler()\n  File \"/usr/local/lib/python3.6/site-packages/cherrypy/lib/encoding.py\", line 219, in __call__\n    self.body = self.oldhandler(*args, **kwargs)\n  File \"/usr/local/lib/python3.6/site-packages/cherrypy/lib/jsontools.py\", line 59, in json_handler\n    value = cherrypy.serving.request._json_inner_handler(*args, **kwargs)\n  File \"/usr/local/lib/python3.6/site-packages/cherrypy/_cpdispatch.py\", line 54, in __call__\n    return self.callable(*self.args, **self.kwargs)\n  File \"/usr/local/lib/python3.6/site-packages/pacifica/policy/ingest/rest.py\", line 103, in POST\n    return self._valid_query(metadata)\n  File \"/usr/local/lib/python3.6/site-packages/pacifica/policy/ingest/rest.py\", line 69, in _valid_query\n    valid_terms['submitter'], valid_terms['instrument']):\n  File \"/usr/local/lib/python3.6/site-packages/pacifica/policy/admin.py\", line 87, in _projects_for_user_inst\n    projs_for_custodian = set(self._projects_for_custodian(user_id))\n  File \"/usr/local/lib/python3.6/site-packages/pacifica/policy/admin.py\", line 61, in _projects_for_custodian\n    inst_list = self._instruments_for_custodian(user_id)\n  File \"/usr/local/lib/python3.6/site-packages/pacifica/policy/admin.py\", line 74, in _instruments_for_custodian\n    return [i['instrument'] for i in inst_custodian_list]\n  File \"/usr/local/lib/python3.6/site-packages/pacifica/policy/admin.py\", line 74, in <listcomp>\n    return [i['instrument'] for i in inst_custodian_list]\nTypeError: string indices must be integers\n)",
    "job_id": 202,
    "state": "FAILED",
    "task": "Policy Validation",
    "task_percent": "0.00000",
    "updated": "2019-08-07 17:24:31.538321"
}

Expected Result:

Able to use network_id OR numeric ID for doing uploads and have same behavior

Actual Result:

Had to use a numerical ID to do a successful upload. We used the test metadata set in the tests for making this bug pop up.

dmlb2000 added a commit to dmlb2000/pacifica-cli that referenced this issue Jan 31, 2020
The logon user is special and maybe the network name when placed
on the command line. So we should always resolve it to and ID as
that's the internal representation we manage.

Signed-off-by: David Brown <dmlb2000@gmail.com>
dmlb2000 added a commit that referenced this issue Jan 31, 2020
The logon user is special and maybe the network name when placed
on the command line. So we should always resolve it to and ID as
that's the internal representation we manage.

Signed-off-by: David Brown <dmlb2000@gmail.com>
dmlb2000 added a commit to dmlb2000/pacifica-cli that referenced this issue Feb 5, 2020
- Pull pacifica#73 Add Python 3.7 and 3.8 by [dmlb2000](https://github.com/dmlb2000)
- Pull pacifica#70 Add Version Moodule by [dmlb2000](https://github.com/dmlb2000)
- Pull pacifica#68 Add JSONSchema Validation by [dmlb2000](https://github.com/dmlb2000)
- Pull pacifica#66 Add Kerberos/GSSAPI Authentication by [dmlb2000](https://github.com/dmlb2000)
- Fix pacifica#55 Add Basic Authentication Env Vars by [casey-pnnl](https://github.com/casey-pnnl)
- Fix pacifica#52 Add File Not Found Error by [dmlb2000](https://github.com/dmlb2000)
- Fix pacifica#56 Resolve User Logon Always by [dmlb2000](https://github.com/dmlb2000)
- Fix pacifica#53 Add Env/CLI for config.ini by [dmlb2000](https://github.com/dmlb2000)
- Fix pacifica#61 Do not save during global read by [dmlb2000](https://github.com/dmlb2000)
- Pull pacifica#67 Add Ansible to Travis CI by [dmlb2000](https://github.com/dmlb2000)
- Pull pacifica#65 Updated Pylint 2.0+ by [dmlb2000](https://github.com/dmlb2000)
- Pull pacifica#64 Remove Python 2.7 by [dmlb2000](https://github.com/dmlb2000)
- Fix pacifica#51 Remove Query Results by [dmlb2000](https://github.com/dmlb2000)

Signed-off-by: David Brown <dmlb2000@gmail.com>
dmlb2000 added a commit that referenced this issue Feb 5, 2020
- Pull #73 Add Python 3.7 and 3.8 by [dmlb2000](https://github.com/dmlb2000)
- Pull #70 Add Version Moodule by [dmlb2000](https://github.com/dmlb2000)
- Pull #68 Add JSONSchema Validation by [dmlb2000](https://github.com/dmlb2000)
- Pull #66 Add Kerberos/GSSAPI Authentication by [dmlb2000](https://github.com/dmlb2000)
- Fix #55 Add Basic Authentication Env Vars by [casey-pnnl](https://github.com/casey-pnnl)
- Fix #52 Add File Not Found Error by [dmlb2000](https://github.com/dmlb2000)
- Fix #56 Resolve User Logon Always by [dmlb2000](https://github.com/dmlb2000)
- Fix #53 Add Env/CLI for config.ini by [dmlb2000](https://github.com/dmlb2000)
- Fix #61 Do not save during global read by [dmlb2000](https://github.com/dmlb2000)
- Pull #67 Add Ansible to Travis CI by [dmlb2000](https://github.com/dmlb2000)
- Pull #65 Updated Pylint 2.0+ by [dmlb2000](https://github.com/dmlb2000)
- Pull #64 Remove Python 2.7 by [dmlb2000](https://github.com/dmlb2000)
- Fix #51 Remove Query Results by [dmlb2000](https://github.com/dmlb2000)

Signed-off-by: David Brown <dmlb2000@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant