yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #84910
[Bug 1908287] Re: cloud-init exits early on ec2 after reboot
Correct, I think this is a pycloudlib issue.
** Changed in: cloud-init
Status: New => Invalid
--
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to cloud-init.
https://bugs.launchpad.net/bugs/1908287
Title:
cloud-init exits early on ec2 after reboot
Status in cloud-init:
Invalid
Bug description:
Possibly duplicate of or related to bug #1890528 .
When rebooting an ec2 instance after a "cloud-init clean --logs",
"cloud-init status --wait --long" will exit early with non-0 status,
but a later subsequent run of "cloud-init status --wait --long" will
wait and return cleanly.
To reproduce, create an example test file at tests/integration_tests/test_example.py:
```
def test_ec2(client):
client.execute('cloud-init clean --logs')
client.restart(raise_on_cloudinit_failure=True)
```
Run with:
```
export CLOUD_INIT_PLATFORM=ec2
export CLOUD_INIT_CLOUD_INIT_SOURCE=NONE
pytest -s tests/integration_tests/test_example.py
```
Relevant output from failure:
```
def _wait_for_cloudinit(self, *, raise_on_failure: bool):
"""Wait until cloud-init has finished.
:param raise_on_failure:
When `True`, if the process waiting for cloud-init exits non-zero
then this method will raise an `OSError`.
"""
self._log.debug('_wait_for_cloudinit to complete')
result = self.execute("cloud-init status --help")
has_wait = "--wait" in result.stdout
if has_wait:
cmd = ["cloud-init", "status", "--wait", "--long"]
else:
# runlevel 'N 2' supports distros without recent cloud-init
# (e.g. trusty).
runlevel_result = (
'[ "$(runlevel)" = "N 2" ] && '
"[ -f /run/cloud-init/result.json ]"
)
cmd = (
"i=0; while [ $i -lt {} ] && i=$(($i+1)); do {} && exit 0;"
" sleep 1; done; exit 1".format(
self.boot_timeout, runlevel_result
)
)
result = self.execute(cmd, description='waiting for start')
if raise_on_failure and result.failed:
raise OSError(
'cloud-init failed to start: out: %s error: %s' % (
> result.stdout, result.stderr
)
)
E OSError: cloud-init failed to start: out: .... error:
../pycloudlib/pycloudlib/instance.py:427: OSError
```
I see no indication in the logs of any problem or failure.
To manage notifications about this bug go to:
https://bugs.launchpad.net/cloud-init/+bug/1908287/+subscriptions
References