This repository has been archived by the owner. It is now read-only.

unexpected state in yum module (1.9.3) #2013

Closed
steynovich opened this Issue Sep 4, 2015 · 17 comments

Comments

Projects
None yet
@steynovich

steynovich commented Sep 4, 2015

Updating YUM packages is broken in Ansible 1.9.3.

env:
Ubuntu 15.04 vivid
Ansible version: 1.9.3-1ppa~vivid (deb-src http://ppa.launchpad.net/ansible/ansible/ubuntu)

Snippet of my playbook:

- name: YUM upgrade
  yum: name=* state=latest update_cache=yes

Unexpected result:

TASK: [centos | YUM upgrade] **************************************************
failed: [centos_host] => {"changed": false, "errors": "unexpected state", "failed": true, "results": ""}
msg: we should never get here unless this all failed

Debugging showed that the value state is 'latest', which is an expected state.

Expected result (was working in 1.9.2):

TASK: [centos | YUM upgrade] **************************************************
ok: [centos_host]

@steynovich steynovich changed the title from unexpected state when in yum module (1.9.3) to unexpected state in yum module (1.9.3) Sep 4, 2015

@gunzy83

This comment has been minimized.

Show comment
Hide comment
@gunzy83

gunzy83 Sep 4, 2015

Confirming the above, updating all packages using the yum module is broken in 1.9.3.

My environment:
Amazon Linux AMI 2015.03.1 x86_64
Ansible version 1.9.3 installed via pip

Broken task:

- name: Ensure all base packages are updated
  yum:
    name: "*"
    state: "latest"

Result:

TASK: [base | Ensure all base packages are updated] ***********************
failed: [127.0.0.1] => {"changed": false, "errors": "unexpected state", "failed": true, "results": ""}
msg: we should never get here unless this all failed

Downgrading to 1.9.2 fixes the issue.

gunzy83 commented Sep 4, 2015

Confirming the above, updating all packages using the yum module is broken in 1.9.3.

My environment:
Amazon Linux AMI 2015.03.1 x86_64
Ansible version 1.9.3 installed via pip

Broken task:

- name: Ensure all base packages are updated
  yum:
    name: "*"
    state: "latest"

Result:

TASK: [base | Ensure all base packages are updated] ***********************
failed: [127.0.0.1] => {"changed": false, "errors": "unexpected state", "failed": true, "results": ""}
msg: we should never get here unless this all failed

Downgrading to 1.9.2 fixes the issue.

@abadger

This comment has been minimized.

Show comment
Hide comment
@abadger

abadger Sep 4, 2015

Member

I just pushed 411adff which I think will fix this. Testing now. If you'd like to test as well, that would be appreciated.

Member

abadger commented Sep 4, 2015

I just pushed 411adff which I think will fix this. Testing now. If you'd like to test as well, that would be appreciated.

@steynovich

This comment has been minimized.

Show comment
Hide comment
@steynovich

steynovich Sep 4, 2015

Your commit 411adff seems to fix the issue for me.

TASK: [centos | YUM upgrade] **************************************************
ok: [centos_host]

Thanks for your swift reply.

steynovich commented Sep 4, 2015

Your commit 411adff seems to fix the issue for me.

TASK: [centos | YUM upgrade] **************************************************
ok: [centos_host]

Thanks for your swift reply.

@abadger

This comment has been minimized.

Show comment
Hide comment
@abadger

abadger Sep 4, 2015

Member

Thanks for the quick test. Works here too. We're working out when to make a 1.9.4 release with this fix in it now.

Member

abadger commented Sep 4, 2015

Thanks for the quick test. Works here too. We're working out when to make a 1.9.4 release with this fix in it now.

@abadger

This comment has been minimized.

Show comment
Hide comment
@abadger

abadger Sep 4, 2015

Member

Okay, we've tagged 1.9.4-rc1. If no more major bugs are found a 1.9.4 final should be out soon with this fix in it.

Member

abadger commented Sep 4, 2015

Okay, we've tagged 1.9.4-rc1. If no more major bugs are found a 1.9.4 final should be out soon with this fix in it.

@abadger abadger closed this Sep 4, 2015

@josebv

This comment has been minimized.

Show comment
Hide comment
@josebv

josebv Sep 22, 2015

This only affects when yum update is used inside roles, not at the top level yml

josebv commented Sep 22, 2015

This only affects when yum update is used inside roles, not at the top level yml

@lero

This comment has been minimized.

Show comment
Hide comment
@lero

lero Sep 22, 2015

almost one month and still no new release to fix it? I don't want to use rc versions.

lero commented Sep 22, 2015

almost one month and still no new release to fix it? I don't want to use rc versions.

@milad-soufastai

This comment has been minimized.

Show comment
Hide comment
@milad-soufastai

milad-soufastai Sep 22, 2015

@josebv It affects when yum is listed in the pre_tasks on a top level yml too

milad-soufastai commented Sep 22, 2015

@josebv It affects when yum is listed in the pre_tasks on a top level yml too

@jbelafa

This comment has been minimized.

Show comment
Hide comment
@jbelafa

jbelafa Sep 24, 2015

Hi
Is it risky to downgrade our platform to 1.9.2 as it's not affected ?

jbelafa commented Sep 24, 2015

Hi
Is it risky to downgrade our platform to 1.9.2 as it's not affected ?

@extremeshok

This comment has been minimized.

Show comment
Hide comment
@extremeshok

extremeshok Oct 6, 2015

Guys please push a fix, aka release 1.9.4 or a patched 1.9.3.1

extremeshok commented Oct 6, 2015

Guys please push a fix, aka release 1.9.4 or a patched 1.9.3.1

@sivel

This comment has been minimized.

Show comment
Hide comment
@sivel

sivel Oct 6, 2015

Member

1.9.4-rc3 was just announced 3 days ago

https://groups.google.com/forum/m/#!topic/ansible-devel/JmtlaIbLrlo

I imagine a 1.9.4 release soon.

Member

sivel commented Oct 6, 2015

1.9.4-rc3 was just announced 3 days ago

https://groups.google.com/forum/m/#!topic/ansible-devel/JmtlaIbLrlo

I imagine a 1.9.4 release soon.

@extremeshok

This comment has been minimized.

Show comment
Hide comment
@extremeshok

extremeshok Oct 6, 2015

The following command will fix the yum error on debian, centos will need the path changed.

sed -i "s/return res/module.exit_json(**res)/g" /usr/local/lib/python2.7/dist-packages/ansible/modules/core/packaging/os/yum.py

extremeshok commented Oct 6, 2015

The following command will fix the yum error on debian, centos will need the path changed.

sed -i "s/return res/module.exit_json(**res)/g" /usr/local/lib/python2.7/dist-packages/ansible/modules/core/packaging/os/yum.py
@cad

This comment has been minimized.

Show comment
Hide comment
@cad

cad Oct 6, 2015

How come it is not tested?

cad commented Oct 6, 2015

How come it is not tested?

@thehungrycoder

This comment has been minimized.

Show comment
Hide comment
@thehungrycoder

thehungrycoder Oct 8, 2015

Just wanted to confirm that I ran into same problem with 1.9.3. I, however, downgraded to 1.9.1 which fixed the issue.

thehungrycoder commented Oct 8, 2015

Just wanted to confirm that I ran into same problem with 1.9.3. I, however, downgraded to 1.9.1 which fixed the issue.

@pavgup

This comment has been minimized.

Show comment
Hide comment
@pavgup

pavgup Oct 8, 2015

@extremeshok has the right idea. On my fancy pants macbook with ansible installed via homebrew, the fix was:

sed -i "s/return res/module.exit_json(**res)/g" /usr/local/Cellar/ansible/1.9.3/libexec/lib/python2.7/site-packages/ansible/modules/core/packaging/os/yum.py

pavgup commented Oct 8, 2015

@extremeshok has the right idea. On my fancy pants macbook with ansible installed via homebrew, the fix was:

sed -i "s/return res/module.exit_json(**res)/g" /usr/local/Cellar/ansible/1.9.3/libexec/lib/python2.7/site-packages/ansible/modules/core/packaging/os/yum.py
@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Oct 10, 2015

Solution provided by @extremeshok worked. On Ubuntu 14+, the path is slightly different:

sudo sed -i "s/return res/module.exit_json(**res)/g" /usr/lib/pymodules/python2.7/ansible/modules/core/packaging/os/yum.py

ghost commented Oct 10, 2015

Solution provided by @extremeshok worked. On Ubuntu 14+, the path is slightly different:

sudo sed -i "s/return res/module.exit_json(**res)/g" /usr/lib/pymodules/python2.7/ansible/modules/core/packaging/os/yum.py
@sivel

This comment has been minimized.

Show comment
Hide comment
@sivel

sivel Oct 10, 2015

Member

1.9.4 was just released that contains this fix.

Member

sivel commented Oct 10, 2015

1.9.4 was just released that contains this fix.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.