saltstack / salt

Software to automate the management and configuration of any infrastructure or application at scale. Install Salt from the Salt package repositories here:
https://docs.saltproject.io/salt/install-guide/en/latest/
Apache License 2.0
14.19k stars 5.48k forks source link

[BUG] Windows pkg.refresh_db does not have repos #63519

Open DaAwesomeP opened 1 year ago

DaAwesomeP commented 1 year ago

Description Running pkg.refresh_db on Windows does not show any repositories. It errors because it did not update any repos.

Setup

Master: OVH VPS running Debian 11 Windows Minion: On-premises Windows 10 Enterprise IoT LTSC 2019

Steps to Reproduce the behavior

  1. On master, run update Windows repos
    salt-run -l debug winrepo.update_git_repos
     [DEBUG   ] TiamatPipPathFinder.find_spec: First time trying to load log4mongo
    [DEBUG   ] TiamatPipPathFinder.find_spec: First time trying to load raven
    [DEBUG   ] Reading configuration from /etc/salt/master
    [DEBUG   ] Including configuration from '/etc/salt/master.d/99-REDACTED.conf'
    [DEBUG   ] Reading configuration from /etc/salt/master.d/99-REDACTED.conf
    [DEBUG   ] Using cached minion ID from /etc/salt/minion_id: REDACTED
    [DEBUG   ] Missing configuration file: /root/.saltrc
    [WARNING ] Insecure logging configuration detected! Sensitive data may be logged.
    [DEBUG   ] TiamatPipPathFinder.find_spec: First time trying to load log4mongo
    [DEBUG   ] TiamatPipPathFinder.find_spec: First time trying to load raven
    [DEBUG   ] Configuration file path: /etc/salt/master
    [DEBUG   ] TiamatPipPathFinder.find_spec: First time trying to load git
    [DEBUG   ] TiamatPipPathFinder.find_spec: First time trying to load pygit2
    [DEBUG   ] TiamatPipPathFinder.find_spec: /opt/saltstack/salt/pypath/lib/python3.9/site-packages/pygit2 is a directory
    [DEBUG   ] The functions from module 'winrepo' are being loaded by dir() on the loaded module
    [DEBUG   ] LazyLoaded winrepo.update_git_repos
    [DEBUG   ] Reading configuration from /etc/salt/master
    [DEBUG   ] Including configuration from '/etc/salt/minion.d/99-REDACTED.conf'
    [DEBUG   ] Reading configuration from /etc/salt/minion.d/99-REDACTED.conf
    [DEBUG   ] Including configuration from '/etc/salt/minion.d/_schedule.conf'
    [DEBUG   ] Reading configuration from /etc/salt/minion.d/_schedule.conf
    [DEBUG   ] Using cached minion ID from /etc/salt/minion_id: REDACTED
    [DEBUG   ] Grains refresh requested. Refreshing grains.
    [DEBUG   ] Reading configuration from /etc/salt/master
    [DEBUG   ] Including configuration from '/etc/salt/master.d/99-REDACTED.conf'
    [DEBUG   ] Reading configuration from /etc/salt/master.d/99-REDACTED.conf
    [DEBUG   ] TiamatPipPathFinder.find_spec: First time trying to load pywintypes
    [DEBUG   ] TiamatPipPathFinder.find_spec: First time trying to load dns
    [DEBUG   ] TiamatPipPathFinder.find_spec: First time trying to load tldextract
    [DEBUG   ] TiamatPipPathFinder.find_spec: First time trying to load tldextract
    [DEBUG   ] The functions from module 'core' are being loaded by dir() on the loaded module
    [DEBUG   ] The functions from module 'disks' are being loaded by dir() on the loaded module
    [DEBUG   ] The functions from module 'extra' are being loaded by dir() on the loaded module
    [DEBUG   ] The functions from module 'lvm' are being loaded by dir() on the loaded module
    [DEBUG   ] The functions from module 'mdadm' are being loaded by dir() on the loaded module
    [DEBUG   ] The functions from module 'minion_process' are being loaded by dir() on the loaded module
    [DEBUG   ] TiamatPipPathFinder.find_spec: First time trying to load napalm
    [DEBUG   ] The functions from module 'opts' are being loaded by dir() on the loaded module
    [DEBUG   ] TiamatPipPathFinder.find_spec: First time trying to load pythoncom
    [DEBUG   ] TiamatPipPathFinder.find_spec: First time trying to load win32com
    [DEBUG   ] TiamatPipPathFinder.find_spec: First time trying to load win32api
    [DEBUG   ] Override  __utils__: 
    [DEBUG   ] The functions from module 'zfs' are being loaded by dir() on the loaded module
    [DEBUG   ] User provided environment variable 'LD_LIBRARY_PATH' with value '/opt/saltstack/salt/run' which is the value that PyInstaller set's. Removing it
    [DEBUG   ] Setting environment variable 'LD_LIBRARY_PATH' to an empty string
    [DEBUG   ] User provided environment variable 'LD_LIBRARY_PATH' with value '/opt/saltstack/salt/run' which is the value that PyInstaller set's. Removing it
    [DEBUG   ] Setting environment variable 'LD_LIBRARY_PATH' to an empty string
    [DEBUG   ] User provided environment variable 'LD_LIBRARY_PATH' with value '/opt/saltstack/salt/run' which is the value that PyInstaller set's. Removing it
    [DEBUG   ] Setting environment variable 'LD_LIBRARY_PATH' to an empty string
    [DEBUG   ] User provided environment variable 'LD_LIBRARY_PATH' with value '/opt/saltstack/salt/run' which is the value that PyInstaller set's. Removing it
    [DEBUG   ] Setting environment variable 'LD_LIBRARY_PATH' to an empty string
    [DEBUG   ] Unable to resolve address fe80::f816:3eff:fe39:aa4b: [Errno 1] Unknown host
    [DEBUG   ] Elapsed time getting FQDNs: 0.03778982162475586 seconds
    [DEBUG   ] User provided environment variable 'LD_LIBRARY_PATH' with value '/opt/saltstack/salt/run' which is the value that PyInstaller set's. Removing it
    [DEBUG   ] Setting environment variable 'LD_LIBRARY_PATH' to an empty string
    [DEBUG   ] User provided environment variable 'LD_LIBRARY_PATH' with value '/opt/saltstack/salt/run' which is the value that PyInstaller set's. Removing it
    [DEBUG   ] Setting environment variable 'LD_LIBRARY_PATH' to an empty string
    [DEBUG   ] User provided environment variable 'LD_LIBRARY_PATH' with value '/opt/saltstack/salt/run' which is the value that PyInstaller set's. Removing it
    [DEBUG   ] Setting environment variable 'LD_LIBRARY_PATH' to an empty string
    [DEBUG   ] User provided environment variable 'LD_LIBRARY_PATH' with value '/opt/saltstack/salt/run' which is the value that PyInstaller set's. Removing it
    [DEBUG   ] Setting environment variable 'LD_LIBRARY_PATH' to an empty string
    [DEBUG   ] User provided environment variable 'LD_LIBRARY_PATH' with value '/opt/saltstack/salt/run' which is the value that PyInstaller set's. Removing it
    [DEBUG   ] Setting environment variable 'LD_LIBRARY_PATH' to an empty string
    [DEBUG   ] TiamatPipPathFinder.find_spec: First time trying to load _bootlocale
    [DEBUG   ] User provided environment variable 'LD_LIBRARY_PATH' with value '/opt/saltstack/salt/run' which is the value that PyInstaller set's. Removing it
    [DEBUG   ] Setting environment variable 'LD_LIBRARY_PATH' to an empty string
    [DEBUG   ] User provided environment variable 'LD_LIBRARY_PATH' with value '/opt/saltstack/salt/run' which is the value that PyInstaller set's. Removing it
    [DEBUG   ] Setting environment variable 'LD_LIBRARY_PATH' to an empty string
    [DEBUG   ] User provided environment variable 'LD_LIBRARY_PATH' with value '/opt/saltstack/salt/run' which is the value that PyInstaller set's. Removing it
    [DEBUG   ] Setting environment variable 'LD_LIBRARY_PATH' to an empty string
    [DEBUG   ] User provided environment variable 'LD_LIBRARY_PATH' with value '/opt/saltstack/salt/run' which is the value that PyInstaller set's. Removing it
    [DEBUG   ] Setting environment variable 'LD_LIBRARY_PATH' to an empty string
    [DEBUG   ] TiamatPipPathFinder.find_spec: First time trying to load lsb_release
    [DEBUG   ] User provided environment variable 'LD_LIBRARY_PATH' with value '/opt/saltstack/salt/run' which is the value that PyInstaller set's. Removing it
    [DEBUG   ] Setting environment variable 'LD_LIBRARY_PATH' to an empty string
    [DEBUG   ] User provided environment variable 'LD_LIBRARY_PATH' with value '/opt/saltstack/salt/run' which is the value that PyInstaller set's. Removing it
    [DEBUG   ] Setting environment variable 'LD_LIBRARY_PATH' to an empty string
    [DEBUG   ] User provided environment variable 'LD_LIBRARY_PATH' with value '/opt/saltstack/salt/run' which is the value that PyInstaller set's. Removing it
    [DEBUG   ] Setting environment variable 'LD_LIBRARY_PATH' to an empty string
    [DEBUG   ] User provided environment variable 'LD_LIBRARY_PATH' with value '/opt/saltstack/salt/run' which is the value that PyInstaller set's. Removing it
    [DEBUG   ] Setting environment variable 'LD_LIBRARY_PATH' to an empty string
    [DEBUG   ] User provided environment variable 'LD_LIBRARY_PATH' with value '/opt/saltstack/salt/run' which is the value that PyInstaller set's. Removing it
    [DEBUG   ] Setting environment variable 'LD_LIBRARY_PATH' to an empty string
    [DEBUG   ] The functions from module 'zfs' are being loaded by dir() on the loaded module
    [DEBUG   ] LazyLoaded zfs.is_supported
    [DEBUG   ] User provided environment variable 'LD_LIBRARY_PATH' with value '/opt/saltstack/salt/run' which is the value that PyInstaller set's. Removing it
    [DEBUG   ] Setting environment variable 'LD_LIBRARY_PATH' to an empty string
    [DEBUG   ] MasterEvent PUB socket URI: /var/run/salt/master/master_event_pub.ipc
    [DEBUG   ] MasterEvent PULL socket URI: /var/run/salt/master/master_event_pull.ipc
    [DEBUG   ] TiamatPipPathFinder.find_spec: First time trying to load pywintypes
    [DEBUG   ] TiamatPipPathFinder.find_spec: First time trying to load immutables
    [DEBUG   ] TiamatPipPathFinder.find_spec: First time trying to load singledispatch
    [DEBUG   ] TiamatPipPathFinder.find_spec: First time trying to load singledispatch_helpers
    [DEBUG   ] TiamatPipPathFinder.find_spec: First time trying to load backports_abc
    [DEBUG   ] TiamatPipPathFinder.find_spec: First time trying to load backports
    [DEBUG   ] TiamatPipPathFinder.find_spec: First time trying to load saltwinshell
    [DEBUG   ] The functions from module 'auth' are being loaded by dir() on the loaded module
    [DEBUG   ] TiamatPipPathFinder.find_spec: First time trying to load netaddr
    [DEBUG   ] The functions from module 'cache' are being loaded by dir() on the loaded module
    [DEBUG   ] TiamatPipPathFinder.find_spec: First time trying to load smbprotocol
    [DEBUG   ] TiamatPipPathFinder.find_spec: First time trying to load pypsexec
    [DEBUG   ] TiamatPipPathFinder.find_spec: First time trying to load winrm
    [DEBUG   ] The functions from module 'cloud' are being loaded by dir() on the loaded module
    [DEBUG   ] The functions from module 'config' are being loaded by dir() on the loaded module
    [DEBUG   ] TiamatPipPathFinder.find_spec: First time trying to load M2Crypto
    [DEBUG   ] The functions from module 'doc' are being loaded by dir() on the loaded module
    [DEBUG   ] TiamatPipPathFinder.find_spec: First time trying to load paramiko
    [DEBUG   ] The functions from module 'error' are being loaded by dir() on the loaded module
    [DEBUG   ] The functions from module 'event' are being loaded by dir() on the loaded module
    [DEBUG   ] TiamatPipPathFinder.find_spec: First time trying to load pycontrol
    [DEBUG   ] The functions from module 'fileserver' are being loaded by dir() on the loaded module
    [DEBUG   ] The functions from module 'git_pillar' are being loaded by dir() on the loaded module
    [DEBUG   ] The functions from module 'http' are being loaded by dir() on the loaded module
    [DEBUG   ] The functions from module 'jobs' are being loaded by dir() on the loaded module
    [DEBUG   ] The functions from module 'launchd' are being loaded by dir() on the loaded module
    [DEBUG   ] The functions from module 'lxc' are being loaded by dir() on the loaded module
    [DEBUG   ] The functions from module 'manage' are being loaded by dir() on the loaded module
    [DEBUG   ] The functions from module 'mattermost' are being loaded by dir() on the loaded module
    [DEBUG   ] The functions from module 'mine' are being loaded by dir() on the loaded module
    [DEBUG   ] TiamatPipPathFinder.find_spec: First time trying to load libnacl
    [DEBUG   ] TiamatPipPathFinder.find_spec: First time trying to load netaddr
    [DEBUG   ] The functions from module 'network' are being loaded by dir() on the loaded module
    [DEBUG   ] The functions from module 'pagerduty' are being loaded by dir() on the loaded module
    [DEBUG   ] The functions from module 'pillar' are being loaded by dir() on the loaded module
    [DEBUG   ] The functions from module 'pkg' are being loaded by dir() on the loaded module
    [DEBUG   ] The functions from module 'queue' are being loaded by dir() on the loaded module
    [DEBUG   ] The functions from module 'reactor' are being loaded by dir() on the loaded module
    [DEBUG   ] The functions from module 'salt' are being loaded by dir() on the loaded module
    [DEBUG   ] The functions from module 'saltutil' are being loaded by dir() on the loaded module
    [DEBUG   ] The functions from module 'sdb' are being loaded by dir() on the loaded module
    [DEBUG   ] The functions from module 'vmadm' are being loaded by dir() on the loaded module
    [DEBUG   ] The functions from module 'ssh' are being loaded by dir() on the loaded module
    [DEBUG   ] The functions from module 'state' are being loaded by dir() on the loaded module
    [DEBUG   ] The functions from module 'survey' are being loaded by dir() on the loaded module
    [DEBUG   ] The functions from module 'test' are being loaded by dir() on the loaded module
    [DEBUG   ] The functions from module 'thin' are being loaded by dir() on the loaded module
    [DEBUG   ] The functions from module 'vault' are being loaded by dir() on the loaded module
    [DEBUG   ] TiamatPipPathFinder.find_spec: First time trying to load vcert
    [DEBUG   ] The functions from module 'virt' are being loaded by dir() on the loaded module
    [DEBUG   ] Sending event: tag = salt/run/20230120013938507121/new; data = {'fun': 'runner.winrepo.update_git_repos', 'jid': '20230120013938507121', 'user': 'root', 'fun_args': [], '_stamp': '2023-01-20T01:39:38.978431'}
    [DEBUG   ] pygit2 winrepo_provider enabled
    [DEBUG   ] Current fetch URL for winrepo remote 'https://github.com/saltstack/salt-winrepo.git': https://github.com/saltstack/salt-winrepo.git (desired: https://github.com/saltstack/salt-winrepo.git)
    [DEBUG   ] Current refspecs for winrepo remote 'https://github.com/saltstack/salt-winrepo.git': ['+refs/heads/*:refs/remotes/origin/*', '+refs/tags/*:refs/tags/*'] (desired: ['+refs/heads/*:refs/remotes/origin/*', '+refs/tags/*:refs/tags/*'])
    [DEBUG   ] Current http.sslVerify for winrepo remote 'https://github.com/saltstack/salt-winrepo.git': true (desired: true)
    [DEBUG   ] Set update lock for winrepo remote 'https://github.com/saltstack/salt-winrepo.git'
    [DEBUG   ] Fetching winrepo remote 'https://github.com/saltstack/salt-winrepo.git'
    [DEBUG   ] winrepo remote 'https://github.com/saltstack/salt-winrepo.git' is up-to-date
    [DEBUG   ] Removed update lock for winrepo remote 'https://github.com/saltstack/salt-winrepo.git'
    [DEBUG   ] Current fetch URL for winrepo remote 'https://github.com/saltstack/salt-winrepo-ng.git': https://github.com/saltstack/salt-winrepo-ng.git (desired: https://github.com/saltstack/salt-winrepo-ng.git)
    [DEBUG   ] Current refspecs for winrepo remote 'https://github.com/saltstack/salt-winrepo-ng.git': ['+refs/heads/*:refs/remotes/origin/*', '+refs/tags/*:refs/tags/*'] (desired: ['+refs/heads/*:refs/remotes/origin/*', '+refs/tags/*:refs/tags/*'])
    [DEBUG   ] Current http.sslVerify for winrepo remote 'https://github.com/saltstack/salt-winrepo-ng.git': true (desired: true)
    [DEBUG   ] Set update lock for winrepo remote 'https://github.com/saltstack/salt-winrepo-ng.git'
    [DEBUG   ] Fetching winrepo remote 'https://github.com/saltstack/salt-winrepo-ng.git'
    [DEBUG   ] winrepo remote 'https://github.com/saltstack/salt-winrepo-ng.git' is up-to-date
    [DEBUG   ] Removed update lock for winrepo remote 'https://github.com/saltstack/salt-winrepo-ng.git'
    [DEBUG   ] The functions from module 'local_cache' are being loaded by dir() on the loaded module
    [DEBUG   ] LazyLoaded local_cache.prep_jid
    [DEBUG   ] Sending event: tag = salt/run/20230120013938507121/ret; data = {'fun': 'runner.winrepo.update_git_repos', 'jid': '20230120013938507121', 'user': 'root', 'fun_args': [], '_stamp': '2023-01-20T01:39:39.260618', 'return': {'https://github.com/saltstack/salt-winrepo.git': '/srv/salt/win/repo/salt-winrepo', 'https://github.com/saltstack/salt-winrepo-ng.git': '/srv/salt/win/repo-ng/salt-winrepo-ng'}, 'success': True}
    [DEBUG   ] The functions from module 'nested' are being loaded by dir() on the loaded module
    [DEBUG   ] LazyLoaded nested.output
    https://github.com/saltstack/salt-winrepo-ng.git:
        /srv/salt/win/repo-ng/salt-winrepo-ng
    https://github.com/saltstack/salt-winrepo.git:
        /srv/salt/win/repo/salt-winrepo
    [INFO    ] Runner completed: 20230120013938507121
    [DEBUG   ] Closing IPCMessageClient instance
    [DEBUG   ] Runner return: {'https://github.com/saltstack/salt-winrepo.git': '/srv/salt/win/repo/salt-winrepo', 'https://github.com/saltstack/salt-winrepo-ng.git': '/srv/salt/win/repo-ng/salt-winrepo-ng'}
    [DEBUG   ] Restoring sys.argv to: ['/opt/saltstack/salt/run/run', '-l', 'debug', 'winrepo.update_git_repos']
    
  2. Configure minion with the following (no other config; this is using the default repos):
    common_pkg_win_refresh:
      module.run:
        - name: pkg.refresh_db
    common_pkg:
      pkg.installed:
        - require:
          - module: common_pkg_win_refresh
        - pkgs:
          - 7zip
          - firefox-esr_x64
  3. Apply states:

    salt 'REDACTED*' state.apply -l debug
     [DEBUG   ] TiamatPipPathFinder.find_spec: First time trying to load log4mongo
    [DEBUG   ] TiamatPipPathFinder.find_spec: First time trying to load raven
    [DEBUG   ] Reading configuration from /etc/salt/master
    [DEBUG   ] Including configuration from '/etc/salt/master.d/99-REDACTED.conf'
    [DEBUG   ] Reading configuration from /etc/salt/master.d/99-REDACTED.conf
    [DEBUG   ] Using cached minion ID from /etc/salt/minion_id: REDACTED
    [DEBUG   ] Missing configuration file: /root/.saltrc
    [WARNING ] Insecure logging configuration detected! Sensitive data may be logged.
    [DEBUG   ] TiamatPipPathFinder.find_spec: First time trying to load log4mongo
    [DEBUG   ] TiamatPipPathFinder.find_spec: First time trying to load raven
    [DEBUG   ] Configuration file path: /etc/salt/master
    [DEBUG   ] Reading configuration from /etc/salt/master
    [DEBUG   ] Including configuration from '/etc/salt/master.d/99-REDACTED.conf'
    [DEBUG   ] Reading configuration from /etc/salt/master.d/99-REDACTED.conf
    [DEBUG   ] Using cached minion ID from /etc/salt/minion_id: REDACTED
    [DEBUG   ] Missing configuration file: /root/.saltrc
    [DEBUG   ] MasterEvent PUB socket URI: /var/run/salt/master/master_event_pub.ipc
    [DEBUG   ] MasterEvent PULL socket URI: /var/run/salt/master/master_event_pull.ipc
    [DEBUG   ] Closing AsyncReqChannel instance
    [DEBUG   ] The functions from module 'local_cache' are being loaded by dir() on the loaded module
    [DEBUG   ] LazyLoaded local_cache.get_load
    [DEBUG   ] Reading minion list from /var/cache/salt/master/jobs/58/497beca9b45553f56be6ff17a94a8be7eeff506b77223bd957db5937b5fdb4/.minions.p
    [DEBUG   ] get_iter_returns for jid 20230120023123946234 sent to {'REDACTED'} will timeout at 21:31:28.958322
    [DEBUG   ] Checking whether jid 20230120023123946234 is still running
    [DEBUG   ] Closing AsyncReqChannel instance
    [DEBUG   ] retcode missing from client return
    [DEBUG   ] Checking whether jid 20230120023123946234 is still running
    [DEBUG   ] Closing AsyncReqChannel instance
    [DEBUG   ] retcode missing from client return
    [DEBUG   ] jid 20230120023123946234 return from REDACTED
    [DEBUG   ] return event: {'REDACTED': {'ret': {'module_|-common_pkg_win_refresh_|-pkg.refresh_db_|-run': {'name': 'pkg.refresh_db', 'changes': {'ret': {'total': 0, 'success': 0, 'failed': 0}}, 'comment': 'Module function pkg.refresh_db executed', 'result': True, '__sls__': 'common.pkg', '__run_num__': 0, 'start_time': '21:31:36.442740', 'duration': 1250.114, '__id__': 'common_pkg_win_refresh'}, 'pkg_|-common_pkg_|-common_pkg_|-installed': {'name': 'common_pkg', 'changes': {'7zip': 'Unable to locate package 7zip', 'firefox-esr_x64': 'Unable to locate package firefox-esr_x64'}, 'result': False, 'comment': 'The following packages failed to install/update: 7zip, firefox-esr_x64', '__sls__': 'common.pkg', '__run_num__': 1, 'start_time': '21:31:40.115085', 'duration': 124.973, '__id__': 'common_pkg'}}, 'out': 'highstate', 'retcode': 2, 'jid': '20230120023123946234'}}
    [DEBUG   ] The functions from module 'highstate' are being loaded by dir() on the loaded module
    [DEBUG   ] LazyLoaded highstate.output
    [DEBUG   ] The functions from module 'nested' are being loaded by dir() on the loaded module
    [DEBUG   ] LazyLoaded nested.output
    [DEBUG   ] The functions from module 'nested' are being loaded by dir() on the loaded module
    [DEBUG   ] LazyLoaded nested.output
    [DEBUG   ] jid 20230120023123946234 found all minions {'REDACTED'}
    [DEBUG   ] Closing IPCMessageSubscriber instance
    ERROR: Minions returned with non-zero exit code
    [DEBUG   ] Restoring sys.argv to: ['/opt/saltstack/salt/run/run', 'REDACTED*', 'state.apply', '-l', 'debug']
    REDACTED:
    ----------
              ID: common_pkg_win_refresh
        Function: module.run
            Name: pkg.refresh_db
          Result: True
        Comment: Module function pkg.refresh_db executed
        Started: 21:31:36.442740
        Duration: 1250.114 ms
        Changes:   
                  ----------
                  ret:
                      ----------
                      failed:
                          0
                      success:
                          0
                      total:
                          0
    ----------
              ID: common_pkg
        Function: pkg.installed
          Result: False
        Comment: The following packages failed to install/update: 7zip, firefox-esr_x64
        Started: 21:31:40.115085
        Duration: 124.973 ms
        Changes:   
                  ----------
                  7zip:
                      Unable to locate package 7zip
                  firefox-esr_x64:
                      Unable to locate package firefox-esr_x64
    
    Summary for REDACTED
    ------------
    Succeeded: 1 (changed=2)
    Failed:    1
    ------------
    Total states run:     2
    Total run time:   1.375 s
    
  4. I also tried running the modules directly (no states) to no avail.

Expected behavior Database should refresh on the minion and the packages should install.

Screenshots All console output is above in text form.

Versions Report

Master: salt --versions-report ```yaml Salt Version: Salt: 3005.1 Dependency Versions: cffi: 1.14.6 cherrypy: unknown dateutil: 2.8.1 docker-py: Not Installed gitdb: Not Installed gitpython: Not Installed Jinja2: 3.1.0 libgit2: 1.1.0 M2Crypto: Not Installed Mako: Not Installed msgpack: 1.0.2 msgpack-pure: Not Installed mysql-python: Not Installed pycparser: 2.21 pycrypto: Not Installed pycryptodome: 3.9.8 pygit2: 1.6.1 Python: 3.9.16 (main, Jan 6 2023, 22:49:58) python-gnupg: 0.4.8 PyYAML: 5.4.1 PyZMQ: 23.2.0 smmap: Not Installed timelib: 0.2.4 Tornado: 4.5.3 ZMQ: 4.3.4 System Versions: dist: debian 11 bullseye locale: utf-8 machine: x86_64 release: 5.10.0-20-cloud-amd64 system: Linux version: Debian GNU/Linux 11 bullseye ```
Minion: salt "REDACTED*" cmd.run 'salt --versions-report' ```yaml REDACTED: Salt Version: Salt: 3005.1 Dependency Versions: cffi: 1.14.6 cherrypy: unknown dateutil: 2.8.1 docker-py: Not Installed gitdb: 4.0.7 gitpython: 3.1.18 Jinja2: 3.1.0 libgit2: Not Installed M2Crypto: Not Installed Mako: 1.1.4 msgpack: 1.0.2 msgpack-pure: Not Installed mysql-python: Not Installed pycparser: 2.21 pycrypto: Not Installed pycryptodome: 3.10.1 pygit2: Not Installed Python: 3.8.15 (tags/v3.8.15:44adf8a, Nov 2 2022, 20:58:02) [MSC v.1916 64 bit (AMD64)] python-gnupg: 0.4.8 PyYAML: 5.4.1 PyZMQ: 22.0.3 smmap: 4.0.0 timelib: 0.2.4 Tornado: 4.5.3 ZMQ: 4.3.4 System Versions: dist: locale: cp1252 machine: AMD64 release: 2021 system: Windows version: 2021 10.0.19044 SP0 Multiprocessor Free ```

Additional context The documentation is kind of confusing. It is not immediately obvious that the repo is stored on the master and sent to the minion, and it seems that placing refresh: True in pkg.installed does not work (or maybe it doesn't work due to this issue). Instead, you must run the pkg.refresh_db module each time, which is not very clean.

OrangeDog commented 1 year ago

Have you changed file_roots from the default?

DaAwesomeP commented 1 year ago

@OrangeDog No, I have not directly touched that exact directive. Though I am using a different fileserver backend. I suppose that could be it! Sorry I did not remember that initially!

I have verified that /srv/salt/win/repo-ng/salt-winrepo-ng exists and has files and folders in it.

On the master the only other config is:

fileserver_backend:
  - gitfs

gitfs_provider: pygit2
gitfs_remotes:
  - ssh://git@github.com/REDACTED/REDACTED.git:
    - base: main
    - root: salt
    - pubkey: REDACTED.pub
    - privkey: REDACTED

ext_pillar:
  - git:
    - main ssh://git@github.com/REDACTED/REDACTED.git:
      - env: base
      - root: pillar
      - pubkey: REDACTED.pub
      - privkey: REDACTED
DaAwesomeP commented 1 year ago

@OrangeDog should I try something like:

fileserver_backend:
  - gitfs
  - roots

I do want Git to be first priority.

DaAwesomeP commented 1 year ago

OK, that was definitely a big part of the problem! Will leave this issue open until I submit a pull to add a note to docs about that.

But now I'm seeing this:

----------
          ID: common_pkg_win_refresh
    Function: module.run
        Name: pkg.refresh_db
      Result: True
     Comment: Module function pkg.refresh_db executed
     Started: 09:02:11.017479
    Duration: 225532.735 ms
     Changes:   
              ----------
              ret:
                  ----------
                  failed:
                      0
                  success:
                      309
                  total:
                      309
----------
          ID: common_pkg
    Function: pkg.installed
      Result: False
     Comment: The following packages failed to install/update: 7zip
              Failed to cache https://d.7-zip.org/a/7z2201-x64.msi
              Error: [Errno 11001] getaddrinfo failed reading /a/7z2201-x64.msi
              The following packages were already installed: firefox-esr_x64
     Started: 09:05:58.980199
    Duration: 3418.045 ms
     Changes:

Firefox ESR was installed separately on this machine before running Salt, so that part is correct.

DaAwesomeP commented 1 year ago

Hmm, OK I ran it again and it completed 100% fine. That sounds like maybe #58792.

DaAwesomeP commented 1 year ago

Another thing is just that pkg.refresh_db takes almost 4 minutes to complete. That's a lot.

OrangeDog commented 1 year ago

Yes, it syncs the git repo to a file root and then serves it from there.

It would probably also work over gitfs, and then you won't need any of the master-side commands. It seems like that should be the default option, but the docs never even mention the possibility.

DaAwesomeP commented 1 year ago

Yes, it syncs the git repo to a file root and then serves it from there.

Yes, I see.

It would probably also work over gitfs, and then you won't need any of the master-side commands.

How would I configure that?

It seems like that should be the default option, but the docs never even mention the possibility.

I will definitely add that to the docs if it works!

OrangeDog commented 1 year ago

Like this maybe?

gitfs_remotes:
  - https://github.com/saltstack/salt-winrepo-ng.git:
    - all_saltenvs: master
    - mountpoint: salt://win/repo-ng
  # ...
barbaricyawps commented 1 year ago

Since this is a bug, can we open a separate documentation issue for the docs request portion of this bug? That will make it easier for me to triage and track.

  1. Open a docs issue: https://github.com/saltstack/salt/issues/new/choose
  2. Explain the docs request and make sure you link to this original issue as a related issue.

I'm removing the documentation label for now.

DaAwesomeP commented 1 year ago

OK, so I resolved the issue with either of the following solutions:

Quick and easy, works for all installs (but not ideal for updating):

fileserver_backend:
  - gitfs
  - roots # for winrepo

gitfs_provider: pygit2
gitfs_remotes:
  - ssh://git@github.com/REDACTED/REDACTED.git:
    - base: main
    - root: salt
    - pubkey: REDACTED.pub
    - privkey: REDACTED

ext_pillar:
  - git:
    - main ssh://git@github.com/REDACTED/REDACTED.git:
      - env: base
      - root: pillar
      - pubkey: REDACTED.pub
      - privkey: REDACTED

What I ended up doing instead to avoid needing adding roots (@OrangeDog's mountpoint path was nearly correct):

fileserver_backend:
  - gitfs

gitfs_provider: pygit2
gitfs_remotes:
  - ssh://git@github.com/REDACTED/REDACTED.git:
    - base: main
    - root: salt
    - pubkey: REDACTED.pub
    - privkey: REDACTED
  - https://github.com/saltstack/salt-winrepo-ng.git:
    - all_saltenvs: master
    - mountpoint: salt://win/repo-ng/salt-winrepo-ng

ext_pillar:
  - git:
    - main ssh://git@github.com/REDACTED/REDACTED.git:
      - env: base
      - root: pillar
      - pubkey: REDACTED.pub
      - privkey: REDACTED

The latter method seems smoothest because the repo is updated whenever fileserver updates.

I was also able to very easily place my own package definitions in win/repo-ng/custom_defs, and that was very convenient and painless.

@barbaricyawps The above solution is a documentation issue, but I think this could be smoother out-of-the-box. I thought about maybe making the gitfs method default, but that doesn't work for every case since pygit2 may not be installed. I think maybe having some sort of warning print out if pkg.refresh_db returns 0 results would be good. It could link to a specific section of updated documentation.

OrangeDog commented 1 year ago

@barbaricyawps it's not a bug. The documentation just assumes you only have file roots.

barbaricyawps commented 1 year ago

Then we should label it as a docs issue rather than a bug in the title. Can someone summarize the action needed here?

DaAwesomeP commented 1 year ago

I think there are a few things that tripped me up in the docs when working on this. I should preface that I have been using Saltstack on Debian and RHEL machines extensively and this is the first time I have ventured into Windows with Saltstack.

Everything here is intended to be constructive and helpful. I will admit I became a bit frustrated while reading these docs. It was really @OrangeDog's comment that gave me the aha moment with how everything works. I didn't get that initially from the docs.

  1. Anything pertaining to the legacy repo system should be on a separate page. This was really confusing. The options for the old generation and new generation or interwoven across the whole page: https://docs.saltproject.io/en/latest/topics/windows/windows-package-manager.html
  2. It is really confusing that the default and first recommendation is to define Git repos with a different Git system then the one used everywhere else in Saltstack (gitfs). More on this below. It was not clear how this all works. It took me a while to realize that all pkg.refresh_db cared about was finding the repos in salt://win/repo-ng.
  3. The very top should maybe include an overview of how the system works and what it expects. Maybe replace the "Configuration" section at the very top with a numbered list explaining each step and what happens in it. Something like 1) Running salt-run winrepo.update_git_repos on the Master pulls the winrepo_remotes_ng repos into /srv/salt/win/repo-ng (Linux default) or the location defined by winrepo_dir_ng. 2) Alternatively, repos can be defined in any fileserver method (such as gitfs) to provide directories in salt://win/repo-ng and will be updated with that fileserver's method (and link to an example). 3) Running pkg.refresh_db on a Minion pulls from salt://win/repo-ng and updates the package database on a Minion.
  4. The way the masterless minion instructions are interwoven is also confusing. I feel like this should also be a separate page or all in one section at the end. Instead of putting some bits all around there could just be a link to that section.

I'm sure there was ample discussion and decisions made to use a separate Git system for the Windows package system, but it is very confusing. It is a redundant system considering that gitfs already provides Git mounts for salt://. I would guess the main reason was to have the default repo always work out-of-the-box, but I think this could also be solved by displaying a warning simply if salt://win/repo-ng does not exist or is empty when running pkg.refresh_db. This would have directly prevented me from opening this issue. It does report that it found 0 packages, but it doesn't say that the whole directory was missing. This warning should link to a section in the docs.

There should also maybe be a warning if you run winrepo.update_git_repos but roots is not configured. It should be very detectable if winrepo.update_git_repos pulls but nothing is configured to make use of the location it pulled to. This warning should also link to a section in the docs.

The last two are not blocking bugs per say but are usability improvements to the application. Everything above that are docs suggestions.

I am happy to turn one or more of these suggestions into pulls!