-
Notifications
You must be signed in to change notification settings - Fork 23.8k
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
fix network_cli connection plugin: ConnectionError: unsupported operand type(s) for ^: 'str' and 'str' #59174
Conversation
I think this should be a backport bugfix, because it is existent since the ^-operator was introduced in the network_cli plugin. Thats the case since Ansible 2.7 https://github.com/ansible/ansible/blob/stable-2.7/lib/ansible/plugins/connection/network_cli.py In the earlier versions we had the following logic, which also worked correctly with AWX:
|
@@ -299,7 +300,7 @@ def update_play_context(self, pc_data): | |||
play_context.deserialize(pc_data) | |||
|
|||
self.queue_message('vvvv', 'updating play_context for connection') | |||
if self._play_context.become ^ play_context.become: | |||
if boolean(self._play_context.become) ^ boolean(play_context.become): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so this should not be needed as become
is defined as a boolean attribute, it is an indication that 'validation' is not happening on the play_context objects, which can lead to many of the same issues for other fields.
The proper fix would be to ensure both objects trigger full validation of their attributes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, can you give me a hint where this validation should be done?
Can you verify that the issue still occurs without this patch in Ansible 2.9? needs_info |
@smnmtzgr This pullrequest is waiting for your response. Please respond or the pullrequest will be closed. |
@smnmtzgr You have not responded to information requests in this pullrequest so we will assume it no longer affects you. If you are still interested in this, please create a new pullrequest with the requested information. |
SUMMARY
Fixes ansible/awx#4325 (comment)
Fixes #48093
ISSUE TYPE
COMPONENT NAME
network_cli.py
ADDITIONAL INFORMATION
network_cli.py breaks when used in AWX 6.0.0. AWX seems to define credentials in special the become with some string, e.g. "true". This leads to a failure:
With this bugfix the become gets converted to boolean and checked correctly.