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

Module apt with state=build-dep reports change even when there is none #38995

Closed
kayhayen opened this issue Apr 19, 2018 · 3 comments · Fixed by #38999
Closed

Module apt with state=build-dep reports change even when there is none #38995

kayhayen opened this issue Apr 19, 2018 · 3 comments · Fixed by #38999
Labels
affects_2.5 This issue/PR affects Ansible v2.5 bug This issue/PR relates to a bug. module This issue/PR relates to a module. python3 support:core This issue/PR relates to code supported by the Ansible Engineering Team.

Comments

@kayhayen
Copy link

ISSUE TYPE
  • Bug Report
COMPONENT NAME

apt

ANSIBLE VERSION
ansible 2.5.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/hayen/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python2.7/dist-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 2.7.13 (default, Nov 24 2017, 17:33:09) [GCC 6.3.0 20170516]
CONFIGURATION

ANSIBLE_PIPELINING(/etc/ansible/ansible.cfg) = True
DEFAULT_GATHERING(/etc/ansible/ansible.cfg) = smart
DEFAULT_REMOTE_USER(/etc/ansible/ansible.cfg) = root

OS / ENVIRONMENT

Debian Stretch for both master and controlled node. The master is running amd64 arch and controlled node armhf.

SUMMARY

When using state=build-dep there is a change each time the task is run. When using -d I am getting this kind of output:

TASK [buildbot-tools : Install Python2.7 build dependencies] *****************************
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
changed: [donatix.home] => (item=[u'python2.7'])

TASK [buildbot-tools : Install Python3.5 build dependencies] *****************************
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
changed: [donatix.home] => (item=[u'python3.5'])
STEPS TO REPRODUCE
  - name: Install Python2.7 build dependencies
    action: apt pkg={{item}} state=build-dep
    with_items:
         - python2.7

  - name: Install Python3.5 build dependencies
    action: apt pkg={{item}} state=build-dep
    with_items:
         - python3.5
EXPECTED RESULTS

I was expecting build-dep to report "changed" only once. However it seems that the status output from build-dep of apt is seen as indicating a change even when there is one.

ACTUAL RESULTS

With verbose, I am getting more output:

Using module file /usr/local/lib/python2.7/dist-packages/ansible/modules/packaging/os/apt.py
<donatix.home> ESTABLISH SSH CONNECTION FOR USER: root
<donatix.home> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 -o ControlPath=/data/home/hayen/.ansible/cp/1fa446c277 donatix.home '/bin/sh -c '"'"'/usr/bin/python && sleep 0'"'"''
<donatix.home> (0, '\n{"stdout": "Reading package lists...\\nReading package lists...\\nBuilding dependency tree...\\nReading state information...\\n0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.\\n", "cache_updated": false, "changed": true, "stderr": "", "invocation": {"module_args": {"dpkg_options": "force-confdef,force-confold", "upgrade": null, "force": false, "force_apt_get": false, "install_recommends": null, "package": ["python2.7"], "autoclean": false, "name": ["python2.7"], "purge": false, "allow_unauthenticated": false, "state": "build-dep", "autoremove": false, "update_cache": null, "default_release": null, "only_upgrade": false, "deb": null, "cache_valid_time": 0}}, "diff": {}, "cache_update_time": 1524113826}\n', 'OpenSSH_7.4p1 Debian-10+deb9u3, OpenSSL 1.0.2l  25 May 2017\r\ndebug1: Reading configuration data /home/hayen/.ssh/config\r\ndebug1: /home/hayen/.ssh/config line 1: Applying options for *\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 10027\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\n')
changed: [donatix.home] => (item=[u'python2.7']) => {
    "cache_update_time": 1524113826, 
    "cache_updated": false, 
    "changed": true, 
    "diff": {}, 
    "invocation": {
        "module_args": {
            "allow_unauthenticated": false, 
            "autoclean": false, 
            "autoremove": false, 
            "cache_valid_time": 0, 
            "deb": null, 
            "default_release": null, 
            "dpkg_options": "force-confdef,force-confold", 
            "force": false, 
            "force_apt_get": false, 
            "install_recommends": null, 
            "name": [
                "python2.7"
            ], 
            "only_upgrade": false, 
            "package": [
                "python2.7"
            ], 
            "purge": false, 
            "state": "build-dep", 
            "update_cache": null, 
            "upgrade": null
        }
    }, 
    "item": [
        "python2.7"
    ], 
    "stderr": "", 
    "stderr_lines": [], 
    "stdout": "Reading package lists...\nReading package lists...\nBuilding dependency tree...\nReading state information...\n0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.\n", 
    "stdout_lines": [
        "Reading package lists...", 
        "Reading package lists...", 
        "Building dependency tree...", 
        "Reading state information...", 
        "0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded."
    ]
}

@ansibot
Copy link
Contributor

ansibot commented Apr 19, 2018

Files identified in the description:

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibot
Copy link
Contributor

ansibot commented Apr 19, 2018

@ansibot ansibot added affects_2.5 This issue/PR affects Ansible v2.5 bug This issue/PR relates to a bug. module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. python3 support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels Apr 19, 2018
@kayhayen
Copy link
Author

This code from "parse_diff" of apt.py ought to match:

diff_end = next(i for i, item in enumerate(diff) if re.match('[0-9]+ (packages )?upgraded', item))

My diff output is:

0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

I have to assume that code is not run for some reason for build-dep, but it is not obvious (to me) what would cause this.

@mkrizek mkrizek removed the needs_triage Needs a first human triage before being processed. label Apr 19, 2018
@ansible ansible locked and limited conversation to collaborators Apr 27, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.5 This issue/PR affects Ansible v2.5 bug This issue/PR relates to a bug. module This issue/PR relates to a module. python3 support:core This issue/PR relates to code supported by the Ansible Engineering Team.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants