Activity log for bug #1805342

Date Who What changed Old value New value Message
2018-11-27 07:15:58 Radoslaw Smigielski bug added bug
2018-11-27 07:16:13 Radoslaw Smigielski tripleo: assignee Radoslaw Smigielski (radoslaw-smigielski)
2018-11-27 07:16:17 Radoslaw Smigielski tripleo: status New In Progress
2018-11-27 07:22:03 Radoslaw Smigielski summary TripleO common AnsibleAction class fails on any add hoccommand not formated ad dict TripleO common AnsibleAction class fails on any add hoc command not formated ad dict
2018-11-27 07:46:47 Radoslaw Smigielski description tripleo_common/actions/ansible.py AnsibleAction class provides a wrapper around ansible executable (not ansible-playbook). Normal ansible command allows to execute add hoc commands like below: > ansible overcloud-Controller-2 --module-name shell --args "hostname" This is fully working but when remote command is going to have any param/switch this fails, example: > ansible overcloud-Controller-2 --module-name shell --args "hostname -s" The problem is that in AnsibleAction class --args is always treated as JSON and converted to string with json.dumps(): self.module_args = self._kwargs_for_run.pop('module_args', None) if self.module_args: self.module_args = json.dumps(self.module_args) so in my above example this is what we end up with: (Pdb) command ['ansible', 'overcloud-Controller-2', '-vvvvv', '--module-name', 'shell', '--args', '"hostname -s"'] (Pdb) self.module_args '"hostname -s"' tripleo_common/actions/ansible.py AnsibleAction class provides a wrapper around ansible executable (not ansible-playbook). Normal ansible command allows to execute add hoc commands like below: > ansible overcloud-Controller-2 --module-name shell --args "hostname" > ansible overcloud-Controller-2 --args "hostname" This is fully working but when remote command is going to have any param/switch this fails, example: > ansible overcloud-Controller-2 --module-name shell --args "hostname -s" The problem is that in AnsibleAction class --args is always treated as JSON and converted to string with json.dumps():         self.module_args = self._kwargs_for_run.pop('module_args', None)         if self.module_args:             self.module_args = json.dumps(self.module_args) so in my above example this is what we end up with: (Pdb) command ['ansible', 'overcloud-Controller-2', '-vvvvv', '--module-name', 'shell', '--args', '"hostname -s"'] (Pdb) self.module_args '"hostname -s"'
2018-11-27 10:20:53 Bogdan Dobrelya tripleo: importance Undecided High
2018-11-27 10:20:54 Bogdan Dobrelya tripleo: milestone stein-2
2018-11-27 10:21:06 Bogdan Dobrelya tags rocky-backport-potential
2019-01-03 05:46:14 OpenStack Infra tripleo: status In Progress Fix Released
2019-01-04 04:09:14 OpenStack Infra tags rocky-backport-potential in-stable-rocky rocky-backport-potential
2019-01-04 04:09:22 OpenStack Infra tags in-stable-rocky rocky-backport-potential in-stable-queens in-stable-rocky rocky-backport-potential