cloud-init-dev team mailing list archive
-
cloud-init-dev team
-
Mailing list archive
-
Message #04476
Re: [Merge] ~powersj/cloud-init:cii-restructure-ssh into cloud-init:master
Diff comments:
> diff --git a/tests/cloud_tests/platforms/instances.py b/tests/cloud_tests/platforms/instances.py
> index 3bad021..fa392b7 100644
> --- a/tests/cloud_tests/platforms/instances.py
> +++ b/tests/cloud_tests/platforms/instances.py
> @@ -87,7 +87,12 @@ class Instance(TargetBase):
> self._ssh_client = None
>
> def _ssh_connect(self):
> - """Connect via SSH."""
> + """Connect via SSH.
> +
> + Attempt to SSH to the client on teh specific IP and port. If it
'on teh' -> 'on the'
> + fails in some manner, then retry 2 more times for a total of 3
> + attempts; sleeping a few seconds between attempts.
> + """
> if self._ssh_client:
> return self._ssh_client
>
> @@ -128,18 +137,26 @@ class Instance(TargetBase):
> return ' '.join(l for l in test.strip().splitlines()
> if not l.lstrip().startswith('#'))
>
> - time = self.config['boot_timeout']
> + boot_timeout = self.config['boot_timeout']
> tests = [self.config['system_ready_script']]
> if wait_for_cloud_init:
> tests.append(self.config['cloud_init_ready_script'])
>
> formatted_tests = ' && '.join(clean_test(t) for t in tests)
> cmd = ('i=0; while [ $i -lt {time} ] && i=$(($i+1)); do {test} && '
> - 'exit 0; sleep 1; done; exit 1').format(time=time,
> + 'exit 0; sleep 1; done; exit 1').format(time=boot_timeout,
> test=formatted_tests)
>
> - if self.execute(cmd, rcs=(0, 1))[-1] != 0:
> - raise OSError('timeout: after {}s system not started'.format(time))
> -
> + end_time = time.time() + boot_timeout
> + while time.time() < end_time:
> + try:
> + if self.execute(cmd, rcs=(0, 1),
> + description='wait for instance')[-1] != 0:
> + raise OSError('timeout: after %ss system not started' %
> + boot_timeout)
> + else:
> + break
> + except util.InTargetExecuteError:
can we log debug at least that this happened? or will that occur somewhere else.
> + time.sleep(3)
>
> # vi: ts=4 expandtab
--
https://code.launchpad.net/~powersj/cloud-init/+git/cloud-init/+merge/342010
Your team cloud-init commiters is requested to review the proposed merge of ~powersj/cloud-init:cii-restructure-ssh into cloud-init:master.
References