naftulikay / ansible-role-degoss

An Ansible role for installing, running, and removing Goss from a system without leaving any traces.
Other
42 stars 12 forks source link

Environment Variables Aren't Sanitized #13

Closed naftulikay closed 7 years ago

naftulikay commented 7 years ago

When environment variables are passed to the Goss executable, they are not converted into strings. This is the aforementioned issue in #12:

Traceback (most recent call last):
  File "/tmp/ansible_DzKBAW/ansible_module_goss.py", line 96, in <module>
    main()
  File "/tmp/ansible_DzKBAW/ansible_module_goss.py", line 88, in main
    rc, stdout, stderr = evaluate(module, test_file, fmt, executable, env_vars)
  File "/tmp/ansible_DzKBAW/ansible_module_goss.py", line 52, in evaluate
    environ_update=env_vars
  File "/tmp/ansible_DzKBAW/ansible_modlib.zip/ansible/module_utils/basic.py", line 2328, in run_command
  File "/usr/lib/python2.7/os.py", line 471, in __setitem__
    putenv(key, item)
TypeError: must be string, not bool

Traceback (most recent call last):
  File "/tmp/ansible_DzKBAW/ansible_module_goss.py", line 96, in <module>
    main()
  File "/tmp/ansible_DzKBAW/ansible_module_goss.py", line 88, in main
    rc, stdout, stderr = evaluate(module, test_file, fmt, executable, env_vars)
  File "/tmp/ansible_DzKBAW/ansible_module_goss.py", line 52, in evaluate
    environ_update=env_vars
  File "/tmp/ansible_DzKBAW/ansible_modlib.zip/ansible/module_utils/basic.py", line 2328, in run_command
  File "/usr/lib/python2.7/os.py", line 471, in __setitem
    putenv(key, item)
TypeError: must be string, not bool

Essentially, I was passing a raw YAML boolean into the environment variables dictionary, and these values should be sanitized to strings before starting the process.

Acceptance Criteria