saltstack-formulas / salt-formula

Yes, Salt can Salt itself!
http://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html
Other
197 stars 423 forks source link

[BUG] formulas state fails on Windows #485

Closed noelmcloughlin closed 3 years ago

noelmcloughlin commented 3 years ago

Your setup

Formula commit hash / release tag

Versions reports (master & minion)

Pillar / config used


Bug details

Describe the bug

I was running salt-formula/init.sls and there are many state failures on Windows which need investigation.

Log attached.

Steps to reproduce the bug

Expected behaviour

Attempts to fix the bug

Additional context

myii commented 3 years ago

@noelmcloughlin That's a bit strange since we're successfully testing on Windows here:

Perhaps the salt-minion isn't installed properly. You can compare with this:

https://github.com/saltstack-formulas/salt-formula/blob/2dcd0c80efbd0acd0ca832a3435b7f3dc21788eb/kitchen.github.yml#L13-L20

noelmcloughlin commented 3 years ago

The suite runs salt.minion works okay.

          ID: salt-minion
    Function: file.recurse
        Name: C:\salt\conf/minion.d
      Result: True
     Comment: The directory C:\salt\conf/minion.d is in the correct state
     Started: 21:48:58.118000
    Duration: 208.0 ms
     Changes:
----------
          ID: remove-old-minion-conf-file
    Function: file.absent
        Name: C:\salt\conf/minion.d/_defaults.conf
      Result: True
     Comment: File C:\salt\conf/minion.d/_defaults.conf is not present
     Started: 21:48:58.327000
    Duration: 1.0 ms
     Changes:
----------
          ID: salt-minion
    Function: cmd.run
        Name: salt-call.bat --local service.restart salt-minion
      Result: True
     Comment: State was not run because none of the onchanges reqs changed
     Started: 21:48:58.328000
    Duration: 0.0 ms
     Changes:
----------
          ID: salt-minion
    Function: service.running
      Result: True
     Comment: The service salt-minion is already running
     Started: 21:48:58.351000
    Duration: 6.0 ms
     Changes:

Summary for local
------------
Succeeded: 4
Failed:    0
------------
Total states run:     4

I'm running salt.init which calls salt.formulas and that state is giving failures. state_failures_on_Windows_2.txt

noelmcloughlin commented 3 years ago

Looks like parallel: True does not work on Windows!

foo_app:
  git.latest:
    - name: https://github.com/saltstack-formulas/salt-formula.git
    - target: /tmp/bob
    - parallel: False  # True causes failed state
noelmcloughlin commented 3 years ago

This is bad logic too. user and group are looped/rendered multiple times.
https://github.com/saltstack-formulas/salt-formula/blob/2dcd0c80efbd0acd0ca832a3435b7f3dc21788eb/salt/formulas.sls#L38-L44

noelmcloughlin commented 3 years ago

After testing #486 there is one outstanding error on Windows. Not sure what error is about. There is a master branch

          ID: c:\salt\srv\salt\namespaces\saltstack-formulas/salt-formula_base
    Function: git.latest
        Name: https://github.com/saltstack-formulas/salt-formula.git
      Result: False
     Comment: Unable to get position of local branch 'master': fatal: ambiguous argument 'master^commit': unknown revision or path not in the working tree.
              Use '--' to separate paths from revisions, like this:
              'git <command> [<revision>...] -- [<file>...]'

This is the rendered state:

c:\salt\srv\salt\namespaces\saltstack-formulas/salt-formula_base:^M
  git.latest:^M
    - name: https://github.com/saltstack-formulas/salt-formula.git^M
    - parallel: False^M
    - target: c:\salt\srv\salt\namespaces\saltstack-formulas/salt-formula^M
    - branch: master^M
    - unless: test -e c:\salt\srv\salt\namespaces\saltstack-formulas/salt-formula >/dev/null 2>&1^M
noelmcloughlin commented 3 years ago

Actually ignore that error (I'm testing a PR branch of salt-formula and salt.formulas state is running git.latest state for salt-formula generating the error). So all issues resolved in #486

saltstack-formulas-travis commented 3 years ago

:tada: This issue has been resolved in version 1.5.2 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: