Skip to content

Commit

Permalink
Merge pull request #549 from grycap/devel
Browse files Browse the repository at this point in the history
Fix conf-ansible.yml
  • Loading branch information
micafer committed Feb 14, 2018
2 parents 628f469 + e69c408 commit ac8aa8e
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 8 deletions.
9 changes: 5 additions & 4 deletions IM/ConfManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ def __init__(self, inf, auth, max_ctxt_time=1e9):
self.max_ctxt_time = max_ctxt_time
self._stop_thread = False
self.ansible_process = None
self.failed_step = []
self.logger = logging.getLogger('ConfManager')

def check_running_pids(self, vms_configuring, failed_step):
Expand Down Expand Up @@ -190,7 +191,7 @@ def kill_ctxt_processes(self):
def run(self):
self.log_info("Starting the ConfManager Thread")

failed_step = []
self.failed_step = []
last_step = None
vms_configuring = {}

Expand All @@ -207,7 +208,7 @@ def run(self):
self.ansible_process.terminate()
return

failed_step, vms_configuring = self.check_running_pids(vms_configuring, failed_step)
self.failed_step, vms_configuring = self.check_running_pids(vms_configuring, self.failed_step)

# If the queue is empty but there are vms configuring wait and test
# again
Expand All @@ -224,9 +225,9 @@ def run(self):

# if this task is from a next step
if last_step is not None and last_step < step:
if failed_step and sorted(failed_step)[-1] < step:
if self.failed_step and sorted(self.failed_step)[-1] < step:
self.log_info("Configuration of process of step %s failed, "
"ignoring tasks of step %s." % (sorted(failed_step)[-1], step))
"ignoring tasks of step %s." % (sorted(self.failed_step)[-1], step))
else:
# Add the task again to the queue only if the last step was
# OK
Expand Down
2 changes: 2 additions & 0 deletions IM/InfrastructureInfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,8 @@ def Contextualize(self, auth, vm_list=None):
# update the ConfManager auth
self.cm.auth = auth
self.cm.init_time = time.time()
# restart the failed step
self.cm.failed_step = []

def is_authorized(self, auth):
"""
Expand Down
11 changes: 10 additions & 1 deletion contextualization/conf-ansible.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@
apt: name=python-cryptography
when: (ansible_distribution == "Ubuntu" and ansible_distribution_major_version|int >= 16) or (ansible_distribution == "Debian" and ansible_distribution_major_version|int >= 8)

- name: Install requirements Ubuntu 14
apt: name=gcc,python-dev,libffi-dev,libssl-dev
when: ansible_distribution == "Ubuntu" and ansible_distribution_major_version|int <= 14

############################################ In other systems use pip #################################################

- name: Yum install requirements RH 6
Expand All @@ -74,7 +78,12 @@

- name: Upgrade pip
pip: name=pip extra_args="-I" state=latest
when: ansible_os_family == "Suse"

- name: Upgrade setuptools with Pip
pip: name=setuptools state=latest

- name: Upgrade pyOpenSSL with Pip
pip: name=pyOpenSSL state=latest

- name: Install ansible with Pip
pip: name=ansible
Expand Down
2 changes: 1 addition & 1 deletion test/files/test_simple.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"class": "system",
"cpu.arch": "x86_64",
"cpu.count_min": 1,
"disk.0.image.url": "one://onecloud.i3m.upv.es/77",
"disk.0.image.url": "one://ramses.i3m.upv.es/95",
"disk.0.os.credentials.password": "yoyoyo",
"disk.0.os.credentials.username": "ubuntu",
"disk.0.os.name": "linux",
Expand Down
2 changes: 1 addition & 1 deletion test/files/test_simple.radl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ cpu.arch='x86_64' and
cpu.count>=1 and
memory.size>=512m and
net_interface.0.connection = 'privada' and
disk.0.image.url = 'one://onecloud.i3m.upv.es/77' and
disk.0.image.url = 'one://ramses.i3m.upv.es/95' and
disk.0.os.credentials.username = 'ubuntu' and
disk.0.os.credentials.password = 'yoyoyo' and
disk.0.os.name = 'linux'
Expand Down
2 changes: 1 addition & 1 deletion test/integration/TestREST.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ def test_93_create_tosca(self):

self.__class__.inf_id = str(os.path.basename(resp.text))

all_configured = self.wait_inf_state(VirtualMachine.CONFIGURED, 600)
all_configured = self.wait_inf_state(VirtualMachine.CONFIGURED, 900)
self.assertTrue(
all_configured, msg="ERROR waiting the infrastructure to be configured (timeout).")

Expand Down

0 comments on commit ac8aa8e

Please sign in to comment.