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

'NoneType' object is not callable when password is None #56790

Open
wants to merge 1 commit into
base: devel
from

Conversation

Projects
None yet
2 participants
@infraweavers
Copy link

commented May 22, 2019

Use fields.append('none') instead of self.password('none') when appending to crypttab

SUMMARY

When using this module without a password, an exception occurs. This looks to have been broken in commit 8bd5757 where a fields.append was replaced (accidentally?) with a call to self.password

Attempts to use the crypttab module without specifying a password file resulted in the following error:

Traceback (most recent call last):
  File "./__main__.py", line 365, in <module>
    main()
  File "./__main__.py", line 161, in main
    f.write(to_bytes(crypttab, errors='surrogate_or_strict'))
  File "/home/infraweavers/.ansible/tmp/ansible-tmp-1558512110.99-166034509721507/debug_dir/ansible/module_utils/_text.py", line 149, in to_bytes
    value = str(obj)
  File "./__main__.py", line 203, in __str__
    lines.append(str(line))
  File "./__main__.py", line 283, in __str__
    self.password('none')
TypeError: 'NoneType' object is not callable
ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

crypttab

ADDITIONAL INFORMATION

Before Output:

Traceback (most recent call last):
  File "./__main__.py", line 365, in <module>
    main()
  File "./__main__.py", line 161, in main
    f.write(to_bytes(crypttab, errors='surrogate_or_strict'))
  File "/home/infraweavers/.ansible/tmp/ansible-tmp-1558512110.99-166034509721507/debug_dir/ansible/module_utils/_text.py", line 149, in to_bytes
    value = str(obj)
  File "./__main__.py", line 203, in __str__
    lines.append(str(line))
  File "./__main__.py", line 283, in __str__
    self.password('none')
TypeError: 'NoneType' object is not callable

After output:

{"group": "root", "name": "sda5_crypt", "backing_device": "UUID=5f41ada4-7c91-11e9-b979-e311b8ea0db8", "warnings": ["Module did not set no_log for password"], "changed": true, "invocation": {"module_args": {"name": "sda5_crypt", "backing
_device": "UUID=5f41ada4-7c91-11e9-b979-e311b8ea0db8", "state": "present", "path": "/etc/crypttab", "password": null, "opts": "luks"}}, "state": "file", "gid": 0, "mode": "0644", "msg": "added line", "owner": "root", "path": "/etc/cryptt
ab", "password": null, "uid": 0, "opts": "luks", "size": 126}
dc
'NoneType' object is not callable when password is NoneType
This looks to have been broken in commit 8bd5757 where a fields.append was replaced with a call to self.password
@ansibot

This comment has been minimized.

Copy link
Contributor

commented May 22, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.