Skip to content

Commit

Permalink
Bugfixes with Ansible 2.X version
Browse files Browse the repository at this point in the history
  • Loading branch information
micafer committed Jan 14, 2016
1 parent 08e6695 commit 160f51a
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 8 deletions.
6 changes: 3 additions & 3 deletions IM/ansible/ansible_executor_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def display(self, msg, color=None, stderr=False, screen_only=False, log_only=Fal
if isinstance(self.output, logging.Logger):
self.output.info(msg)
else:
print >>self.output, msg
self.output.write("%s\n" % msg)
else:
sys.stdout.write(msg)
sys.stdout.flush()
Expand Down Expand Up @@ -272,8 +272,8 @@ def __init__(self, playbooks, inventory, variable_manager, loader, options, pass
loader=loader, options=options,
passwords=self.passwords)

callback = AnsibleCallbacks(output)
self._tqm._callback_plugins.append(callback)
# Set out Callback as the stdout one to avoid stdout messages
self._tqm._stdout_callback = AnsibleCallbacks(output)


def run(self):
Expand Down
6 changes: 4 additions & 2 deletions IM/ansible/ansible_launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more/etc/sudoers details.
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
Expand Down Expand Up @@ -47,7 +47,7 @@ def display(msg, color=None, stderr=False, screen_only=False, log_only=False, ou
if isinstance(output, logging.Logger):
output.info(msg)
else:
print >>output, msg
output.write("%s\n" % msg)
else:
sys.stdout.write(msg)
sys.stdout.flush()
Expand Down Expand Up @@ -110,6 +110,8 @@ def launch_playbook_v2(self):
options, _ = parser.parse_args([])

sshpass = None
if not options.become_user:
options.become_user = "root"

if self.pk_file:
options.private_key_file = self.pk_file
Expand Down
4 changes: 3 additions & 1 deletion contextualization/conf-ansible.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
- hosts: all
sudo: yes
# sudo: yes
become: yes
become_method: sudo
vars:
ANSIBLE_VERSION: 1.9.4
tasks:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,5 @@
long_description="IM is a tool that ease the access and the usability of IaaS clouds by automating the VMI selection, deployment, configuration, software installation, monitoring and update of Virtual Appliances. It supports APIs from a large number of virtual platforms, making user applications cloud-agnostic. In addition it integrates a contextualization system to enable the installation and configuration of all the user required applications providing the user with a fully functional infrastructure.",
description="IM is a tool to manage virtual infrastructures on Cloud deployments",
platforms=["any"],
install_requires=["ansible >= 1.4","paramiko >= 1.14","PyYAML","SOAPpy","boto >= 2.29","apache-libcloud >= 0.17","ply", "bottle", "netaddr", "scp"]
install_requires=["ansible >= 1.9","paramiko >= 1.14","PyYAML","SOAPpy","boto >= 2.29","apache-libcloud >= 0.17","ply", "bottle", "netaddr", "scp"]
)
2 changes: 1 addition & 1 deletion test/TestIM.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ def test_80_create_ansible_host(self):
self.__class__.inf_id = [inf_id]

all_configured = self.wait_inf_state(inf_id, VirtualMachine.CONFIGURED, 600)
self.assertTrue(all_configured, msg="ERROR waiting the ansible maste to be configured (timeout).")
self.assertTrue(all_configured, msg="ERROR waiting the ansible master to be configured (timeout).")

(success, info) = self.server.GetVMInfo(inf_id, "0", self.auth_data)
self.assertTrue(success, msg="ERROR getting ansible master info: " + str(info))
Expand Down

0 comments on commit 160f51a

Please sign in to comment.