Skip to content

No change on execute opereations (operations.apk: change detection not working correctly) #546

Open
@skutter-de

Description

@skutter-de

Describe the bug

When running an upgrade through apk, it doesn't correctly detect if anything was actually updated.
Example deploy:

apk.packages(
    name = "Refresh repo list",
    update = True
)

update = apk.packages(
    name = "Update everything",
    upgrade = True
)

if update.changed:
    server.reboot(delay=5, interval=1, reboot_timeout=300)

In this case, the server will always reboot. on the actual output it will also always say "success" instead of "no change". See the output below. I ran the deploy twice directly after each other. This is the output of the second run:

--> Starting operation: Refresh repo list 
    [192.168.2.13] Success

--> Starting operation: Update everything 
    [192.168.2.13] Success

--> Starting operation: Server/Reboot (delay=5, interval=1, reboot_timeout=300)
    [192.168.2.13] Connected
    [192.168.2.13] Success

To Reproduce

See above

Expected behavior

I expect the operation to yield "no change" instead of "success". It might be neccessary to analyze stdout to make this happen. You could just check if there's more than one line...

Meta

  • Include output of pyinfra --support
--> Support information:

    If you are having issues with pyinfra or wish to make feature requests, please
    check out the GitHub issues at https://github.com/Fizzadar/pyinfra/issues .
    When adding an issue, be sure to include the following:

    System: Linux
      Platform: Linux-5.4.67-09356-gf3ed4c0c4a31-x86_64-with-debian-10.8
      Release: 5.4.67-09356-gf3ed4c0c4a31
      Machine: x86_64
    pyinfra: v1.3.6
    Executable: /usr/local/bin/pyinfra
    Python: 3.7.3 (CPython, GCC 8.3.0)
  • How was pyinfra installed (source/pip)?
    pip

  • Consider including output with -vv and --debug.

--> Starting operation: Update everything 
    [pyinfra.api.operations] Starting operation Update everything on 192.168.2.13
    [pyinfra.api.connectors.ssh] Running command on 192.168.2.13: (pty=None) sh -c 'apk upgrade'
    [pyinfra.api.connectors.ssh] Waiting for exit status...
    [pyinfra.api.connectors.ssh] Command exit status: 0
    [192.168.2.13] Success

Metadata

Metadata

Assignees

No one assigned

    Labels

    discussionIssues that need opinions!operationsIssues with operations.specSpecification discussion / early stage issues.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions