So i got these errors while run salt -G 'os:centos' state.apply

      ID: filebeat
Function: pkg.installed
  Result: False
 Comment: An exception occurred in this state: Traceback (most recent call la   st):
            File "/usr/lib/python2.6/site-packages/salt/state.py", line 1744,    in call
            File "/usr/lib/python2.6/site-packages/salt/loader.py", line 1702   , in wrapper
              return f(*args, **kwargs)
            File "/usr/lib/python2.6/site-packages/salt/states/pkg.py", line    1442, in installed
            File "/usr/lib/python2.6/site-packages/salt/modules/yumpkg.py", l   ine 1111, in install
              rpm_info = __salt__['lowpkg.bin_pkg_info'](pkg_source)
            File "/usr/lib/python2.6/site-packages/salt/modules/rpm.py", line    120, in bin_pkg_info
              for field in pkginfo._fields:
          AttributeError: 'NoneType' object has no attribute '_fields'
 Started: 07:57:34.542126
Duration: 10800.412 ms


This is part of my .yml file.

      {% if grains['os'] == 'Debian' or 'Ubuntu' %}
      - sources:
         - filebeat: https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-
      {% elif grains['os'] == 'Centos' %}
      - sources:
         - filebeat : https://artifacts.elastic.co/downloads/beats/filebeat/filebeat
      {% endif %}
  • Is it bug or i'm missing something?
    – Shadowraze
    Jan 17, 2017 at 13:29

1 Answer 1


Okay i made this working in retarded way, maybe someone will tell me the better way sometimes here.

      {% if grains['os'] == 'Debian' or 'Ubuntu' %}
      - sources:
         - filebeat: https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-5.1.2-amd64.deb
      {% endif %}
      {% if grains['os'] == 'CentOS' %}
      - sources:
         - filebeat: https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-5.1.2-x86_64.rpm
      {% endif %}
  • You changed several things - the match on grains['os'] (Centos vs. CentOS), an extra space after the second filebeat, and the if/then/else syntax. Which one of these had caused the ugly traceback? That one should be reported as a bug. Apr 9, 2017 at 19:51
  • @JosipRodin after if/then/else statement change it started working.
    – Shadowraze
    Apr 11, 2017 at 18:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.