Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix KeyError when 'current' is missing #183

Merged
merged 1 commit into from
May 24, 2017
Merged

Fix KeyError when 'current' is missing #183

merged 1 commit into from
May 24, 2017

Conversation

Cynerva
Copy link
Contributor

@Cynerva Cynerva commented May 24, 2017

Proposed fix for an error I've seen occasionally in our test runs:

Traceback (most recent call last):
  File "/tmp/bundletester-tMSZKP/tmpA7PRkx/tests/20-charm-validation.py", line 171, in test_etcd_scale_on_master
    self.deployment.sentry.wait()
  File "/usr/lib/python3/dist-packages/amulet/sentry.py", line 547, in wait
    if check_status(status):
  File "/usr/lib/python3/dist-packages/amulet/sentry.py", line 531, in check_status
    if unit['agent-status']['current'] != 'idle':
KeyError: 'current'

It looks like this can occur when calling sentry.wait() immediately after removing a unit. This is exactly what our failing test is doing: https://github.com/juju-solutions/bundle-canonical-kubernetes/blob/master/tests/20-charm-validation.py#L169-L171

The root cause seems to be that Juju, sometimes, does not include the current key within juju-status (which is normalized to agent-status in amulet). See this output that occurred during model destruction, where unit etcd/2 is missing the current key.

@tvansteenburgh
Copy link
Contributor

LGTM. Good to merge once tests pass.

@marcoceppi marcoceppi merged commit f1a5bad into juju:master May 24, 2017
@Cynerva Cynerva deleted the gkk/fix-agent-status-error branch May 24, 2017 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants