saltstack / salt

Software to automate the management and configuration of any infrastructure or application at scale. Get access to the Salt software package repository here:
https://repo.saltproject.io/
Apache License 2.0
14.17k stars 5.48k forks source link

[BUG] Snap.installed not avalable in 3001 #58132

Open cwray opened 4 years ago

cwray commented 4 years ago

Description State snap.installed is missing from 3001. Ubuntu and many other communities are using snaps more and more.

This is extremely needed as time goes on.

Case and point. Some maintainers are moving exclusively to snaps and away from standard repositories and PPA's because they are supported on most platforms. https://github.com/certbot/certbot/issues/7950

Certbot.sls

add_certbot_snap:
  snap.installed:
    - name: certbot

Run state

doot@salt-master:~# salt 'salt-min*' state.apply certbot 
salt-min.lxd:
----------
          ID: add_certbot_snap
    Function: snap.installed
        Name: certbot
      Result: False
     Comment: State 'snap.installed' was not found in SLS 'certbot'
              Reason: 'snap.installed' is not available.
     Changes:   

Versions Report

doot@salt-master:~# salt -V
Salt Version:
           Salt: 3001

Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: 2.7.3
      docker-py: Not Installed
          gitdb: 2.0.6
      gitpython: 3.0.7
         Jinja2: 2.10.1
        libgit2: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.6.2
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: Not Installed
   pycryptodome: 3.6.1
         pygit2: Not Installed
         Python: 3.8.2 (default, Jul 16 2020, 14:00:26)
   python-gnupg: 0.4.5
         PyYAML: 5.3.1
          PyZMQ: 18.1.1
          smmap: 2.0.5
        timelib: Not Installed
        Tornado: 4.5.3
            ZMQ: 4.3.2

System Versions:
           dist: ubuntu 20.04 focal
         locale: utf-8
        machine: x86_64
        release: 5.0.0-32-generic
         system: Linux
        version: Ubuntu 20.04 focal
garethgreenaway commented 4 years ago

@cwray Thanks for the report. The snap state was contributed to the develop branch and there is a pending PR to bring it into the master branch, https://github.com/saltstack/salt/pull/56953. Once it has tests and ensuring those tests are passing, the PR will be merged and the feature will be available in an upcoming release.

cwray commented 4 years ago

Sweet, thank you guys for your hard work.

sagetherage commented 4 years ago

De-scoping this from the Magnesium release since there hasn't been time to write a test case in the Port to Master PR, yet

cwray commented 2 years ago

Has the snap integration lost traction? This would still be a wonderful feature to have in salt.

joshenders commented 1 year ago

Anything we can do to help this land in Sulphur v3006.0?

koenr commented 1 year ago

As a poor men solution, I use

jammy_install:

# snaps
  cmd.run:
    - names: 
## audacity
       - snap install audacity
       - snap connect audacity:alsa
lkubb commented 1 month ago

For anyone that followed this, I just released a Salt extension for Snapd: https://github.com/salt-extensions/saltext-snap

It should be much more comprehensive than the previous unported modules since it interfaces with the REST API in addition to the CLI, depending on the query/operation, and offers several states in addition to installed/removed (such as connected and service_running with mod_watch support).

I don't expect this issue to be fixed in Salt core (see great module migration).