vmware-archive / column

A stable API for Ansible
https://vmware.github.io/column/
GNU General Public License v3.0
38 stars 9 forks source link

500: Internal Server Error on credential PUT #185

Closed ericwb closed 6 years ago

ericwb commented 6 years ago

Ran into another 500 error when doing PUT on credential API with no data.

Steps:

docker build -t column-image .
docker run -d -p 48620:48620 -v /Users/browne/workspace/column/tests/fixtures/playbooks:/Users/browne/workspace/column column-image 
docker attach 7ac83cb3eeaf
PUT http://192.168.1.147:48620/credentials (with no body or value)
[2018-03-07 06:00:21,640] ERROR in app: Exception on /credentials [PUT]
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1612, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1598, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/usr/local/lib/python2.7/dist-packages/flask_restful/__init__.py", line 480, in wrapper
    resp = resource(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/flask/views.py", line 84, in view
    return self.dispatch_request(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/flask_restful/__init__.py", line 595, in dispatch_request
    resp = meth(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/column-0.5.2-py2.7.egg/column/api/common/utils.py", line 29, in wrapper
    return f(controller_object)
  File "/usr/local/lib/python2.7/dist-packages/column-0.5.2-py2.7.egg/column/api/controller/credential_controller.py", line 61, in put
    return self.manager.update_credential(cred_payload)
  File "/usr/local/lib/python2.7/dist-packages/column-0.5.2-py2.7.egg/column/api/manager/credential_manager.py", line 24, in update_credential
    return utils.vault_encrypt(cred['value'])
  File "/usr/local/lib/python2.7/dist-packages/column-0.5.2-py2.7.egg/column/utils.py", line 40, in vault_encrypt
    _get_vault_password_file(), dataloader.DataLoader())
  File "/usr/local/lib/python2.7/dist-packages/ansible/cli/__init__.py", line 628, in read_vault_password_file
    this_path = os.path.realpath(os.path.expanduser(vault_password_file))
  File "/usr/lib/python2.7/posixpath.py", line 254, in expanduser
    if not path.startswith('~'):
AttributeError: 'NoneType' object has no attribute 'startswith'
ericwb commented 6 years ago

The last part of the traceback indicates the issue when running in a container. There is no user home directory, so expanduser fails.