saltstack-formulas / openssh-formula

http://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html
Other
90 stars 297 forks source link

FreeBSD fails with no package name #100

Closed zgiles closed 7 years ago

zgiles commented 7 years ago

In FreeBSD 11, the run of this state fails because there is no package listed in the map, which is correct since there is no package ( pkg install sshd is not a thing ). However, there is no logic to not install the package that doesnt exist, resulting in a failed state, like below.

What is a good way to handle this? We could just {%if .. %} around the package installation to avoid it, or is there something more proper to ensure ssh is in-fact installed.

I'm happy to do the patch if anyone has an opinion about how it would be best to make it function.

----------
          ID: openssh-server
    Function: pkg.latest
      Result: False
     Comment: An exception occurred in this state: Traceback (most recent call last):
                File "/usr/local/lib/python2.7/site-packages/salt/state.py", line 1746, in call
                  **cdata['kwargs'])
                File "/usr/local/lib/python2.7/site-packages/salt/loader.py", line 1704, in wrapper
                  return f(*args, **kwargs)
                File "/usr/local/lib/python2.7/site-packages/salt/states/pkg.py", line 1879, in latest
                  **kwargs)
                File "/usr/local/lib/python2.7/site-packages/salt/modules/pkgng.py", line 318, in latest_version
                  ).pop(0)
              IndexError: pop from empty list
     Started: 18:17:46.085997
    Duration: 491.426 ms
     Changes:
----------
uname -a
FreeBSD server 11.0-RELEASE-p1 FreeBSD 11.0-RELEASE-p1 #0 r306420: Thu Sep 29 01:43:23 UTC 2016     root@releng2.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC  amd64
zgiles commented 7 years ago

Nevermind. I'm an idiot.. I mixed up a state I was writing with the formula. My bad. Sorry for the noise. Once I straightened it out ( after a few days of going back and forth ) it just works. Closing.