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

schedule.present not idempotent when scheduler disabled #54820

Closed
OrangeDog opened this issue Sep 30, 2019 · 11 comments
Closed

schedule.present not idempotent when scheduler disabled #54820

OrangeDog opened this issue Sep 30, 2019 · 11 comments
Assignees
Labels
Bug broken, incorrect, or confusing behavior fixed-pls-verify fix is linked, bug author to confirm fix P2 Priority 2 severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around
Milestone

Comments

@OrangeDog
Copy link
Contributor

Description of Issue

When the scheduler is disabled, the schedule.present state always reports changes

# salt-call schedule.disable
local:
    ----------
    comment:
        Disabled schedule on minion.
    result:
        True
# salt-call state.apply
local:
  Name: highstate - Function: schedule.present - Result: Changed Started: - 14:33:36.279721 Duration: 32.829 ms

Summary for local
--------------
Succeeded: 177 (changed=1)
Failed:      0
--------------
Total states run:     177
Total run time:    43.255 s
# salt-call state.apply
... etc.

Setup

highstate:
  schedule.present:
    - enabled: true
    - function: state.apply
    - job_kwargs:
        saltenv: base
    - minutes: 15
    - splay: 60
    - returner: zabbix
    - run_on_start: true

Versions Report

Salt Version:
           Salt: 2019.2.1

Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: 2.6.1
      docker-py: Not Installed
          gitdb: 2.0.3
      gitpython: 2.1.8
          ioflo: Not Installed
         Jinja2: 2.10
        libgit2: 0.26.0
        libnacl: Not Installed
       M2Crypto: 0.32.0
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.5.6
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: 0.26.2
         Python: 3.6.8 (default, Aug 20 2019, 17:12:48)
   python-gnupg: 0.4.1
         PyYAML: 3.12
          PyZMQ: 16.0.2
           RAET: Not Installed
          smmap: 2.0.3
        timelib: Not Installed
        Tornado: 4.5.3
            ZMQ: 4.2.5

System Versions:
           dist: Ubuntu 18.04 bionic
         locale: ISO-8859-1
        machine: x86_64
        release: 4.15.0-64-generic
         system: Linux
        version: Ubuntu 18.04 bionic
@OrangeDog
Copy link
Contributor Author

Related: #51824 #51825

@OrangeDog
Copy link
Contributor Author

Additionally they are coloured blue (changed) instead of yellow (would change) on a test run.

@garethgreenaway garethgreenaway self-assigned this Sep 30, 2019
@garethgreenaway
Copy link
Contributor

@OrangeDog Thanks for the report. Looks like it's related to having the enabled option in the state file.

@garethgreenaway garethgreenaway added fixed-pls-verify fix is linked, bug author to confirm fix Bug broken, incorrect, or confusing behavior severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around P2 Priority 2 labels Sep 30, 2019
@garethgreenaway garethgreenaway added this to the Approved milestone Sep 30, 2019
@OrangeDog
Copy link
Contributor Author

I may have things in a bit of a mess (which may be an issue on is own), but it appears I've got it non-idempotent with the scheduler enabled as well, so #51824 was either not fixed or subsequently broken again.

$ sudo salt-call schedule.enable
local:
    ----------
    comment:
        Enabled schedule on minion.
    result:
        True
$ sudo salt-call state.apply
local:
  Name: highstate - Function: schedule.present - Result: Changed Started: - 14:54:14.673392 Duration: 36.819 ms

Summary for local
--------------
Succeeded: 177 (changed=1)
Failed:      0
--------------
Total states run:     177
Total run time:    38.040 s

@garethgreenaway
Copy link
Contributor

@OrangeDog I was able to reproduce and believe I have the fix ready to go in a PR, would you be able to find the referenced changes, and see if that resolves the issue for you?

@OrangeDog
Copy link
Contributor Author

How best to patch a .deb installation with a git PR?

@garethgreenaway
Copy link
Contributor

@OrangeDog Are you using Python2 or Python3 packages?

@OrangeDog
Copy link
Contributor Author

OrangeDog commented Oct 1, 2019

Python: 3.6.8 (default, Aug 20 2019, 17:12:48)

@garethgreenaway
Copy link
Contributor

  1. Download the diff as a patch:
    curl -L -o /tmp/54828.diff https://patch-diff.githubusercontent.com/raw/saltstack/salt/pull/54828.diff
  2. Change into site-packages:
    cd /usr/lib/python3/dist-packages
  3. Ensure patch will work:
    patch --dry-run -p1 < /tmp/54828.diff
  4. Patch for real:
    patch -p1 < /tmp/54828.diff

@OrangeDog
Copy link
Contributor Author

Confirmed the patch fixes this issue and #54848

@OrangeDog
Copy link
Contributor Author

Fixed in 2019.2.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug broken, incorrect, or confusing behavior fixed-pls-verify fix is linked, bug author to confirm fix P2 Priority 2 severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around
Projects
None yet
Development

No branches or pull requests

2 participants